Skip to content

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

@josharian

Description

@josharian
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions