Skip to content

[analyzer] not show error when List generics type implicit promotion #51442

Closed
@CoderBuck

Description

@CoderBuck

code:

class A {}
class A1 extends A {}
class A2 extends A {}

void main() {
  List<A> list = <A>[];
  list = <A1>[];  //   list type is changed to List<A1> 
  list.add(A2());
}

when run
image

> dart --version
Dart SDK version: 2.18.2 (stable) (Tue Sep 27 13:24:11 2022 +0200) on "macos_x64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-as-intendedClosed as the reported issue is expected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions