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

go/parser: fails when a valid function declaration follows an broken one #29145

Open
stamblerre opened this issue Dec 7, 2018 · 1 comment
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@stamblerre
Copy link
Contributor

Repro case:

package main

type e struct {
	error
}

func (*e) random() {}

func main() {
	var diags []error
	for _, err := range diags {
		handled := handle(err)
                handled.
	}
}

func handle(err error) *e {
	return &e{err}
}

The selector with no "Sel" field breaks parsing in the main function, causing the code below it to fail parsing. The handle function never gets registered as a function declaration. Moving the handle function above the main function causes this code to type-check as expected. This poses a problem for editor-integrated tools that need to work on broken code.

@stamblerre stamblerre self-assigned this Dec 7, 2018
@stamblerre
Copy link
Contributor Author

/cc @ianthehat

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 13, 2018
@ALTree ALTree added this to the Unplanned milestone Dec 13, 2018
@stamblerre stamblerre removed their assignment Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants