mirror of
https://github.com/golang/go
synced 2024-11-26 08:38:01 -07:00
fd54ae8b0c
Add union support in types1, and allow exporting of unions, and importing unions back into types1 and types2. Added new test mincheck.go/mincheck.dir that tests that type lists (type sets) are correctly exported/imported, so that types2 gives correct errors that an instantiation doesn't fit the type list in the type param constraint. Change-Id: I8041c6c79289c870a95ed5a1b10e4c1c16985b12 Reviewed-on: https://go-review.googlesource.com/c/go/+/322609 Trust: Dan Scales <danscales@google.com> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
27 lines
585 B
Go
27 lines
585 B
Go
// errorcheck -lang=go1.17
|
|
|
|
// 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"
|
|
}
|
|
|
|
func n() {
|
|
(I)
|
|
}
|
|
|
|
func m() {
|
|
(interface{int}) // ERROR "interface contains embedded non-interface" "type interface { int } is not an expression"
|
|
}
|
|
|
|
func main() {
|
|
}
|