]> Cypherpunks repositories - gostls13.git/commit
go/types, types2: simplify Checker.typeAssertion, use same code in both type checkers
authorRobert Griesemer <gri@golang.org>
Thu, 3 Feb 2022 23:03:02 +0000 (15:03 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 4 Feb 2022 23:42:50 +0000 (23:42 +0000)
commitf1903fd4ecbf7a1e524bf71ddecb8650b9d2ea9f
tree1545f1c4900f13af649605e65fd26b37126e4ba9
parentef843ae49c8a8ad6494da294fc46b0e80147e715
go/types, types2: simplify Checker.typeAssertion, use same code in both type checkers

- Remove the xtyp argument from the Checker.typeAssertion parameter
  list; it was confusing and not needed. Adjusted call sites.

- Simplify logic in Checker.typeAssertion.

- Use the same code in both types2 and go/types, specifically
  use the same error positions.

- Adjust error messages as needed.

This removes another subtle discrepancy between types2 and go/types.
The go/types error messages don't have the have/want appendix for
the affected error messages yet because we don't use case folding
in lookups yet.

Change-Id: Id39f5c473da36c9baad60082f85cf1f34dc26c50
Reviewed-on: https://go-review.googlesource.com/c/go/+/383014
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/stmt.go
src/cmd/compile/internal/types2/testdata/check/issues.src
src/cmd/compile/internal/types2/testdata/fixedbugs/issue49005.go
src/cmd/compile/internal/types2/testdata/fixedbugs/issue50816.go2
src/go/types/expr.go
src/go/types/stmt.go
src/go/types/testdata/check/issues.src
src/go/types/testdata/fixedbugs/issue49005.go [new file with mode: 0644]
src/go/types/testdata/fixedbugs/issue50816.go2