Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types, types2: missing error for shifts by huge untyped integers #43697

Closed
griesemer opened this issue Jan 14, 2021 · 4 comments
Closed

go/types, types2: missing error for shifts by huge untyped integers #43697

griesemer opened this issue Jan 14, 2021 · 4 comments
Assignees
Labels
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jan 14, 2021

Per the spec:

The right operand in a shift expression must have integer type or be an untyped constant representable by a value of type uint.

for the following code

package p

var x int
var _ = x << 100000000000000000000

go/types (and types2) should report an error but doesn't.

For reference, cmd/compile reports

main.go:4:11: constant 100000000000000000000 overflows uint
@griesemer griesemer added the NeedsFix label Jan 14, 2021
@griesemer griesemer added this to the Go1.17 milestone Jan 14, 2021
@griesemer griesemer self-assigned this Jan 14, 2021
@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Jan 14, 2021

cc: @findleyr

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 14, 2021

Change https://golang.org/cl/283872 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: untyped shift counts must fit into uint

gopherbot pushed a commit that referenced this issue Jan 14, 2021
…st fit into uint

Updates #43697.

Change-Id: If94658cb798bb0434ac3ebbf9dff504dcd59a02a
Reviewed-on: https://go-review.googlesource.com/c/go/+/283872
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@findleyr findleyr self-assigned this Jan 16, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Feb 11, 2021

Change https://golang.org/cl/291316 mentions this issue: [dev.regabi] go/types: untyped shift counts must fit into uint

gopherbot pushed a commit that referenced this issue Feb 13, 2021
This is a port of CL 283872 to go/types. It differs from that CL only in
added error codes.

For #43697

Change-Id: I62277834cef1c0359bcf2c6ee4388731babbc855
Reviewed-on: https://go-review.googlesource.com/c/go/+/291316
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
@findleyr
Copy link
Contributor

@findleyr findleyr commented Feb 23, 2021

Now that these changes are merged to master, I believe this can be closed. @griesemer please reopen if I'm misunderstanding something.

@findleyr findleyr closed this Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants