Skip to content

Analyzer const cast fails for Never?. #54820

Open
@lrhn

Description

@lrhn

Example:

  const v = null as Never?;

The analyzer reports a compile-time error for this:

line 3 • Evaluation of this constant expression throws an exception.

Doesn't say which exception, and it shouldn't since null is a valid value of any nullable type.
(Doesn't check type for nullability?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onanalyzer-constantsarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions