Skip to content

Commit 71d40c4

Browse files
committed
go/types: remove work-around for issue #26390
This work-around is not needed anymore now that method signatures are type-checked separately from their receiver base types: no artificial cycles are introduced anymore and so there is no need to artificially cut them. Fixes #26854. Change-Id: I2ef15ceeaa0b486f65f6cdc466d0cf06246c74d7 Reviewed-on: https://go-review.googlesource.com/c/139900 Reviewed-by: Alan Donovan <[email protected]>
1 parent 6d51dd1 commit 71d40c4

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

src/go/types/decl.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -150,31 +150,6 @@ func (check *Checker) objDecl(obj Object, def *Named) {
150150
}
151151

152152
case *TypeName:
153-
// fixFor26390 enables a temporary work-around to handle alias type names
154-
// that have not been given a type yet even though the underlying type
155-
// is already known. See testdata/issue26390.src for a simple example.
156-
// Set this flag to false to disable this code quickly (and comment
157-
// out the new test in decls4.src that will fail again).
158-
// TODO(gri) remove this for Go 1.12 in favor of a more comprehensive fix
159-
const fixFor26390 = true
160-
if fixFor26390 {
161-
// If we have a package-level alias type name that has not been
162-
// given a type yet but the underlying type is a type name that
163-
// has been given a type already, don't report a cycle but use
164-
// the underlying type name's type instead. The cycle shouldn't
165-
// exist in the first place in this case and is due to the way
166-
// methods are type-checked at the moment. See also the comment
167-
// at the end of Checker.typeDecl below.
168-
if d := check.objMap[obj]; d != nil && d.alias && obj.typ == Typ[Invalid] {
169-
// If we can find the underlying type name syntactically
170-
// and it has a type, use that type.
171-
if tname := check.resolveBaseTypeName(ast.NewIdent(obj.name)); tname != nil && tname.typ != nil {
172-
obj.typ = tname.typ
173-
break
174-
}
175-
}
176-
}
177-
178153
if check.typeCycle(obj) {
179154
// break cycle
180155
// (without this, calling underlying()

0 commit comments

Comments
 (0)