table: fix alias of sumtype method_call (#11268)
							parent
							
								
									ec196cfcd1
								
							
						
					
					
						commit
						b80777df4b
					
				| 
						 | 
				
			
			@ -475,7 +475,7 @@ pub fn (t &Table) find_field(s &TypeSymbol, name string) ?StructField {
 | 
			
		|||
				}
 | 
			
		||||
			}
 | 
			
		||||
			SumType {
 | 
			
		||||
				t.resolve_common_sumtype_fields(s)
 | 
			
		||||
				t.resolve_common_sumtype_fields(ts)
 | 
			
		||||
				if field := ts.info.find_field(name) {
 | 
			
		||||
					return field
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
import x.json2
 | 
			
		||||
 | 
			
		||||
type MyType = json2.Any
 | 
			
		||||
 | 
			
		||||
struct Data {
 | 
			
		||||
	prop MyType
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn test_alias_sumtype_method_call() {
 | 
			
		||||
	a := '{"a":"a","b":1}'
 | 
			
		||||
	json := json2.raw_decode(a) or { panic(err) }
 | 
			
		||||
	data := Data{json}
 | 
			
		||||
	json_str := data.prop.str()
 | 
			
		||||
	println(json_str)
 | 
			
		||||
	assert json_str == '{"a":"a","b":1}'
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue