diff options
author | Rob Findley <rfindley@google.com> | 2021-02-04 11:44:21 -0500 |
---|---|---|
committer | Robert Findley <rfindley@google.com> | 2021-02-08 23:25:48 +0000 |
commit | 618e3c15bdb5c031ac037e7ad5c1b3791a913226 (patch) | |
tree | ca6ea5952dd7fad4a7ef320e84f13a2d80552b51 /src/go/types/expr.go | |
parent | 50449de66aad9997690f40680cbca4ba26a41628 (diff) | |
download | go-618e3c15bdb5c031ac037e7ad5c1b3791a913226.tar.gz go-618e3c15bdb5c031ac037e7ad5c1b3791a913226.zip |
[dev.regabi] go/types: consistently report nil type as "untyped nil"
This is a port of CL 284052 to go/types. The port is not entirely
faithful, as untyped conversion has been refactored in go/types.
Additionally, a comment was added to reference issue #13061 in the
implicitType method.
For #13061
Change-Id: Iec17611f6432c988624023d1d74121ff34eb0c83
Reviewed-on: https://go-review.googlesource.com/c/go/+/289715
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/go/types/expr.go')
-rw-r--r-- | src/go/types/expr.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/go/types/expr.go b/src/go/types/expr.go index eb2056125a..f7fb0caedd 100644 --- a/src/go/types/expr.go +++ b/src/go/types/expr.go @@ -579,6 +579,8 @@ func (check *Checker) implicitType(x *operand, target Type) Type { if !hasNil(target) { return nil } + // Preserve the type of nil as UntypedNil: see #13061. + return Typ[UntypedNil] default: return nil } |