File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -614,7 +614,15 @@ fn (mut g Gen) infix_expr_in_op(node ast.InfixExpr) {
614
614
} else if right.unaliased_sym.kind == .map {
615
615
g.write ('_IN_MAP(' )
616
616
if ! left.typ.is_ptr () {
617
- styp := g.styp (node.left_type)
617
+ mut sym_map := g.table.sym (node.right_type)
618
+ if sym_map.info is ast.Alias {
619
+ sym_map = g.table.sym ((sym_map.info as ast.Alias ).parent_type)
620
+ }
621
+ styp := g.styp (if sym_map.info is ast.Map {
622
+ (sym_map.info as ast.Map ).key_type
623
+ } else {
624
+ node.left_type
625
+ })
618
626
g.write ('ADDR(${styp} , ' )
619
627
g.expr (node.left)
620
628
g.write (')' )
Original file line number Diff line number Diff line change
1
+ import datatypes
2
+
3
+ fn x () {
4
+ mut set1 := datatypes.Set[string ]{}
5
+ set1 .add ('' )
6
+ assert set1 .exists ('' )
7
+ }
8
+
9
+ fn y () {
10
+ mut set2 := datatypes.Set[int ]{}
11
+ set2 .add (1 )
12
+ assert set2 .exists (1 )
13
+ }
14
+
15
+ fn test_main () {
16
+ x ()
17
+ y ()
18
+ }
You can’t perform that action at this time.
0 commit comments