Skip to content

[augmentations] No error in the analyser if merged constructor has multiple super initializers #59631

@sgrekhov

Description

@sgrekhov

Augmentations spec:

It is a compile-time error if:
...

  • The introductory constructor has a super initializer (super constructor invocation at the end of the initializer list) and the augmenting constructor does too. An augmentation can replace the implicit default super() with a concrete super-invocation, but cannot replace a declared super constructor.

But there's no such error in the analyzer.

class A {
  int x;
  A(this.x);
}

class C extends A {
  C() : super(0); // No expected error here
//^
// [analyzer] unspecified
// [cfe] unspecified
}

augment class C {
  augment C() : super(1);
}

Appropriate co19 test https://github.com/dart-lang/co19/blob/master/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t02.dart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.feature-augmentationsImplementation of the augmentations featuretype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions