cgen: fix error for printing aliases of multi fixed array (#14348)
							parent
							
								
									fba29f1bb1
								
							
						
					
					
						commit
						04aae1e17b
					
				| 
						 | 
					@ -18,6 +18,9 @@ fn (mut g Gen) gen_assign_stmt(node_ ast.AssignStmt) {
 | 
				
			||||||
	mut return_type := ast.void_type
 | 
						mut return_type := ast.void_type
 | 
				
			||||||
	is_decl := node.op == .decl_assign
 | 
						is_decl := node.op == .decl_assign
 | 
				
			||||||
	g.assign_op = node.op
 | 
						g.assign_op = node.op
 | 
				
			||||||
 | 
						defer {
 | 
				
			||||||
 | 
							g.assign_op = .unknown
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	op := if is_decl { token.Kind.assign } else { node.op }
 | 
						op := if is_decl { token.Kind.assign } else { node.op }
 | 
				
			||||||
	right_expr := node.right[0]
 | 
						right_expr := node.right[0]
 | 
				
			||||||
	match right_expr {
 | 
						match right_expr {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3883,6 +3883,9 @@ fn (mut g Gen) cast_expr(node ast.CastExpr) {
 | 
				
			||||||
		g.expr(node.expr)
 | 
							g.expr(node.expr)
 | 
				
			||||||
		g.write('))')
 | 
							g.write('))')
 | 
				
			||||||
	} else if sym.kind == .alias && g.table.final_sym(node.typ).kind == .array_fixed {
 | 
						} else if sym.kind == .alias && g.table.final_sym(node.typ).kind == .array_fixed {
 | 
				
			||||||
 | 
							if node.expr is ast.ArrayInit && g.assign_op != .decl_assign {
 | 
				
			||||||
 | 
								g.write('(${g.typ(node.expr.typ)})')
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		g.expr(node.expr)
 | 
							g.expr(node.expr)
 | 
				
			||||||
	} else if node.expr_type == ast.bool_type && node.typ.is_int() {
 | 
						} else if node.expr_type == ast.bool_type && node.typ.is_int() {
 | 
				
			||||||
		styp := g.typ(node.typ)
 | 
							styp := g.typ(node.typ)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					Mat([[1, 2], [3, 4]])
 | 
				
			||||||
 | 
					Mat([[1, 2], [3, 4]])
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,7 @@
 | 
				
			||||||
 | 
					type Mat = [2][2]int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn main() {
 | 
				
			||||||
 | 
						a := Mat([[1, 2]!, [3, 4]!]!)
 | 
				
			||||||
 | 
						println(a)
 | 
				
			||||||
 | 
						println(Mat([[1, 2]!, [3, 4]!]!))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue