diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/types/identity.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types/identity.go b/src/cmd/compile/internal/types/identity.go index f99e50a1c3..a164b84da9 100644 --- a/src/cmd/compile/internal/types/identity.go +++ b/src/cmd/compile/internal/types/identity.go @@ -59,7 +59,11 @@ func identical(t1, t2 *Type, flags int, assumedEqual map[typePair]struct{}) bool case TINT32: return (t1 == Types[TINT32] || t1 == RuneType) && (t2 == Types[TINT32] || t2 == RuneType) case TINTER: - // Make sure named any type matches any empty interface. + // Make sure named any type matches any empty interface + // (but not a shape type, if identStrict). + if flags&identStrict != 0 { + return t1 == AnyType && t2.IsEmptyInterface() && !t2.HasShape() || t2 == AnyType && t1.IsEmptyInterface() && !t1.HasShape() + } return t1 == AnyType && t2.IsEmptyInterface() || t2 == AnyType && t1.IsEmptyInterface() default: return false |
