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

cmd/compile: duplicate index error should distinguish arrays and slices #35291

Closed
josharian opened this issue Oct 31, 2019 · 1 comment
Closed

cmd/compile: duplicate index error should distinguish arrays and slices #35291

josharian opened this issue Oct 31, 2019 · 1 comment

Comments

@josharian
Copy link
Contributor

@josharian josharian commented Oct 31, 2019

package main

var s = []string{
	1: "dup",
	1: "dup",
}

https://play.golang.org/p/cncTK4uwake

Compile. Result:

./prog.go:5:2: duplicate index in array literal: 1

But the duplicate index is in a slice literal, not an array literal.

Probably an artifact of how cmd/compile used to use TARRAY to represent both arrays and slices.

Low priority, but probably also an easy fix. Might be a good first issue for someone interested in the compilerr.

@josharian josharian added this to the Unplanned milestone Oct 31, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 31, 2019

Change https://golang.org/cl/204617 mentions this issue: cmd/compile: make duplicate index error distinguish arrays and slices

@gopherbot gopherbot closed this in efd395f Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.