mirror of
https://github.com/golang/go
synced 2024-11-18 14:44:41 -07:00
d62c6c3c39
If we've already complained about a type T, don't complain again about further expressions involving it. Fixes #20245 and hopefully all of its ilk. Change-Id: Ic0abe8235d52e8a7ac40e3615aea8f3a54fd7cec Reviewed-on: https://go-review.googlesource.com/42690 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
27 lines
580 B
Go
27 lines
580 B
Go
// errorcheck
|
|
|
|
// Copyright 2015 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.
|
|
|
|
// Test that incorrect expressions involving wrong anonymous interface
|
|
// do not generate panics in Type Stringer.
|
|
// Does not compile.
|
|
|
|
package main
|
|
|
|
type I interface {
|
|
int // ERROR "interface contains embedded non-interface int"
|
|
}
|
|
|
|
func n() {
|
|
(I)
|
|
}
|
|
|
|
func m() {
|
|
(interface{int}) // ERROR "interface contains embedded non-interface int" "type interface { int } is not an expression"
|
|
}
|
|
|
|
func main() {
|
|
}
|