parent
							
								
									c2315b6c86
								
							
						
					
					
						commit
						d28840036c
					
				|  | @ -484,7 +484,7 @@ fn (mut g Gen) index_of_map(node ast.IndexExpr, sym ast.TypeSymbol) { | |||
| 			if !node.is_option { | ||||
| 				g.or_block(tmp_opt, node.or_expr, elem_type) | ||||
| 			} | ||||
| 			g.write('\n$cur_line*($elem_type_str*)${tmp_opt}.data') | ||||
| 			g.write('\n${cur_line}(*($elem_type_str*)${tmp_opt}.data)') | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,24 @@ | |||
| struct Foo { | ||||
| mut: | ||||
| 	foo map[int]Bar | ||||
| } | ||||
| 
 | ||||
| struct Bar { | ||||
| mut: | ||||
| 	bar map[int]string | ||||
| } | ||||
| 
 | ||||
| fn test_nested_map_index() ? { | ||||
| 	f := Foo{ | ||||
| 		foo: { | ||||
| 			11: Bar{ | ||||
| 				bar: { | ||||
| 					22: 'hello' | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	ret := f.foo[11]?.bar[22]? | ||||
| 	println(ret) | ||||
| 	assert ret == 'hello' | ||||
| } | ||||
		Loading…
	
		Reference in New Issue