fmt: don't prepend mod when cast with selective imported types (#9109)
							parent
							
								
									a64d9b3e12
								
							
						
					
					
						commit
						5b041db442
					
				|  | @ -1157,13 +1157,13 @@ pub fn (mut f Fmt) fn_decl(node ast.FnDecl) { | |||
| } | ||||
| 
 | ||||
| pub fn (mut f Fmt) as_cast(node ast.AsCast) { | ||||
| 	type_str := f.table.type_to_str(node.typ) | ||||
| 	type_str := f.table.type_to_str_using_aliases(node.typ, f.mod2alias) | ||||
| 	f.expr(node.expr) | ||||
| 	f.write(' as $type_str') | ||||
| } | ||||
| 
 | ||||
| pub fn (mut f Fmt) cast_expr(node ast.CastExpr) { | ||||
| 	f.write(f.table.type_to_str(node.typ) + '(') | ||||
| 	f.write(f.table.type_to_str_using_aliases(node.typ, f.mod2alias) + '(') | ||||
| 	f.expr(node.expr) | ||||
| 	if node.has_arg { | ||||
| 		f.write(', ') | ||||
|  |  | |||
|  | @ -1,8 +1,13 @@ | |||
| import v.ast | ||||
| import v.table | ||||
| 
 | ||||
| fn test_as() { | ||||
| 	a := sum_expr() as Bar | ||||
| 	_ := a | ||||
| 	_ := sum_expr() as InfixExpr | ||||
| 	_ := sum_expr() as ast.PrefixExpr | ||||
| } | ||||
| 
 | ||||
| fn test_cast() { | ||||
| 	_ := f32(0) | ||||
| 	_ := Type(0) | ||||
| 	_ := ast.Expr(sum_expr()) | ||||
| } | ||||
|  |  | |||
|  | @ -1,8 +1,14 @@ | |||
| import v.ast { InfixExpr } | ||||
| import v.table { Type } | ||||
| 
 | ||||
| fn test_as() { | ||||
| 	a := sum_expr()     as Bar | ||||
| 	_ := a | ||||
| 	_ := sum_expr()     as ast.InfixExpr | ||||
| 	_ := sum_expr() as ast.PrefixExpr | ||||
| } | ||||
| 
 | ||||
| fn test_cast() { | ||||
| 	_ := f32(0) | ||||
| 	_ := table.Type(0) | ||||
| 	_ := ast.Expr(sum_expr()) | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue