mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile/internal/types2: overlapping embedded interfaces requires go1.14
Add respective check to type checker. Enables another excluded test in test/run.go. This CL completes the currently required checks for language compatibility in types2. Updates #31793. Change-Id: Icececff9e6023d38f600c93bcb54cdcafcf501b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/290911 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
fdf3496fcc
commit
ddec18cf82
4 changed files with 27 additions and 4 deletions
|
|
@ -192,7 +192,6 @@ func TestStdFixed(t *testing.T) {
|
||||||
"issue22200b.go", // go/types does not have constraints on stack size
|
"issue22200b.go", // go/types does not have constraints on stack size
|
||||||
"issue25507.go", // go/types does not have constraints on stack size
|
"issue25507.go", // go/types does not have constraints on stack size
|
||||||
"issue20780.go", // go/types does not have constraints on stack size
|
"issue20780.go", // go/types does not have constraints on stack size
|
||||||
"issue34329.go", // go/types does not have constraints on language level (-lang=go1.13) (see #31793)
|
|
||||||
"issue42058a.go", // go/types does not have constraints on channel element size
|
"issue42058a.go", // go/types does not have constraints on channel element size
|
||||||
"issue42058b.go", // go/types does not have constraints on channel element size
|
"issue42058b.go", // go/types does not have constraints on channel element size
|
||||||
"bug251.go", // issue #34333 which was exposed with fix for #34151
|
"bug251.go", // issue #34333 which was exposed with fix for #34151
|
||||||
|
|
|
||||||
21
src/cmd/compile/internal/types2/testdata/go1_13.src
vendored
Normal file
21
src/cmd/compile/internal/types2/testdata/go1_13.src
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright 2021 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.
|
||||||
|
|
||||||
|
// Check Go language version-specific errors.
|
||||||
|
|
||||||
|
package go1_13 // go1.13
|
||||||
|
|
||||||
|
// interface embedding
|
||||||
|
|
||||||
|
type I interface { m() }
|
||||||
|
|
||||||
|
type _ interface {
|
||||||
|
m()
|
||||||
|
I // ERROR "duplicate method m"
|
||||||
|
}
|
||||||
|
|
||||||
|
type _ interface {
|
||||||
|
I
|
||||||
|
I // ERROR "duplicate method m"
|
||||||
|
}
|
||||||
|
|
@ -943,9 +943,13 @@ func (check *Checker) completeInterface(pos syntax.Pos, ityp *Interface) {
|
||||||
check.errorf(pos, "duplicate method %s", m.name)
|
check.errorf(pos, "duplicate method %s", m.name)
|
||||||
check.errorf(mpos[other.(*Func)], "\tother declaration of %s", m.name) // secondary error, \t indented
|
check.errorf(mpos[other.(*Func)], "\tother declaration of %s", m.name) // secondary error, \t indented
|
||||||
default:
|
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() {
|
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(pos, "duplicate method %s", m.name)
|
check.errorf(pos, "duplicate method %s", m.name)
|
||||||
check.errorf(mpos[other.(*Func)], "\tother declaration of %s", m.name) // secondary error, \t indented
|
check.errorf(mpos[other.(*Func)], "\tother declaration of %s", m.name) // secondary error, \t indented
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1964,7 +1964,6 @@ var excluded = map[string]bool{
|
||||||
"fixedbugs/issue28079b.go": true, // types2 reports follow-on errors
|
"fixedbugs/issue28079b.go": true, // types2 reports follow-on errors
|
||||||
"fixedbugs/issue28268.go": true, // types2 reports follow-on errors
|
"fixedbugs/issue28268.go": true, // types2 reports follow-on errors
|
||||||
"fixedbugs/issue33460.go": true, // types2 reports alternative positions in separate error
|
"fixedbugs/issue33460.go": true, // types2 reports alternative positions in separate error
|
||||||
"fixedbugs/issue34329.go": true, // types2 is missing support for -lang flag
|
|
||||||
"fixedbugs/issue41575.go": true, // types2 reports alternative positions in separate error
|
"fixedbugs/issue41575.go": true, // types2 reports alternative positions in separate error
|
||||||
"fixedbugs/issue42058a.go": true, // types2 doesn't report "channel element type too large"
|
"fixedbugs/issue42058a.go": true, // types2 doesn't report "channel element type too large"
|
||||||
"fixedbugs/issue42058b.go": true, // types2 doesn't report "channel element type too large"
|
"fixedbugs/issue42058b.go": true, // types2 doesn't report "channel element type too large"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue