Skip to content

[cfe] No error it type parameter of extension type is used non-covariantly #53803

Closed
@sgrekhov

Description

@sgrekhov

Extension types specification was recently updated and now contains the following

A compile-time error occurs if a type variable declared by DV occurs in a non-covariant position in V1.

But there is no such error in CFE (presents in analyzer)

// SharedOptions=--enable-experiment=inline-class

class A<T> {}

// Analyzer:  'T' can't be used contravariantly or invariantly in 'A<void Function(T)>'. Try not  using class type parameters 
//                 in types of formal parameters of function types, nor in explicitly contravariant or invariant superinterfaces. 
// CFE: no expected error
extension type ET<T>(A<Never> _) implements A<void Function(T)> {}
//             ^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
  print(ET);
}

Tested on Dart SDK version: 3.3.0-edge.e285a5724831d547f03d34764c0c08de998548db (be) (Thu Oct 19 03:46:18 2023 +0000) on "linux_x64"

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions