Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sgrekhov opened this issue Oct 19, 2023 · 0 comments
Closed
Assignees
Labels
cfe-feature-extension-types Implement extension types feature in the CFE front-end-missing-error legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@sgrekhov
Copy link
Contributor

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"

@sgrekhov sgrekhov added legacy-area-front-end Legacy: Use area-dart-model instead. front-end-missing-error cfe-feature-extension-types Implement extension types feature in the CFE labels Oct 19, 2023
@chloestefantsova chloestefantsova self-assigned this Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cfe-feature-extension-types Implement extension types feature in the CFE front-end-missing-error legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

2 participants