-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Open
Copy link
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-refactoringIssues with analysis server refactoringsIssues with analysis server refactoringstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Currently, we allow extracting an expression when it's in a constant context, but that creates code that doesn't run (since we don't support constant functions).
For example:
enum E {
v;
void foo() {
const e = E.v; // We extract E.v into a method using the extract method refactor
}
}
Applies the refactoring to produce:
enum E {
v;
void foo() {
const e = res(); // ERROR
}
E res() => E.v;
}
We should disallow the refactoring if we find that the expression is in a const context.
FMorschel
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-refactoringIssues with analysis server refactoringsIssues with analysis server refactoringstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)