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

Parser accepts type arguments after the constructor name #34159

Closed
askeksa-google opened this issue Aug 16, 2018 · 2 comments
Closed

Parser accepts type arguments after the constructor name #34159

askeksa-google opened this issue Aug 16, 2018 · 2 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-fasta front-end-missing-error

Comments

@askeksa-google
Copy link

class C {
  C.named();
}

main() {
  new C.named<int>();
}

Is accepted without complaints. The type arguments are seemingly ignored. It should be a compile-time error (this is invalid syntax). The test language_2/named_constructor_test exposes this.

@askeksa-google askeksa-google added front-end-fasta area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error labels Aug 16, 2018
@eernstg
Copy link
Member

eernstg commented Aug 16, 2018

This feature has been on the official wishlist (insofar as such a thing exists ;-) for a long time. It would be justified to introduce a check for this situation and emit an error message, but there's certainly no need to change or delete parts of the parser in such a way that it makes those type arguments a syntax error at a deeper level (that is, such that the effort of re-introducing support for this syntax gets bigger).

@bwilkerson
Copy link
Member

Agreed. From the perspective of recovery, the parser is doing the right thing (other than the fact that no error message is emitted). We actually want to parse them, and eventually we should resolve them as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-fasta front-end-missing-error
Projects
None yet
Development

No branches or pull requests

3 participants