]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/types2: delay recording types of untyped operands when checking...
authorRobert Griesemer <gri@golang.org>
Wed, 17 Mar 2021 23:59:47 +0000 (16:59 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 18 Mar 2021 00:23:25 +0000 (00:23 +0000)
commit51e4bb236cb8feb8118ed6dd768ddac834dad2ef
tree8613515630a4ea6a37dc803d38d8dd33dcd38c2d
parent2583c1b4df979eae16fab6527275030a630da42b
cmd/compile/internal/types2: delay recording types of untyped operands when checking against type parameters

Don't eagerly record the target type for an untyped operand if the
target type is just one of possibly many types in the type list of
a type parameter. Instead, record expression type only after we
checked that all types in the type list are ok.

Also, update assertion in Checker.recordTypeAndValue since (currently),
a type parameter is not considered a const type. We may change that,
eventually.

This is a temporary (but working) solution. Eventually we should
copy the approach taken in go/types.

Fixes #45096.

Change-Id: Icf61ee893aca6ead32bfc45ee5831572e672357b
Reviewed-on: https://go-review.googlesource.com/c/go/+/302755
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/compile/internal/types2/api_test.go
src/cmd/compile/internal/types2/check.go
src/cmd/compile/internal/types2/expr.go