Skip to content

x/tools/gopls/internal/analyze/modernize: rangeint: transformation introduces invalid type #73037

@adonovan

Description

@adonovan

The rangeint modernizer introduces bad type syntax when it decides the for-loop's limit expression requires an explicit conversion:

package mlkem

func TestFieldAdd(t *testing.T) {
	for a := fieldElement(0); a < q; a++ {
		for b := fieldElement(0); b < q; b++ {
func TestFieldAdd(t *testing.T) {
	for a := range mlkem.fieldElement(q) { // undefined: mlkem
		for b := range mlkem.fieldElement(q) {

See https://go.dev/cl/659155.

We need better testing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions