sdk icon indicating copy to clipboard operation
sdk copied to clipboard

CFE fails to report error when `super` is used in a redirecting constructor.

Open kallentu opened this issue 7 months ago • 2 comments

While looking at this co19 test, I noticed that the CFE doesn't report an error for this code:

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

class C extends A {
  C(super._);
  C.r(super._) : this(0);
//    ^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
  print(C);
}

The analyzer produces an error for this, but I think the CFE is missing a SuperParameterInitializerOutsideConstructor error message for this case. It produces one for factories, but not for redirecting constructors.

Testing on Dart 3.4.3 stable.

cc. @johnniwinther @chloestefantsova

kallentu avatar Jun 26 '24 21:06 kallentu