Instant unification error on arguments count mismatch (#225)
* Instant unification error on arguments count mismatch * add testcase * Add newline
This commit is contained in:
parent
2bf65cfd98
commit
bd7ed2ef8c
@ -2072,7 +2072,8 @@ unify1(_Env, {qcon, _, Name}, {qcon, _, Name}, _When) ->
|
|||||||
true;
|
true;
|
||||||
unify1(_Env, {bytes_t, _, Len}, {bytes_t, _, Len}, _When) ->
|
unify1(_Env, {bytes_t, _, Len}, {bytes_t, _, Len}, _When) ->
|
||||||
true;
|
true;
|
||||||
unify1(Env, {fun_t, _, Named1, Args1, Result1}, {fun_t, _, Named2, Args2, Result2}, When) ->
|
unify1(Env, {fun_t, _, Named1, Args1, Result1}, {fun_t, _, Named2, Args2, Result2}, When)
|
||||||
|
when length(Args1) == length(Args2) ->
|
||||||
unify(Env, Named1, Named2, When) andalso
|
unify(Env, Named1, Named2, When) andalso
|
||||||
unify(Env, Args1, Args2, When) andalso unify(Env, Result1, Result2, When);
|
unify(Env, Args1, Args2, When) andalso unify(Env, Result1, Result2, When);
|
||||||
unify1(Env, {app_t, _, {Tag, _, F}, Args1}, {app_t, _, {Tag, _, F}, Args2}, When)
|
unify1(Env, {app_t, _, {Tag, _, F}, Args1}, {app_t, _, {Tag, _, F}, Args2}, When)
|
||||||
|
@ -623,6 +623,28 @@ failing_contracts() ->
|
|||||||
"Empty record/map update\n"
|
"Empty record/map update\n"
|
||||||
" r {}">>
|
" r {}">>
|
||||||
])
|
])
|
||||||
|
, ?TYPE_ERROR(bad_number_of_args,
|
||||||
|
[<<?Pos(3, 39)
|
||||||
|
"Cannot unify () => unit\n"
|
||||||
|
" and (int) => 'a\n",
|
||||||
|
"when checking the application at line 3, column 39 of\n"
|
||||||
|
" f : () => unit\n"
|
||||||
|
"to arguments\n"
|
||||||
|
" 1 : int">>,
|
||||||
|
<<?Pos(4, 20)
|
||||||
|
"Cannot unify (int, string) => 'e\n"
|
||||||
|
" and (int) => 'd\n"
|
||||||
|
"when checking the application at line 4, column 20 of\n"
|
||||||
|
" g : (int, string) => 'e\n"
|
||||||
|
"to arguments\n"
|
||||||
|
" 1 : int">>,
|
||||||
|
<<?Pos(5, 20)
|
||||||
|
"Cannot unify (int, string) => 'c\n"
|
||||||
|
" and (string) => 'b\n"
|
||||||
|
"when checking the application at line 5, column 20 of\n"
|
||||||
|
" g : (int, string) => 'c\nto arguments\n"
|
||||||
|
" \"Litwo, ojczyzno moja\" : string">>
|
||||||
|
])
|
||||||
].
|
].
|
||||||
|
|
||||||
-define(Path(File), "code_errors/" ??File).
|
-define(Path(File), "code_errors/" ??File).
|
||||||
|
6
test/contracts/bad_number_of_args.aes
Normal file
6
test/contracts/bad_number_of_args.aes
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
contract Test =
|
||||||
|
entrypoint f() = ()
|
||||||
|
entrypoint g(x : int, y : string) = f(1)
|
||||||
|
entrypoint h() = g(1)
|
||||||
|
entrypoint i() = g("Litwo, ojczyzno moja")
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user