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

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


None yet
3 participants
Copy link

askeksa-google commented Aug 16, 2018

class C {

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.


This comment has been minimized.

Copy link

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).


This comment has been minimized.

Copy link

bwilkerson commented Aug 16, 2018

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
You can’t perform that action at this time.