You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "int" in the comment below is incorrect, should be "int32" (example from here):
varn=1.0<<s==j// 1.0 has type int; n == true
According to the rules
If the left operand of a non-constant shift expression is an untyped constant, it is first implicitly converted to the type it would assume if the shift expression were replaced by its left operand alone.
So the untyped constant 1.0 will be converted to the type is would assume if the declaration was var n = 1.0 == j, which is the type of j, int32.
All other annotations in that snippet are in agreement with the rules, afaict.
The text was updated successfully, but these errors were encountered:
The extra test just confirms that the type-checker internally
agrees with the spec with the (otherwise invisible) type given
to an untyped constant in a specific shift expression.
For #48422.
Change-Id: I6d98045f90bd20b0cc0a96a147bec9701039cb07
Reviewed-on: https://go-review.googlesource.com/c/go/+/350410
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
The "int" in the comment below is incorrect, should be "int32" (example from here):
According to the rules
So the untyped constant 1.0 will be converted to the type is would assume if the declaration was
var n = 1.0 == j
, which is the type ofj
, int32.All other annotations in that snippet are in agreement with the rules, afaict.
The text was updated successfully, but these errors were encountered: