Skip to content

Analyzer: static warning support for extension types #53434

Closed
Listed in
@srawlins

Description

@srawlins

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)

Activity

added
P1A high priority bug; for example, a single project is unusable or has many test failures
devexp-warningIssues with the analyzer's Warning codes
type-enhancementA request for a change that isn't a bug
on Sep 5, 2023
self-assigned this
on Sep 6, 2023
pq

pq commented on Sep 6, 2023

@pq
Member

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

Some annotation support will get ungated by #53368

srawlins

srawlins commented on Feb 27, 2024

@srawlins
MemberAuthor

Any updates, @pq? Is this still P1?

pq

pq commented on Feb 27, 2024

@pq
Member

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

added
P3A lower priority bug or feature request
and removed
P1A high priority bug; for example, a single project is unusable or has many test failures
on Feb 27, 2024
srawlins

srawlins commented on Aug 2, 2024

@srawlins
MemberAuthor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3A lower priority bug or feature requestdevexp-pkg-metaIssues related to package:metadevexp-warningIssues with the analyzer's Warning codeslegacy-area-analyzerUse area-devexp instead.type-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @pq@srawlins

      Issue actions

        Analyzer: static warning support for extension types · Issue #53434 · dart-lang/sdk