blob: b41fbe4ec4e45497fb384657ee28f5e037fc0d20 [file] [edit]
// errorcheck -goexperiment fieldtrack
// Copyright 2026 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 main
type Fooer interface {
Foo() string
}
type FooImpl struct{}
//go:nointerface
func (FooImpl) Foo() string { return "foo" }
func toInterface[T Fooer](fooer T) Fooer {
return fooer
}
func main() {
var iface Fooer = toInterface(FooImpl{}) // ERROR "does not satisfy Fooer"
iface.Foo()
}