Skip to content

No error on type argument after constructor name with implicit new #34270

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
askeksa-google opened this issue Aug 27, 2018 · 4 comments
Closed
Assignees
Labels
legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Milestone

Comments

@askeksa-google
Copy link

This program gives no error in the analyzer:

class Foo<X> {
  Foo.bar();
}

main() {
  Foo.bar<int>();
}

See also #34159

@askeksa-google askeksa-google added the legacy-area-analyzer Use area-devexp instead. label Aug 27, 2018
@bwilkerson
Copy link
Member

This also does not produce any errors on the VM, so I believe that it's working as intended. Why did you expect to see an error?

@bwilkerson bwilkerson added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Aug 28, 2018
@askeksa-google
Copy link
Author

Foo.bar is a named constructor. Named constructors do not take type arguments, but one is supplied here. The correct syntax for supplying a type argument to the class during instantiation would be Foo<int>.bar().

The VM does not report an error because it generally is missing an error for supplying type arguments where they are not expected: #32972

@bwilkerson
Copy link
Member

Ah, of course! Too subtle for me after a day of triaging issues. Thanks!

@bwilkerson bwilkerson added this to the Dart2.1 milestone Aug 29, 2018
@scheglov scheglov self-assigned this Sep 6, 2018
@scheglov
Copy link
Contributor

scheglov commented Sep 6, 2018

dart-bot pushed a commit that referenced this issue Sep 6, 2018
… name with implicit new.

Bug: #34270
Change-Id: I38e919847f25d204c26ec74d04fa49cc46063434
Reviewed-on: https://dart-review.googlesource.com/73600
Reviewed-by: Brian Wilkerson <[email protected]>
@scheglov scheglov closed this as completed Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants