Proper checking of types

This commit is contained in:
Ulf Norell
2019-02-04 18:01:47 +01:00
parent dfa286d43c
commit d9188d58a7
6 changed files with 187 additions and 54 deletions
+9 -1
View File
@@ -75,7 +75,8 @@ compilable_contracts() ->
"builtin_bug",
"builtin_map_get_bug",
"nodeadcode",
"deadcode"
"deadcode",
"variant_types"
].
%% Contracts that should produce type errors
@@ -181,4 +182,11 @@ failing_contracts() ->
, {"bad_events2",
[<<"The event constructor BadEvent1 (at line 9, column 7) has too many string values (max 1)">>,
<<"The event constructor BadEvent2 (at line 10, column 7) has too many indexed values (max 3)">>]}
, {"type_clash",
[<<"Cannot unify int\n"
" and string\n"
"when checking the record projection at line 12, column 40\n"
" r.foo : (gas : int, value : int) => Remote.themap\n"
"against the expected type\n"
" (gas : int, value : int) => map(string, int)">>]}
].
+13
View File
@@ -0,0 +1,13 @@
contract Remote =
type themap = map(int, string)
function foo : () => themap
contract Main =
type themap = map(string, int)
// Should fail
function foo(r : Remote) : themap = r.foo()