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

[analyzer] Implement constructor tearoffs support in the analyzer #46233

Closed
eernstg opened this issue Jun 3, 2021 · 2 comments
Closed

[analyzer] Implement constructor tearoffs support in the analyzer #46233

eernstg opened this issue Jun 3, 2021 · 2 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on

Comments

@eernstg
Copy link
Member

eernstg commented Jun 3, 2021

This issue tracks support of the constructor tearoffs feature. See the enclosing meta-issue for details.

The implementation issues for this feature are needed in order to have a reference when approving test failures. Further information will be added here when the implementation work starts.

@eernstg eernstg added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Jun 3, 2021
@devoncarew devoncarew added the P2 A bug or feature request we're likely to work on label Jun 3, 2021
@franklinyow franklinyow added this to To do in Constructor tear-offs via automation Jun 3, 2021
@srawlins srawlins self-assigned this Jun 15, 2021
dart-bot pushed a commit that referenced this issue Jun 22, 2021
This feature is also known as "explicit function tear-off type
instantiations."

This first change adds the merest support for function references, only
those with explicit type arguments.

This change also bumps all PubPackageResolutionTest tests to opt-in to
constructor tear-offs.

We support:

* top-level functions, static and instance methods, local functions and
  local variables
* prefixed top-level functions

We error on:
* Wrong number of type arguments
* unknown identifier

Not included:
* static methods with explicit receiver
* prefixed static methods
* extension methods
* erroring on the validity of each type argument
* anything to do with implicit type arguments
* anything to do with constructor tear-offs
* anything to do with type literals

#46233

Change-Id: I8437f494f1c3d98cef667f675bb18e79a91c78c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203801
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
dart-bot pushed a commit that referenced this issue Jun 22, 2021
Bug: #46233
Change-Id: Id83a1fbbb058ed04c4433a380ed08799b047c11e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
dart-bot pushed a commit that referenced this issue Jul 2, 2021
* type literals with explicit type instantiation
* the above feature, referring to a type alias
* the two above features, with prefixed elements
* reworked guards and TODOs for forthcoming constructor tearoffs.

Bug: #46233
Change-Id: I9c0b7ef16da0a105c4841e11e014ee2a21933d4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
dart-bot pushed a commit that referenced this issue Jul 6, 2021
* static method access with an explicit receiver
* the above, with a type alias of the receiver
* the two above, with a prefixed import
* many test cases for unsupported things

Bug: #46233
Change-Id: I982bc741aa8f57959d342b640921096170e94f0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205881
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
dart-bot pushed a commit that referenced this issue Jul 18, 2021
…aroffs.

When an expression which is not a type, not a constructor, and not an
identifier for a function, is torn off with type arguments, report
DISALLOWED_TYPE_INSTANTIATION_EXPRESSION.

When a function expression (without a name) is explicitly torn off with
the wrong number of type arguments, report
WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION. This separate error
code has text which does not have a slot for a function's name.

Add resolution for implicit receiver super-type instance method tearoff.

Bug: #46233
Change-Id: I3243e1824e191b6b703b1c995af5e1bd8a242915
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207140
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
dart-bot pushed a commit that referenced this issue Jul 20, 2021
This change is mostly just extracting out some code into helpers; the
`resolve` method was getting extremely long. The block of code
extracted into each helper is largely unchanged.

Bug: #46233
Change-Id: I057dc31339e6a4d9deee18c881123e488f593ac9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207440
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
dart-bot pushed a commit that referenced this issue Jul 26, 2021
Only the following short list of elements are allowed to be type-
instantiated: top-level function, local function, instance method,
constructor, type.

Bug: #46233 and
Change-Id: I37e2a793b7fb25ef670152490e73b227b7c0cdac
#46590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207643
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
@eernstg
Copy link
Member Author

eernstg commented Jul 29, 2021

Closing: This issue is a duplicate of #46020.

@eernstg eernstg closed this as completed Jul 29, 2021
Constructor tear-offs automation moved this from To do to Done Jul 29, 2021
@eernstg
Copy link
Member Author

eernstg commented Jul 29, 2021

@srawlins, FYI: This issue turns out to be a duplicate of #46020. I've closed this one and changed the link on the main tracking issue for this feature (#46228) such that we will only use #46020.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on
Projects
Development

No branches or pull requests

3 participants