diff --git a/src/cmd/compile/internal/ir/fmt.go b/src/cmd/compile/internal/ir/fmt.go index 6f6e26dec4..e8dd9df69d 100644 --- a/src/cmd/compile/internal/ir/fmt.go +++ b/src/cmd/compile/internal/ir/fmt.go @@ -714,6 +714,10 @@ func exprFmt(n Node, s fmt.State, prec int) { fmt.Fprintf(s, "... argument") return } + if typ := n.Type(); typ != nil { + fmt.Fprintf(s, "%v{%s}", typ, ellipsisIf(len(n.List) != 0)) + return + } if n.Ntype != nil { fmt.Fprintf(s, "%v{%s}", n.Ntype, ellipsisIf(len(n.List) != 0)) return diff --git a/src/cmd/compile/internal/noder/expr.go b/src/cmd/compile/internal/noder/expr.go index 16470a5449..66ce1bfe4c 100644 --- a/src/cmd/compile/internal/noder/expr.go +++ b/src/cmd/compile/internal/noder/expr.go @@ -88,6 +88,11 @@ func (g *irgen) expr(expr syntax.Expr) ir.Node { func (g *irgen) expr0(typ types2.Type, expr syntax.Expr) ir.Node { pos := g.pos(expr) + assert(pos.IsKnown()) + + // Set base.Pos for transformation code that still uses base.Pos, rather than + // the pos of the node being converted. + base.Pos = pos switch expr := expr.(type) { case *syntax.Name: diff --git a/test/run.go b/test/run.go index d6209c2591..82d49270f2 100644 --- a/test/run.go +++ b/test/run.go @@ -2167,40 +2167,12 @@ var types2Failures32Bit = setOf( ) var g3Failures = setOf( - // TODO: Triage tests without explicit failure explanations. From a - // cursory inspection, they mostly fall into: - // - Anonymous result parameters given different names (e.g., ~r0 vs ~r1) - // - Some escape analysis diagnostics being printed without position information - // - Some expressions printed differently (e.g., "int(100)" instead - // of "100" or "&composite literal" instead of "&[4]int{...}"). - - "closure3.go", // prints "s escapes to heap" without line number - "escape2.go", - "escape2n.go", - "escape4.go", // prints "1 escapes to heap" without line number - "escape_calls.go", - "escape_field.go", - "escape_iface.go", - "escape_indir.go", - "escape_level.go", - "escape_map.go", - "escape_param.go", - "escape_slice.go", - "escape_struct_param1.go", - "escape_struct_param2.go", - "writebarrier.go", // correct diagnostics, but different lines (probably irgen's fault) - - "fixedbugs/issue12006.go", - "fixedbugs/issue13799.go", + "writebarrier.go", // correct diagnostics, but different lines (probably irgen's fault) "fixedbugs/issue17270.go", // ICE in irgen "fixedbugs/issue20174.go", // ICE due to width not calculated (probably irgen's fault) "fixedbugs/issue20250.go", // correct diagnostics, but different lines (probably irgen's fault) - "fixedbugs/issue21709.go", - "fixedbugs/issue31573.go", - "fixedbugs/issue37837.go", - "fixedbugs/issue39292.go", - "fixedbugs/issue7921.go", // prints "composite literal does not escape" but test expects "[]byte{...} does not escape" - "fixedbugs/issue9691.go", // "cannot assign to int(.autotmp_4)" (probably irgen's fault) + "fixedbugs/issue37837.go", // ICE due to width not calculated + "fixedbugs/issue9691.go", // "cannot assign to int(.autotmp_4)" (probably irgen's fault) "typeparam/nested.go", // -G=3 doesn't support function-local types with generics