Proper checking of types
This commit is contained in:
@@ -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)">>]}
|
||||
].
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user