]> Cypherpunks.ru repositories - gostls13.git/commit
go/types, types2: AssertableTo is undefined for generalized interfaces
authorRobert Griesemer <gri@golang.org>
Tue, 8 Feb 2022 02:37:02 +0000 (18:37 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 8 Feb 2022 23:29:18 +0000 (23:29 +0000)
commitc5bce7445e1792f134413ad312fd1f2211c0a55d
tree79c768e5c8545f199c3864a3595c571d0ba18dc9
parent0cbe3e00d820a2022d220d0790c0e85eb96de3d1
go/types, types2: AssertableTo is undefined for generalized interfaces

Document that AssertableTo is undefined (at least for 1.18) if
the first argument is a generalized interface; i.e., an interface
that may only be used as a constraint in Go code.

Still, implement it as we might expect it to be defined in the
future, to prevent problems down the road due to Hyrum's Law.

While at it, also removed the internal flag forceStrict and its
one use in Checker.assertableTo; forceStrict was never enabled
and if it would have been enabled, the behavior would not have
been correct.

Change-Id: Ie4dc9345c88d04c9640f881132154a002db22643
Reviewed-on: https://go-review.googlesource.com/c/go/+/383917
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/api.go
src/cmd/compile/internal/types2/api_test.go
src/cmd/compile/internal/types2/check.go
src/cmd/compile/internal/types2/lookup.go
src/go/types/api.go
src/go/types/api_test.go
src/go/types/check.go
src/go/types/lookup.go