/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/fixedbugs/issue74626.go
25 строк
505 B
Cherry Mui
cmd/compile: disallow nointerface method satisfying type constraint
20 май 2026, 00:51
20 май 2026, 00:51
8ddf003
Код
Авторство
О чём код?
// 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() }