diff options
Diffstat (limited to 'src/internal/types/testdata/fixedbugs/issue51025.go')
-rw-r--r-- | src/internal/types/testdata/fixedbugs/issue51025.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/internal/types/testdata/fixedbugs/issue51025.go b/src/internal/types/testdata/fixedbugs/issue51025.go new file mode 100644 index 0000000..207b06e --- /dev/null +++ b/src/internal/types/testdata/fixedbugs/issue51025.go @@ -0,0 +1,38 @@ +// Copyright 2022 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 p + +var _ interface{ m() } = struct /* ERROR m is a field, not a method */ { + m func() +}{} + +var _ interface{ m() } = & /* ERROR m is a field, not a method */ struct { + m func() +}{} + +var _ interface{ M() } = struct /* ERROR missing method M */ { + m func() +}{} + +var _ interface{ M() } = & /* ERROR missing method M */ struct { + m func() +}{} + +// test case from issue +type I interface{ m() } +type T struct{ m func() } +type M struct{} + +func (M) m() {} + +func _() { + var t T + var m M + var i I + + i = m + i = t // ERROR m is a field, not a method + _ = i +} |