Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cd1554a2d | |||
| 662e5e70ef | |||
| 8e3483ced4 | |||
| 6efc390bb6 | |||
| 981027b2e7 | |||
| 11d998b739 | |||
| b481b3254b | |||
| 01a2efb7b8 | |||
| a730fcc366 | |||
| 457f9cf4ea | |||
| f34b6ed982 |
+8
-1
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Changed
|
||||
### Removed
|
||||
|
||||
## [4.0.0-rc4] - 2019-09-13
|
||||
### Added
|
||||
- Handle numeric escapes, i.e. `"\x19Ethereum Signed Message:\n"`, and similar strings.
|
||||
### Changed
|
||||
### Removed
|
||||
|
||||
## [4.0.0-rc3] - 2019-09-12
|
||||
### Added
|
||||
- `Bytes.concat` and `Bytes.split` are added to be able to
|
||||
@@ -154,7 +160,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Simplify calldata creation - instead of passing a compiled contract, simply
|
||||
pass a (stubbed) contract string.
|
||||
|
||||
[Unreleased]: https://github.com/aeternity/aesophia/compare/v4.0.0-rc3...HEAD
|
||||
[Unreleased]: https://github.com/aeternity/aesophia/compare/v4.0.0-rc4...HEAD
|
||||
[4.0.0-rc4]: https://github.com/aeternity/aesophia/compare/v4.0.0-rc3...v4.0.0-rc4
|
||||
[4.0.0-rc3]: https://github.com/aeternity/aesophia/compare/v4.0.0-rc1...v4.0.0-rc3
|
||||
[4.0.0-rc1]: https://github.com/aeternity/aesophia/compare/v3.2.0...v4.0.0-rc1
|
||||
[3.2.0]: https://github.com/aeternity/aesophia/compare/v3.1.0...v3.2.0
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
{base_plt_apps, [erts, kernel, stdlib, crypto, mnesia]}
|
||||
]}.
|
||||
|
||||
{relx, [{release, {aesophia, "4.0.0-rc3"},
|
||||
{relx, [{release, {aesophia, "4.0.0-rc4"},
|
||||
[aesophia, aebytecode, getopt]},
|
||||
|
||||
{dev_mode, true},
|
||||
|
||||
@@ -783,7 +783,8 @@ check_type(_Env, Type = {uvar, _, _}, Arity) ->
|
||||
ensure_base_type(Type, Arity),
|
||||
Type;
|
||||
check_type(_Env, {args_t, Ann, Ts}, _) ->
|
||||
type_error({new_tuple_syntax, Ann, Ts}).
|
||||
type_error({new_tuple_syntax, Ann, Ts}),
|
||||
{tuple_t, Ann, Ts}.
|
||||
|
||||
ensure_base_type(Type, Arity) ->
|
||||
[ type_error({wrong_type_arguments, Type, Arity, 0}) || Arity /= 0 ],
|
||||
@@ -1155,8 +1156,6 @@ infer_expr(Env, {typed, As, Body, Type}) ->
|
||||
{typed, _, NewBody, NewType} = check_expr(Env, Body, Type1),
|
||||
{typed, As, NewBody, NewType};
|
||||
infer_expr(Env, {app, Ann, Fun, Args0}) ->
|
||||
%% TODO: fix parser to give proper annotation for normal applications!
|
||||
FunAnn = aeso_syntax:get_ann(Fun),
|
||||
NamedArgs = [ Arg || Arg = {named_arg, _, _, _} <- Args0 ],
|
||||
Args = Args0 -- NamedArgs,
|
||||
case aeso_syntax:get_ann(format, Ann) of
|
||||
@@ -1165,15 +1164,15 @@ infer_expr(Env, {app, Ann, Fun, Args0}) ->
|
||||
prefix ->
|
||||
infer_op(Env, Ann, Fun, Args, fun infer_prefix/1);
|
||||
_ ->
|
||||
NamedArgsVar = fresh_uvar(FunAnn),
|
||||
NamedArgsVar = fresh_uvar(Ann),
|
||||
NamedArgs1 = [ infer_named_arg(Env, NamedArgsVar, Arg) || Arg <- NamedArgs ],
|
||||
%% TODO: named args constraints
|
||||
NewFun={typed, _, _, FunType} = infer_expr(Env, Fun),
|
||||
NewArgs = [infer_expr(Env, A) || A <- Args],
|
||||
ArgTypes = [T || {typed, _, _, T} <- NewArgs],
|
||||
ResultType = fresh_uvar(FunAnn),
|
||||
ResultType = fresh_uvar(Ann),
|
||||
unify(Env, FunType, {fun_t, [], NamedArgsVar, ArgTypes, ResultType}, {infer_app, Fun, Args, FunType, ArgTypes}),
|
||||
{typed, FunAnn, {app, Ann, NewFun, NamedArgs1 ++ NewArgs}, dereference(ResultType)}
|
||||
{typed, Ann, {app, Ann, NewFun, NamedArgs1 ++ NewArgs}, dereference(ResultType)}
|
||||
end;
|
||||
infer_expr(Env, {'if', Attrs, Cond, Then, Else}) ->
|
||||
NewCond = check_expr(Env, Cond, {id, Attrs, "bool"}),
|
||||
|
||||
@@ -355,6 +355,7 @@ unexpected_token_error(Ts, Expect, T) ->
|
||||
{con, _, X} when ExpectId -> io_lib:format(" Did you mean ~s?", [mk_lower(X)]);
|
||||
{qcon, _, Xs} when ExpectCon -> io_lib:format(" Did you mean ~s?", [lists:last(Xs)]);
|
||||
{qid, _, Xs} when ExpectId -> io_lib:format(" Did you mean ~s?", [lists:last(Xs)]);
|
||||
{return, _} -> " [Polite reminder that Sophia is not JavaScript]";
|
||||
_ -> ""
|
||||
end,
|
||||
mk_error(Ts, io_lib:format("Unexpected ~s.~s", [describe(T), Fix])).
|
||||
|
||||
+1
-1
@@ -312,7 +312,7 @@ map_key(Key, {ok, {_, Val}}) -> {map_key, Key, Val}.
|
||||
|
||||
elim(E, []) -> E;
|
||||
elim(E, [{proj, Ann, P} | Es]) -> elim({proj, Ann, E, P}, Es);
|
||||
elim(E, [{app, Ann, Args} | Es]) -> elim({app, Ann, E, Args}, Es);
|
||||
elim(E, [{app, _Ann, Args} | Es]) -> elim({app, aeso_syntax:get_ann(E), E, Args}, Es);
|
||||
elim(E, [{rec_upd, Ann, Flds} | Es]) -> elim(record_update(Ann, E, Flds), Es);
|
||||
elim(E, [{map_get, Ann, Key} | Es]) -> elim({map_get, Ann, E, Key}, Es);
|
||||
elim(E, [{map_get, Ann, Key, Val} | Es]) -> elim({map_get, Ann, E, Key, Val}, Es).
|
||||
|
||||
+5
-2
@@ -37,7 +37,8 @@ lexer() ->
|
||||
, {"[^/*]+|[/*]", skip()} ],
|
||||
|
||||
Keywords = ["contract", "include", "let", "switch", "type", "record", "datatype", "if", "elif", "else", "function",
|
||||
"stateful", "payable", "true", "false", "mod", "public", "entrypoint", "private", "indexed", "namespace"],
|
||||
"stateful", "payable", "true", "false", "mod", "public", "entrypoint", "private", "indexed", "namespace",
|
||||
"return"],
|
||||
KW = string:join(Keywords, "|"),
|
||||
|
||||
Rules =
|
||||
@@ -95,9 +96,11 @@ parse_char([$', C, $']) -> C.
|
||||
|
||||
unescape(Str) -> unescape(Str, []).
|
||||
|
||||
%% TODO: numeric escapes
|
||||
unescape([$"], Acc) ->
|
||||
list_to_binary(lists:reverse(Acc));
|
||||
unescape([$\\, $x, D1, D2 | Chars ], Acc) ->
|
||||
C = list_to_integer([D1, D2], 16),
|
||||
unescape(Chars, [C | Acc]);
|
||||
unescape([$\\, Code | Chars], Acc) ->
|
||||
Ok = fun(C) -> unescape(Chars, [C | Acc]) end,
|
||||
case Code of
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{application, aesophia,
|
||||
[{description, "Contract Language for aeternity"},
|
||||
{vsn, "4.0.0-rc3"},
|
||||
{vsn, "4.0.0-rc4"},
|
||||
{registered, []},
|
||||
{applications,
|
||||
[kernel,
|
||||
|
||||
@@ -301,7 +301,14 @@ failing_contracts() ->
|
||||
<<?Pos(54, 5)
|
||||
"Let binding at line 54, column 5 must be followed by an expression">>,
|
||||
<<?Pos(58, 5)
|
||||
"Let binding at line 58, column 5 must be followed by an expression">>])
|
||||
"Let binding at line 58, column 5 must be followed by an expression">>,
|
||||
<<?Pos(63, 5)
|
||||
"Cannot unify int\n"
|
||||
" and bool\n"
|
||||
"when checking the type of the expression at line 63, column 5\n"
|
||||
" id(n) : int\n"
|
||||
"against the expected type\n"
|
||||
" bool">>])
|
||||
, ?TYPE_ERROR(init_type_error,
|
||||
[<<?Pos(7, 3)
|
||||
"Cannot unify string\n"
|
||||
|
||||
@@ -15,3 +15,5 @@ contract BasicAuth =
|
||||
entrypoint to_sign(h : hash, n : int) =
|
||||
Crypto.blake2b((h, n))
|
||||
|
||||
entrypoint weird_string() : string =
|
||||
"\x19Weird String\x42\nMore\n"
|
||||
|
||||
@@ -57,3 +57,8 @@ contract Test =
|
||||
let f() = 0
|
||||
let g() = f()
|
||||
|
||||
function id(x : 'a) : 'a = x
|
||||
|
||||
entrypoint wrong_return(n : int) : bool =
|
||||
id(n)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user