| Index: pkg/analysis_server/test/services/refactoring/extract_local_test.dart
|
| diff --git a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
|
| index 5bea780f8164b456df16bb059d5b1b90fc01d98a..cac1c16fa75897c3aefd6381b3ab07b4a2172c6e 100644
|
| --- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
|
| +++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
|
| @@ -36,9 +36,8 @@ main() {
|
| _createRefactoringForString('1 + 2');
|
| // conflicting name
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(status, RefactoringProblemSeverity.WARNING,
|
| - expectedMessage:
|
| - "A variable with name 'res' is already defined in the visible scope.");
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
|
| + expectedMessage: "The name 'res' is already used in the scope.");
|
| }
|
|
|
| test_checkFinalConditions_sameVariable_before() async {
|
| @@ -51,9 +50,8 @@ main() {
|
| _createRefactoringForString('1 + 2');
|
| // conflicting name
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(status, RefactoringProblemSeverity.WARNING,
|
| - expectedMessage:
|
| - "A variable with name 'res' is already defined in the visible scope.");
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
|
| + expectedMessage: "The name 'res' is already used in the scope.");
|
| }
|
|
|
| test_checkInitialConditions_assignmentLeftHandSize() async {
|
| @@ -163,7 +161,7 @@ main() {
|
| expectedMessage: 'Cannot extract the void expression.');
|
| }
|
|
|
| - test_checkLocalName() {
|
| + test_checkName() {
|
| indexTestUnit('''
|
| main() {
|
| int a = 1 + 2;
|
| @@ -186,6 +184,55 @@ main() {
|
| assertRefactoringStatusOK(refactoring.checkName());
|
| }
|
|
|
| + test_checkName_conflict_withInvokedFunction() async {
|
| + indexTestUnit('''
|
| +main() {
|
| + int a = 1 + 2;
|
| + res();
|
| +}
|
| +
|
| +void res() {}
|
| +''');
|
| + _createRefactoringForString('1 + 2');
|
| + await refactoring.checkInitialConditions();
|
| + refactoring.name = 'res';
|
| + assertRefactoringStatus(
|
| + refactoring.checkName(), RefactoringProblemSeverity.ERROR,
|
| + expectedMessage: "The name 'res' is already used in the scope.");
|
| + }
|
| +
|
| + test_checkName_conflict_withOtherLocal() async {
|
| + indexTestUnit('''
|
| +main() {
|
| + var res;
|
| + int a = 1 + 2;
|
| +}
|
| +''');
|
| + _createRefactoringForString('1 + 2');
|
| + await refactoring.checkInitialConditions();
|
| + refactoring.name = 'res';
|
| + assertRefactoringStatus(
|
| + refactoring.checkName(), RefactoringProblemSeverity.ERROR,
|
| + expectedMessage: "The name 'res' is already used in the scope.");
|
| + }
|
| +
|
| + test_checkName_conflict_withTypeName() async {
|
| + indexTestUnit('''
|
| +main() {
|
| + int a = 1 + 2;
|
| + Res b = null;
|
| +}
|
| +
|
| +class Res {}
|
| +''');
|
| + _createRefactoringForString('1 + 2');
|
| + await refactoring.checkInitialConditions();
|
| + refactoring.name = 'Res';
|
| + assertRefactoringStatus(
|
| + refactoring.checkName(), RefactoringProblemSeverity.ERROR,
|
| + expectedMessage: "The name 'Res' is already used in the scope.");
|
| + }
|
| +
|
| test_completeStatementExpression() {
|
| indexTestUnit('''
|
| main(p) {
|
|
|