Skip to content

Analyzer: static warning support for extension types #53434

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
20 of 23 tasks
Tracked by #49732
srawlins opened this issue Sep 5, 2023 · 4 comments
Closed
20 of 23 tasks
Tracked by #49732

Analyzer: static warning support for extension types #53434

srawlins opened this issue Sep 5, 2023 · 4 comments
Assignees
Labels
devexp-pkg-meta Issues related to package:meta devexp-warning Issues with the analyzer's Warning codes legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@srawlins
Copy link
Member

srawlins commented Sep 5, 2023

warnings based on meta annotations:

  • @experimental, @internal, @protected, @visibleForTesting - does it work on a method declared in an extension type? does it work on a method "implemented" (exposed) via an extension type? If an extension type itself is annotated with any of these, does enforcement work when referencing the extension type? Does enforcement work when referencing/calling the primary constructor?
    • @experimental (@pq)
    • @internal (@pq)
    • @protected (@pq)
    • @visibleForTesting (@pq)
  • @factory (@pq)
  • @immutable (@pq)
  • @literal - (@pq)
  • @mustBeOverridden - should be disallowed on methods declared in extension types (and extensions if not already) (@pq)
  • @mustCallSuper - should be disallowed on methods declared in extension types (and extensions if not already) (@pq)
  • @nonVirtual - should be disallowed on methods declared in extension types (and extensions if not already) (@pq)
  • @optionalTypeArgs - can annotate a type extension (@pq 8a5ddec)
  • @reopen - cannot annotate a type extension (or an extension, if not already banned) (@pq)
  • @sealed - cannot annotate a type extension (or an extension, if not already banned) (@pq)
  • @visibleForOverriding - cannot annotate a type extension or extension type member (@pq)

other warnings:

  • DEPRECATED_MEMBER_USE - test against extension type, member declared in extension type, member "implemented" (exposed) by extension type
  • DIVISION_OPTIMIZATION - what if x or y are an extension type on int?
  • INFERENCE_FAILURE_ON_* - I think tests are needed both for expressions passed to extension type constructor, and extension typed expressions passed elsewhere
  • OVERRIDE_ON_NON_OVERRIDING_* - for anything declared in an extension type
  • RETURN_OF_INVALID_TYPE_FROM_CATCH_ERROR and RETURN_TYPE_INVALID_FOR_CATCH_ERROR - return type being an extension type on Future should be ok.
  • STRICT_RAW_TYPE - should be reported for an extension type missing type arguments. (@pq)
  • UNNECESSARY_TYPE_CHECK (@pq)
  • UNUSED_ELEMENT - [Extension Types] analyzer should produce UNUSED_ELEMENT diagnostics for unused extension type decls #53520 (@pq)
@srawlins srawlins added P1 A high priority bug; for example, a single project is unusable or has many test failures legacy-area-analyzer Use area-devexp instead. devexp-warning Issues with the analyzer's Warning codes type-enhancement A request for a change that isn't a bug labels Sep 5, 2023
@pq pq self-assigned this Sep 6, 2023
@pq
Copy link
Member

pq commented Sep 6, 2023

Happy to take a look at (some bits of) this.

Some annotation support will get ungated by #53368

@pq pq added the devexp-pkg-meta Issues related to package:meta label Sep 6, 2023
copybara-service bot pushed a commit that referenced this issue Sep 7, 2023
See: #53434

Change-Id: Ibeab460fa8cc9d7e7fa0efdb062c839659243e45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324574
Reviewed-by: Samuel Rawlins <[email protected]>
Commit-Queue: Phil Quitslund <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 7, 2023
validation/tests for application of

* `@mustCallSuper`
* `@nonVirtual`
* `@reopen`
* `@sealed`

to extension types

See: #53434

Change-Id: I005523507044e7d5879a5589c132384e7bb8be56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324768
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Phil Quitslund <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 11, 2023
See: #53434

Change-Id: I931a7cdff990ca19f6ec3267340031ca5fa7b814
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325322
Commit-Queue: Phil Quitslund <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 12, 2023
See: #53434

Change-Id: I2668b74e2037176d0ac6e6da22300be29ba14d8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325444
Commit-Queue: Phil Quitslund <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 13, 2023
See: #53434

Change-Id: I4bd62ec9c4791e9046e285c782bb6e9adfced9eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325900
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Phil Quitslund <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 13, 2023
See: #53434

Change-Id: Ie5e8398dd8c0378c3fd9a5571f3fdabdbc36a194
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325962
Commit-Queue: Phil Quitslund <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 14, 2023
See: #53434

Change-Id: I0cca5b38fc6e432a8eb5e1ab3381625203063cab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326180
Commit-Queue: Phil Quitslund <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 19, 2023
See: #53434

Change-Id: I3a94046dff920a05fd6e617c6f234c001fab6781
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326880
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Phil Quitslund <[email protected]>
copybara-service bot pushed a commit that referenced this issue Oct 19, 2023
See: #53434


Change-Id: Ifb0e87f8b2fb080555f1c5fdbd553e9a16d0a467
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331202
Commit-Queue: Phil Quitslund <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
@srawlins
Copy link
Member Author

Any updates, @pq? Is this still P1?

@pq
Copy link
Member

pq commented Feb 27, 2024

I haven't looked at the remaining open line items in a bit but my sense is they are not P1.

@srawlins srawlins added P3 A lower priority bug or feature request and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Feb 27, 2024
@srawlins
Copy link
Member Author

srawlins commented Aug 2, 2024

Closing as more-or-less complete. The remaining work is not worth tracking.

@srawlins srawlins closed this as completed Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-pkg-meta Issues related to package:meta devexp-warning Issues with the analyzer's Warning codes legacy-area-analyzer Use area-devexp instead. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants