Skip to content

Extend strong mode "impossible cast" warnings to explicit casts #29547

@leafpetersen

Description

@leafpetersen

Strong mode issues an error if a literal or an instance creation expression is implicitly cast to an incompatible type, since such a cast cannot possibly succeed in strong mode. We should consider issuing the same error on explicit casts .

void test() {
  int x = (true as int); // Make this an error
}

cc @Hixie @lrhn @floitschG @eernstg @munificent

Metadata

Metadata

Assignees

Labels

area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).language-strong-mode-polish

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions