Skip to content

No error in CFE if extension type has two incompatible superinterfaces #53172

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 Aug 10, 2023 · 1 comment
Closed
Assignees
Labels
cfe-feature-extension-types Implement extension types feature in the CFE feature-extension-types Implementation of the extension type feature front-end-missing-error legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@sgrekhov
Copy link
Contributor

The error expected below is reported by analyzer but not reported by CFE

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

extension type V1(int id) {
  int m() => 42;
}

extension type V2(int id) {
  String m() => "42";
}

extension type V(int id) implements V1, V2 {
//             ^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
  print(V);
}

Tested on the edge SDK (Aug 10, 2023) on Linux x64

@sgrekhov sgrekhov added legacy-area-front-end Legacy: Use area-dart-model instead. front-end-missing-error labels Aug 10, 2023
@eernstg
Copy link
Member

eernstg commented Aug 10, 2023

It's perhaps worth noting that even compatible superinterfaces won't do: There is an error as soon as an extension type member name has more than one implementation in superinterfaces and no redeclaration in the most specific extension type, also when they have exactly the same signature.

extension type V1(int id) {
  int m() => 42;
}

extension type V2(int id) {
  int m() => 42;
}

extension type V(int id) implements V1, V2 {
//             ^
// [analyzer] unspecified
// [cfe] unspecified
}

But there is no conflict if it is the same declaration:

extension type V0(int id) {
  int m() => 42;
}

extension type V1(int id) implements V0 {}
extension type V2(int id) implements V0 {}

extension type V(int id) implements V1, V2 {} // OK.

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 feature-extension-types Implementation of the extension type feature front-end-missing-error legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

4 participants