aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal')
-rw-r--r--src/cmd/compile/internal/noder/noder.go2
-rw-r--r--src/cmd/compile/internal/typecheck/typecheck.go4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/noder/noder.go b/src/cmd/compile/internal/noder/noder.go
index 8c456e4561..4c7c9fc322 100644
--- a/src/cmd/compile/internal/noder/noder.go
+++ b/src/cmd/compile/internal/noder/noder.go
@@ -689,7 +689,7 @@ func (p *noder) expr(expr syntax.Expr) ir.Node {
if expr.Kind == syntax.RuneLit {
n.SetType(types.UntypedRune)
}
- n.SetDiag(expr.Bad) // avoid follow-on errors if there was a syntax error
+ n.SetDiag(expr.Bad || n.Val().Kind() == constant.Unknown) // avoid follow-on errors if there was a syntax error
return n
case *syntax.CompositeLit:
n := ir.NewCompLitExpr(p.pos(expr), ir.OCOMPLIT, p.typeExpr(expr.Type), nil)
diff --git a/src/cmd/compile/internal/typecheck/typecheck.go b/src/cmd/compile/internal/typecheck/typecheck.go
index 647465af4f..548c1af85c 100644
--- a/src/cmd/compile/internal/typecheck/typecheck.go
+++ b/src/cmd/compile/internal/typecheck/typecheck.go
@@ -482,7 +482,9 @@ func typecheck1(n ir.Node, top int) ir.Node {
case ir.OLITERAL:
if n.Sym() == nil && n.Type() == nil {
- base.Fatalf("literal missing type: %v", n)
+ if !n.Diag() {
+ base.Fatalf("literal missing type: %v", n)
+ }
}
return n