]> Cypherpunks repositories - gostls13.git/commit
Revert "go/types, types2: remove unnecessary tests for x.typ == Typ[Invalid]"
authorRobert Findley <rfindley@google.com>
Thu, 13 Apr 2023 13:55:42 +0000 (13:55 +0000)
committerRobert Findley <rfindley@google.com>
Thu, 13 Apr 2023 15:58:47 +0000 (15:58 +0000)
commit0742e6dbc08f1ac5e7de966dcdf43cea03117c0c
tree1693e04c8082eb8f7cd0bda75269aef70e3f08e0
parent3f747d09e441999815fbb0a6025ade0f528967a8
Revert "go/types, types2: remove unnecessary tests for x.typ == Typ[Invalid]"

This reverts commit 4c49d52439805c248f4a01d529b90b22e821b7d6.

Reason for revert: it is trickier than expected to enforce an invariant that x.typ == Typ[Invalid] => x.mode == invalid. For example, builtins have invalid type until their call is evaluated.

I think it is better to keep this defensive code for now. My bad for suggesting this strictness. I will send a follow-up CL with a test that exercises the panic discovered inside Google, and a bit more commentary about what 'invalid' means in both contexts.

Fixes #59603

Change-Id: If291f7268e7ef7ae6cd9bb861bb9af349a729cb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/484375
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/assignments.go
src/go/types/assignments.go