aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/typexpr.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/types/typexpr.go')
-rw-r--r--src/go/types/typexpr.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/go/types/typexpr.go b/src/go/types/typexpr.go
index 6e89ccb027..b9249494fa 100644
--- a/src/go/types/typexpr.go
+++ b/src/go/types/typexpr.go
@@ -578,9 +578,13 @@ func (check *Checker) completeInterface(ityp *Interface) {
check.errorf(atPos(pos), _DuplicateDecl, "duplicate method %s", m.name)
check.errorf(atPos(mpos[other.(*Func)]), _DuplicateDecl, "\tother declaration of %s", m.name) // secondary error, \t indented
default:
- // check method signatures after all types are computed (issue #33656)
+ // We have a duplicate method name in an embedded (not explicitly declared) method.
+ // Check method signatures after all types are computed (issue #33656).
+ // If we're pre-go1.14 (overlapping embeddings are not permitted), report that
+ // error here as well (even though we could do it eagerly) because it's the same
+ // error message.
check.atEnd(func() {
- if !check.identical(m.typ, other.Type()) {
+ if !check.allowVersion(m.pkg, 1, 14) || !check.identical(m.typ, other.Type()) {
check.errorf(atPos(pos), _DuplicateDecl, "duplicate method %s", m.name)
check.errorf(atPos(mpos[other.(*Func)]), _DuplicateDecl, "\tother declaration of %s", m.name) // secondary error, \t indented
}