sdk
sdk copied to clipboard
Missing Super-as-Expression Error in VSCode
Dart SDK version: 3.9.0-211.0.dev (dev) (Fri Jun 6 17:03:13 2025 -0700) on "macos_x64"VSCode Version: 1.100.3 (Universal)
Consider the main.dart
final class A
{ A f()=>
this;
}
final class B extends A
{ A f()=>
(super..f())..g();
B g()=>
this;
}
dart run outputs
main.dart:7:4: Error: Can't use 'super' as an expression.
To delegate a constructor to a super constructor, put the super call as an initializer.
(super..f())..g();
Static analysis should catch this while coding in VSCode but it doesn't. Nothing is reported via VSCode.
This should be disallowed very early as not valid syntax.
The syntactic form super is not an expression, and it cannot occur as the target of a cascade.