Commit c1359db9 authored by Robert Griesemer's avatar Robert Griesemer

go/types: fix empty interface optimization (minor performance bug)

The tests checking for empty interfaces so that they can be fast-
tracked in the code actually didn't test the right field and the
fast track code never executed. Doing it now.

Change-Id: I58b2951efb3fb40b3366874c79fd653591ae0e99
Reviewed-on: https://go-review.googlesource.com/97519Reviewed-by: 's avatarAlan Donovan <adonovan@google.com>
parent e2b5e603
......@@ -186,7 +186,7 @@ func (check *Checker) infoFromTypeLit(scope *Scope, iface *ast.InterfaceType, tn
check.interfaces[tname] = nil // computation started but not complete
}
if iface.Methods == nil {
if iface.Methods.List == nil {
// fast track for empty interface
info = &emptyIfaceInfo
} else {
......
......@@ -473,7 +473,7 @@ func (check *Checker) declareInSet(oset *objset, pos token.Pos, obj Object) bool
func (check *Checker) interfaceType(ityp *Interface, iface *ast.InterfaceType, def *Named, path []*TypeName) {
// fast-track empty interface
if iface.Methods == nil {
if iface.Methods.List == nil {
ityp.allMethods = markComplete
return
}
......
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