fmt: use type_to_str_using_alias instead of type_to_str in struct.v (#9431)
* fmt: use type_to_str_using_alias instead of type_to_str in struct.v * update testpull/9445/head
							parent
							
								
									522d70b48d
								
							
						
					
					
						commit
						e76c8d5dc0
					
				|  | @ -118,7 +118,7 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) { | |||
| 	mut default_expr_aligns := []CommentAndExprAlignInfo{} | ||||
| 	mut field_types := []string{cap: node.fields.len} | ||||
| 	for i, field in node.fields { | ||||
| 		mut ft := f.no_cur_mod(f.table.type_to_str(field.typ)) | ||||
| 		mut ft := f.no_cur_mod(f.table.type_to_str_using_aliases(field.typ, f.mod2alias)) | ||||
| 		if !ft.contains('C.') && !ft.contains('JS.') && !ft.contains('fn (') && !ft.contains('chan') { | ||||
| 			ft = f.short_module(ft) | ||||
| 		} | ||||
|  | @ -144,7 +144,7 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) { | |||
| 	} | ||||
| 	for embed in node.embeds { | ||||
| 		f.mark_types_import_as_used(embed.typ) | ||||
| 		styp := f.table.type_to_str(embed.typ) | ||||
| 		styp := f.table.type_to_str_using_aliases(embed.typ, f.mod2alias) | ||||
| 		f.writeln('\t$styp') | ||||
| 	} | ||||
| 	mut field_align_i := 0 | ||||
|  |  | |||
|  | @ -7,7 +7,11 @@ import os { | |||
| } | ||||
| 
 | ||||
| struct App { | ||||
| 	command Command | ||||
| 	command &Command | ||||
| } | ||||
| 
 | ||||
| struct MyCommand { | ||||
| 	Command | ||||
| } | ||||
| 
 | ||||
| fn imaginary(im f64) Complex { | ||||
|  |  | |||
|  | @ -8,7 +8,11 @@ import os { | |||
| 	input, user_os, file_ext } | ||||
| 
 | ||||
| struct App { | ||||
| 	command Command | ||||
| 	command &Command | ||||
| } | ||||
| 
 | ||||
| struct MyCommand { | ||||
| 	Command | ||||
| } | ||||
| 
 | ||||
| fn imaginary(im f64) Complex { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue