1
0
mirror of https://github.com/golang/go synced 2024-11-26 22:51:23 -07:00
go/test/fixedbugs/issue50169.go
Cherry Mui bc0aba9717 cmd/compile: correct type identity comparison with "any"
The builtin "any" type should only be identical to an unnamed empty
interface type, not a defined empty interface type.

Fixes #50169.

Change-Id: Ie5bb88868497cb795de1fd0276133ba9812edfe4
Reviewed-on: https://go-review.googlesource.com/c/go/+/372217
Trust: Cherry Mui <cherryyz@google.com>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-15 20:26:03 +00:00

25 lines
407 B
Go

// compile
// Copyright 2021 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
func main() {
var x Value
NewScanner().Scan(x)
}
type Value any
type Scanner interface{ Scan(any) error }
func NewScanner() Scanner {
return &t{}
}
type t struct{}
func (*t) Scan(interface{}) error { return nil }