Skip to content

Commit 775316f

Browse files
committed
[REVISE] check map
1 parent 1c4a5c3 commit 775316f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/semant.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ let check (signature, implementation) =
204204
if type2 = Void("Env") then sexpr2
205205
else if key_type = type2 then
206206
match key_type with
207-
Bool | Int | Uint("uint") | Address("ADDRESS") -> sexpr2
207+
Int | Uint("uint") | Address("ADDRESS") -> sexpr2
208208
| _ -> raise (Failure ("Type " ^ string_of_typ key_type ^
209209
" is not allowed as key type in map " ^ string_of_expr e ))
210210
else

testcase/41_check_map_query_key_type_not_allowed_fail.sc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ signature TOKEN{
44

55
storage supply : UInt;
66

7-
map balances : (void) => UInt;
7+
map balances : (Bool) => UInt;
88

99
constructor c : UInt -> void;
10-
method balanceOf : (int) -> UInt;
10+
method balanceOf : (Bool) -> UInt;
1111
}
1212

1313

@@ -20,11 +20,11 @@ constructor c (s : UInt){
2020
returns void;
2121
}
2222

23-
method balanceOf (a : int){
23+
method balanceOf (a : Bool){
2424
guard{
2525
Env.value == 0;
2626
}
2727
storage{}
2828
effects{}
29-
returns balances[ ( voidlit ) ]
29+
returns balances[(a)];
3030
}

0 commit comments

Comments
 (0)