cgen: fix generic_struct str() (#9504)
							parent
							
								
									736df955ff
								
							
						
					
					
						commit
						cabbf93faa
					
				| 
						 | 
					@ -475,7 +475,7 @@ fn (mut g Gen) gen_str_for_struct(info table.Struct, styp string, str_fn_name st
 | 
				
			||||||
		// TODO: this is a bit hacky. styp shouldn't be even parsed with _T_
 | 
							// TODO: this is a bit hacky. styp shouldn't be even parsed with _T_
 | 
				
			||||||
		// use something different than g.typ for styp
 | 
							// use something different than g.typ for styp
 | 
				
			||||||
		clean_struct_v_type_name = 
 | 
							clean_struct_v_type_name = 
 | 
				
			||||||
			clean_struct_v_type_name.replace('_T_', '<').replace('_', ', ').replace('Array', 'array') +
 | 
								clean_struct_v_type_name.replace('_Array', '_array').replace('_T_', '<').replace('_', ', ') +
 | 
				
			||||||
			'>'
 | 
								'>'
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	clean_struct_v_type_name = util.strip_main_name(clean_struct_v_type_name)
 | 
						clean_struct_v_type_name = util.strip_main_name(clean_struct_v_type_name)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,7 @@ fn test_generics_with_generics_struct_string() {
 | 
				
			||||||
	it := iter<string>(data)
 | 
						it := iter<string>(data)
 | 
				
			||||||
	println(it)
 | 
						println(it)
 | 
				
			||||||
	ret := '$it'
 | 
						ret := '$it'
 | 
				
			||||||
	assert ret.contains('arrayIterator<string>{')
 | 
						assert ret.contains('ArrayIterator<string>{')
 | 
				
			||||||
	assert ret.contains("data: ['foo', 'bar']")
 | 
						assert ret.contains("data: ['foo', 'bar']")
 | 
				
			||||||
	assert ret.contains('index: 11')
 | 
						assert ret.contains('index: 11')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue