Skip to content

incorrect and misleading compiler error message #1022

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

Closed
gopherbot opened this issue Aug 11, 2010 · 4 comments
Closed

incorrect and misleading compiler error message #1022

gopherbot opened this issue Aug 11, 2010 · 4 comments

Comments

@gopherbot
Copy link
Contributor

by ehog.hedge:

What steps will reproduce the problem?

Compile this code:

(((((((((((((((((((((((((((((((((
package main

type Int struct{value int}

func ok( spoo Int ) {
    _ = Int{1} 
}

func bad( spoo (Int) ) {
    _ = Int{1} 
}
)))))))))))))))))))))))))))

What is the expected output?

Silent (successful) compilation.

What do you see instead?

  main.go:7: cannot parenthesize type in composite literal

Setup:
  GOOS=linux GOARCH=amd64

Which revision are you using?  (hg identify)

  52b9b58d0cfa+ tip

This problem initially revealed itself when the argument types were
more complex -- chan(Int) or [](Int) -- but it's reduceable to just
the (superfluous, at least in this example) bracketing.

Exchanging the two function definition causes the error to additionally
appear inside ok as well as bad.

It /looks/ like the bracketing is being injected into the type at its
first appearance and persists after that.

Chris
@griesemer
Copy link
Contributor

Comment 1:

Owner changed to [email protected].

Status changed to Accepted.

@griesemer
Copy link
Contributor

Comment 2:

Labels changed: added compilerbug.

@rsc
Copy link
Contributor

rsc commented Aug 23, 2010

Comment 3:

Issue #1043 has been merged into this issue.

@rsc
Copy link
Contributor

rsc commented Aug 24, 2010

Comment 4:

This issue was closed by revision b1311cb.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
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

3 participants