1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:40:21 -07:00

cmd/compile: require -lang=go1.14 for overlapping interfaces

Support for overlapping interfaces is a new (proposed) Go language
feature to be supported in Go 1.14, so it shouldn't be supported under
-lang=go1.13 or earlier.

Fixes #34329.

Change-Id: I5fea5716b7d135476980bc40b4f6e8c611b67735
Reviewed-on: https://go-review.googlesource.com/c/go/+/195678
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Matthew Dempsky 2019-09-16 11:28:05 -07:00
parent c2facbe937
commit 7f907b9cee
3 changed files with 16 additions and 1 deletions

View File

@ -34,7 +34,7 @@ func expandiface(t *types.Type) {
switch prev := seen[m.Sym]; {
case prev == nil:
seen[m.Sym] = m
case !explicit && types.Identical(m.Type, prev.Type):
case langSupported(1, 14) && !explicit && types.Identical(m.Type, prev.Type):
return
default:
yyerrorl(m.Pos, "duplicate method %s", m.Sym.Name)

View File

@ -181,6 +181,7 @@ func TestStdFixed(t *testing.T) {
"issue25507.go", // go/types does not have constraints on stack size
"issue20780.go", // go/types does not have constraints on stack size
"issue31747.go", // go/types does not have constraints on language level (-lang=go1.12) (see #31793)
"issue34329.go", // go/types does not have constraints on language level (-lang=go1.13) (see #31793)
)
}

View File

@ -0,0 +1,14 @@
// errorcheck -lang=go1.13
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
type I interface { M() }
type _ interface {
I
I // ERROR "duplicate method M"
}