Skip to content

"is" checks aren't considered with generic-method types #26965

Closed
@nex3

Description

@nex3

If I run the analyzer over the following code in strong mode:

void fn/*<T>*/(/*=T*/ object) {
  if (object is String) print(object.substring(1));
}

I get the error "The method 'substring' is not defined for the class 'Object'.". This seems incorrect, since I'm asserting that object is String immediately before calling substring().

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.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