Commit d8796b56 authored by Robert Griesemer's avatar Robert Griesemer
Browse files

[dev.typeparams] cmd/compile/internal/types2: report type of nil based on context

With this CL, the type reported for uses of the predeclared
identifier nil changes from untyped nil to the type of the
context within which nil is used, matching the behaviour of
types2 for other untyped types.

If an untyped nil value is assigned or converted to an
interface, the nil expression is given the interface type.

The predicate TypeAndValue.IsNil doesn't change in behavior,
it still reports whether the relevant expression is a (typed
or untyped) nil value.

Change-Id: Id766468f3f3f2a53e4c55e1e6cd521e459c4a94f
Reviewed-on: https://go-review.googlesource.com/c/go/+/284218


Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: default avatarRobert Findley <rfindley@google.com>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent 48a3cb39
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment