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: bad line number for "missing type in composite literal" #18231

Closed
josharian opened this issue Dec 7, 2016 · 4 comments
Closed
Milestone

Comments

@josharian
Copy link
Contributor

package main

type T struct {
	f map[string]string
}

func main() {
	_ = T{
		f: {
			"a": "b",
		},
	}
}
$ go build x.go 
# command-line-arguments
./x.go:10: missing type in composite literal

Line 10 is "a": "b",. The missing type is map[string]string, and it belongs on line 9 (f: {).

Low priority. Possibly will be fixed for free by the fix to #16943.

cc @mdempsky @odeke-em

@josharian josharian added this to the Go1.9Maybe milestone Dec 7, 2016
@griesemer griesemer modified the milestones: Go1.9, Go1.9Maybe Dec 7, 2016
@griesemer griesemer self-assigned this Dec 7, 2016
@griesemer
Copy link
Contributor

Doesn't look like a regression (same behavior in 1.7, 1.6, and 1.5.). Yes, this should be fixed as part of #16943. Leaving as separate issue so test this case explicitly.

@griesemer
Copy link
Contributor

Assigning to @mdempsky since he is looking at a more principled setup if line numbers.

@griesemer griesemer assigned mdempsky and unassigned griesemer Feb 8, 2017
@griesemer
Copy link
Contributor

This is unrelated to #16943. Fix forthcoming.

@gopherbot
Copy link

CL https://golang.org/cl/37018 mentions this issue.

@golang golang locked and limited conversation to collaborators Feb 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants