Skip to content

co19/LanguageFeatures/Extension-types/superinterfaces_of_extension_type_A05_t08 #2354

Closed
@scheglov

Description

@scheglov
/// Hence, we use a different word to describe the relationship between a member
/// named m of a superinterface, and a member named m which is declared by the
/// subinterface: We say that the latter redeclares the former.
///
/// In particular, if two different declarations of m are inherited from two
/// superinterfaces then the subinterface can resolve the conflict by
/// redeclaring m.
///
/// There is no notion of having a 'correct override relation' here. With
/// extension types, any member signature can redeclare any other member
/// signature with the same name, including the case where a method is
/// redeclared by a getter, or vice versa.
///
/// @description Checks that it is a compile-time error if an extension type
/// declaration `DV` declares a member that conflicts with an inherited one

<cut>

extension type V(int id) {
  external int id2;
}

extension type ET(int id) implements V {
  int id2() => id;
//    ^^^
// [analyzer] unspecified
// [cfe] unspecified
}

Why is this a compile-time error? The quote from the specification says that we can redeclare any member, using any signature, no conflicts (at least for a single superinterface).

Metadata

Metadata

Assignees

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