]> Cypherpunks repositories - gostls13.git/commit
go/types: more robust behavior in the presence errors (due to import "C")
authorRobert Griesemer <gri@golang.org>
Fri, 19 Jan 2018 01:45:58 +0000 (17:45 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 23 Jan 2018 20:52:40 +0000 (20:52 +0000)
commitf27a1ff2c8ba1dce874e76d0b82c059b38a731d3
tree63e0c6999bda50a84110f2f43f095a2705522280
parent2edc4d46340ca64dfc4dbcb8433868b6f29a7a07
go/types: more robust behavior in the presence errors (due to import "C")

- Don't complain about invalid constant type if the type is
  invalid already (we do this in other places as well). This
  is useful to do in general, and even more so if we have
  invalid types due to import "C".

- Type-check the lhs of an assignment even if we bail out early
  due to an error on the rhs. This was simply an oversight. We
  already have machinery in place to "use" expressions; in this
  case we just have to also make sure we don't overcount "uses"
  of variables on the lhs.

- Fix overcount uses correction in assignments: Only do it if
  the variable in question is declared inside the same package
  to avoid possible race conditions when type-checking exported
  variables concurrently.

Fixes #22090.

Change-Id: I4c1b59f9ce38970e7129fedc5f6023908386e4f1
Reviewed-on: https://go-review.googlesource.com/88375
Reviewed-by: Alan Donovan <adonovan@google.com>
src/go/types/assignments.go
src/go/types/call.go
src/go/types/decl.go
src/go/types/stmt.go
src/go/types/testdata/importC.src
src/go/types/typexpr.go