-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
cfe-dysfunctionalitiesIssues for the CFE not behaving as intendedIssues for the CFE not behaving as intendedlegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
According to the extension methods specification
It is a compile-time error if the static type of the argument expression (expr) of an explicit extension invocation is void. (Expressions of type void are only allowed in a few specific syntactic positions, and the new explicit extension invocation object position is not included in those.)
But the following code produces an error in the analyzer but no any issues in CFE
extension ExtVoid on void {
void checkme() {
print("I'm extension");
}
}
main() {
ExtVoid(print("print() returns void")).checkme(); // Analyzer error. use_of_void_result
}When run this program prints I'm extension. But there should be a compile-time error.
Dart SDK version: 3.7.0-123.0.dev (dev) (Fri Nov 8 08:06:44 2024 -0800) on "windows_x64"
Metadata
Metadata
Assignees
Labels
cfe-dysfunctionalitiesIssues for the CFE not behaving as intendedIssues for the CFE not behaving as intendedlegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)