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
Assignees
Milestone

Comments

@findleyr
Copy link
Contributor

@findleyr findleyr commented Dec 10, 2020

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

@griesemer
Copy link
Contributor

@griesemer griesemer commented Dec 10, 2020

Confirming that this bug also exists in types2 as expected.

Loading

@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

@gopherbot gopherbot commented Dec 10, 2020

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

Loading

@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

@gopherbot gopherbot commented Dec 11, 2020

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

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 14, 2020

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

Loading

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>
@gopherbot gopherbot closed this in 6e3cc5c Dec 14, 2020
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