Commit 36531204 authored by Robert Griesemer's avatar Robert Griesemer

go/types: simplify some internal code

Change-Id: Ia32d40cc272cb049c0a7c9d5f8ef4329bdefc7fe
Reviewed-on: https://go-review.googlesource.com/135699
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarAlan Donovan <adonovan@google.com>
parent bc529edc
...@@ -140,20 +140,12 @@ func (check *Checker) objDecl(obj Object, def *Named) { ...@@ -140,20 +140,12 @@ func (check *Checker) objDecl(obj Object, def *Named) {
// order code. // order code.
switch obj := obj.(type) { switch obj := obj.(type) {
case *Const: case *Const:
if check.typeCycle(obj) { if check.typeCycle(obj) || obj.typ == nil {
obj.typ = Typ[Invalid]
break
}
if obj.typ == nil {
obj.typ = Typ[Invalid] obj.typ = Typ[Invalid]
} }
case *Var: case *Var:
if check.typeCycle(obj) { if check.typeCycle(obj) || obj.typ == nil {
obj.typ = Typ[Invalid]
break
}
if obj.typ == nil {
obj.typ = Typ[Invalid] obj.typ = Typ[Invalid]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment