mirror of
https://github.com/golang/go
synced 2024-11-26 08:38:01 -07:00
cmd/compile: do not set ONAME type when evaluated in type context
Updates #43311 Change-Id: I26e397d071b434256dab0cc7fff9d134b80bd6e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/298711 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
fbee173545
commit
c082f9fee0
@ -446,7 +446,11 @@ func typecheck(n ir.Node, top int) (res ir.Node) {
|
||||
case top&(ctxType|ctxExpr) == ctxType && n.Op() != ir.OTYPE && n.Op() != ir.ONONAME && (t != nil || n.Op() == ir.ONAME):
|
||||
base.Errorf("%v is not a type", n)
|
||||
if t != nil {
|
||||
n.SetType(nil)
|
||||
if n.Op() == ir.ONAME {
|
||||
t.SetBroke(true)
|
||||
} else {
|
||||
n.SetType(nil)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// errorcheck
|
||||
// errorcheck -d=panic
|
||||
|
||||
// Copyright 2017 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
Loading…
Reference in New Issue
Block a user