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 invalid use of ... in conversion #43124

Closed
findleyr opened this issue Dec 10, 2020 · 4 comments
Closed

go/types, types2: missing error for invalid use of ... in conversion #43124

findleyr opened this issue Dec 10, 2020 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@findleyr
Copy link
Contributor

go/types does not report an error for the invalid code below:

type M []string                                                                                                                                                                                                               
                                                                                                                                                                                                                              
var (                                                                                                                                                                                                                         
        x = []string{"a", "b"}                                                                                                                                                                                                
        _ = M(x...)                                                                                                                                                                                                           
)

(https://play.golang.org/p/e_g7_Mauccq)

go/types accepts this code, but the compiler correctly reports the invalid use of ... in a type conversion. This bug exists in master
as well as go1.15 (haven't checked older commits).

CC @griesemer

@findleyr findleyr added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 10, 2020
@griesemer
Copy link
Contributor

Confirming that this bug also exists in types2 as expected.

@griesemer griesemer changed the title go/types: missing error for invalid use of ... in conversion go/types, types2: missing error for invalid use of ... in conversion Dec 10, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/277072 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: report invalid ... in conversions

@griesemer griesemer added this to the Go1.16 milestone Dec 10, 2020
gopherbot pushed a commit that referenced this issue Dec 11, 2020
…onversions

This fixes the bug below for types2.

Updates #43124.

Change-Id: I3cc12bec7e1001283f959df769331ad93582bc95
Reviewed-on: https://go-review.googlesource.com/c/go/+/277072
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/277352 mentions this issue: go/types: report invalid ... in conversions

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/278012 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: report invalid ... in conversions

gopherbot pushed a commit that referenced this issue Dec 14, 2020
…onversions

This fixes the bug below for types2.

Updates #43124.

Change-Id: Ic1962d41f321d8a08992d8529625bc133e526b0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/278012
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>
@golang golang locked and limited conversation to collaborators Dec 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants