| Index: pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
|
| diff --git a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
|
| similarity index 65%
|
| copy from pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
|
| copy to pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
|
| index 8d176b8ebd9580d11c3202c78ad4761d41b2fcd0..64773f481daa639f073ff606a5f59eca05954c53 100644
|
| --- a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
|
| +++ b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
|
| @@ -1,14 +1,16 @@
|
| -// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library test.services.completion.contributor.dart.type_member;
|
| +library test.services.completion.contributor.dart.constructor;
|
|
|
| -import 'dart:async';
|
| -
|
| -import 'package:analysis_server/plugin/protocol/protocol.dart';
|
| +import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
|
| + show Element, ElementKind;
|
| +import 'package:analysis_server/plugin/protocol/protocol.dart'
|
| + hide Element, ElementKind;
|
| +import 'package:analysis_server/src/protocol_server.dart';
|
| import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
|
| -import 'package:analysis_server/src/services/completion/dart/type_member_contributor.dart';
|
| +import 'package:analysis_server/src/services/completion/dart/local_constructor_contributor.dart';
|
| import 'package:test_reflective_loader/test_reflective_loader.dart';
|
| import 'package:unittest/unittest.dart';
|
|
|
| @@ -17,607 +19,373 @@ import 'completion_contributor_util.dart';
|
|
|
| main() {
|
| initializeTestEnvironment();
|
| - defineReflectiveTests(TypeMemberContributorTest);
|
| + defineReflectiveTests(LocalConstructorContributorTest);
|
| }
|
|
|
| @reflectiveTest
|
| -class TypeMemberContributorTest extends DartCompletionContributorTest {
|
| - /**
|
| - * Check whether a declaration of the form [shadower] in a derived class
|
| - * shadows a declaration of the form [shadowee] in a base class, for the
|
| - * purposes of what is shown during completion. [shouldBeShadowed] indicates
|
| - * whether shadowing is expected.
|
| - */
|
| - Future check_shadowing(
|
| - String shadower, String shadowee, bool shouldBeShadowed) async {
|
| - addTestSource('''
|
| -class Base {
|
| - $shadowee
|
| -}
|
| -class Derived extends Base {
|
| - $shadower
|
| -}
|
| -void f(Derived d) {
|
| - d.^
|
| -}
|
| -''');
|
| - await computeSuggestions();
|
| - List<CompletionSuggestion> suggestionsForX = suggestions
|
| - .where((CompletionSuggestion s) => s.completion == 'x')
|
| - .toList();
|
| - expect(suggestionsForX, hasLength(1));
|
| - if (shouldBeShadowed) {
|
| - expect(suggestionsForX[0].declaringType, 'Derived');
|
| - } else {
|
| - expect(suggestionsForX[0].declaringType, 'Base');
|
| - }
|
| - }
|
| -
|
| - fail_test_PrefixedIdentifier_trailingStmt_const_untyped() async {
|
| - // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| - addTestSource('const g = "hello"; f() {g.^ int y = 0;}');
|
| - await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +class LocalConstructorContributorTest extends DartCompletionContributorTest {
|
| + CompletionSuggestion assertSuggestLocalVariable(
|
| + String name, String returnType,
|
| + {int relevance: DART_RELEVANCE_LOCAL_VARIABLE}) {
|
| + // Local variables should only be suggested by LocalReferenceContributor
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| + csKind: CompletionSuggestionKind.INVOCATION, relevance: relevance);
|
| + expect(cs.returnType, returnType != null ? returnType : 'dynamic');
|
| + protocol.Element element = cs.element;
|
| + expect(element, isNotNull);
|
| + expect(element.kind, equals(protocol.ElementKind.LOCAL_VARIABLE));
|
| + expect(element.name, equals(name));
|
| + expect(element.parameters, isNull);
|
| + expect(element.returnType, returnType != null ? returnType : 'dynamic');
|
| + assertHasNoParameterInfo(cs);
|
| + return cs;
|
| + }
|
| +
|
| + CompletionSuggestion assertSuggestParameter(String name, String returnType,
|
| + {int relevance: DART_RELEVANCE_PARAMETER}) {
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| + csKind: CompletionSuggestionKind.INVOCATION, relevance: relevance);
|
| + expect(cs.returnType, returnType != null ? returnType : 'dynamic');
|
| + protocol.Element element = cs.element;
|
| + expect(element, isNotNull);
|
| + expect(element.kind, equals(protocol.ElementKind.PARAMETER));
|
| + expect(element.name, equals(name));
|
| + expect(element.parameters, isNull);
|
| + expect(element.returnType,
|
| + equals(returnType != null ? returnType : 'dynamic'));
|
| + return cs;
|
| }
|
|
|
| @override
|
| DartCompletionContributor createContributor() {
|
| - return new TypeMemberContributor();
|
| + return new LocalConstructorContributor();
|
| }
|
|
|
| - test_enumConst() async {
|
| - addTestSource('enum E { one, two } main() {E.^}');
|
| + test_constructor_parameters_mixed_required_and_named() async {
|
| + addTestSource('class A {A(x, {int y}) {^}}');
|
| await computeSuggestions();
|
| - assertNotSuggested('E');
|
| - // Suggested by StaticMemberContributor
|
| - assertNotSuggested('one');
|
| - assertNotSuggested('two');
|
| - assertNotSuggested('index');
|
| - assertNotSuggested('values');
|
| + assertNotSuggested('x');
|
| + assertNotSuggested('y');
|
| }
|
|
|
| - test_enumConst2() async {
|
| - addTestSource('enum E { one, two } main() {E.o^}');
|
| + test_constructor_parameters_mixed_required_and_positional() async {
|
| + addTestSource('class A {A(x, [int y]) {^}}');
|
| await computeSuggestions();
|
| - assertNotSuggested('E');
|
| - // Suggested by StaticMemberContributor
|
| - assertNotSuggested('one');
|
| - assertNotSuggested('two');
|
| - assertNotSuggested('index');
|
| - assertNotSuggested('values');
|
| + assertNotSuggested('x');
|
| + assertNotSuggested('y');
|
| }
|
|
|
| - test_enumConst3() async {
|
| - addTestSource('enum E { one, two } main() {E.^ int g;}');
|
| + test_constructor_parameters_named() async {
|
| + addTestSource('class A {A({x, int y}) {^}}');
|
| await computeSuggestions();
|
| - assertNotSuggested('E');
|
| - // Suggested by StaticMemberContributor
|
| - assertNotSuggested('one');
|
| - assertNotSuggested('two');
|
| - assertNotSuggested('index');
|
| - assertNotSuggested('values');
|
| + assertNotSuggested('x');
|
| + assertNotSuggested('y');
|
| }
|
|
|
| - test_enumConst_index() async {
|
| - addTestSource('enum E { one, two } main() {E.one.^}');
|
| + test_constructor_parameters_positional() async {
|
| + addTestSource('class A {A([x, int y]) {^}}');
|
| await computeSuggestions();
|
| - assertNotSuggested('E');
|
| - assertNotSuggested('one');
|
| - assertNotSuggested('two');
|
| - assertSuggestField('index', 'int');
|
| - assertNotSuggested('values');
|
| + assertNotSuggested('x');
|
| + assertNotSuggested('y');
|
| }
|
|
|
| - test_enumConst_index2() async {
|
| - addTestSource('enum E { one, two } main() {E.one.i^}');
|
| + test_constructor_parameters_required() async {
|
| + addTestSource('class A {A(x, int y) {^}}');
|
| + await computeSuggestions();
|
| + assertNotSuggested('x');
|
| + assertNotSuggested('y');
|
| + }
|
| +
|
| + test_enum() async {
|
| + addTestSource('enum E { one, two } main() {^}');
|
| await computeSuggestions();
|
| assertNotSuggested('E');
|
| assertNotSuggested('one');
|
| assertNotSuggested('two');
|
| - assertSuggestField('index', 'int');
|
| - assertNotSuggested('values');
|
| }
|
|
|
| - test_enumConst_index3() async {
|
| - addTestSource('enum E { one, two } main() {E.one.^ int g;}');
|
| + test_enum_deprecated() async {
|
| + addTestSource('@deprecated enum E { one, two } main() {^}');
|
| await computeSuggestions();
|
| assertNotSuggested('E');
|
| assertNotSuggested('one');
|
| assertNotSuggested('two');
|
| - assertSuggestField('index', 'int');
|
| - assertNotSuggested('values');
|
| }
|
|
|
| - test_generic_field() async {
|
| + test_function_parameters_mixed_required_and_named() async {
|
| addTestSource('''
|
| -class C<T> {
|
| - T t;
|
| -}
|
| -void f(C<int> c) {
|
| - c.^
|
| +void m(x, {int y}) {}
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| ''');
|
| await computeSuggestions();
|
| - assertSuggestField('t', 'int');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_generic_getter() async {
|
| + test_function_parameters_mixed_required_and_positional() async {
|
| addTestSource('''
|
| -class C<T> {
|
| - T get t => null;
|
| -}
|
| -void f(C<int> c) {
|
| - c.^
|
| +void m(x, [int y]) {}
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| ''');
|
| await computeSuggestions();
|
| - assertSuggestGetter('t', 'int');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_generic_method() async {
|
| + test_function_parameters_named() async {
|
| addTestSource('''
|
| -class C<T> {
|
| - T m(T t) {}
|
| -}
|
| -void f(C<int> c) {
|
| - c.^
|
| +void m({x, int y}) {}
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| ''');
|
| await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'int');
|
| - expect(suggestion.parameterTypes[0], 'int');
|
| - expect(suggestion.element.returnType, 'int');
|
| - expect(suggestion.element.parameters, '(int t)');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_generic_setter() async {
|
| + test_function_parameters_none() async {
|
| addTestSource('''
|
| -class C<T> {
|
| - set t(T value) {}
|
| -}
|
| -void f(C<int> c) {
|
| - c.^
|
| +void m() {}
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| ''');
|
| await computeSuggestions();
|
| - // TODO(paulberry): modify assertSuggestSetter so that we can pass 'int'
|
| - // as a parmeter to it, and it will check the appropriate field in
|
| - // the suggestion object.
|
| - CompletionSuggestion suggestion = assertSuggestSetter('t');
|
| - expect(suggestion.element.parameters, '(int value)');
|
| - }
|
| -
|
| - test_keyword() async {
|
| - addTestSource('class C { static C get instance => null; } main() {C.in^}');
|
| - await computeSuggestions();
|
| - // Suggested by StaticMemberContributor
|
| - assertNotSuggested('instance');
|
| - }
|
| -
|
| - test_libraryPrefix() async {
|
| - // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| - addTestSource('import "dart:async" as bar; foo() {bar.^}');
|
| - await computeSuggestions();
|
| - // Suggested by LibraryMemberContributor
|
| - assertNotSuggested('Future');
|
| - assertNotSuggested('loadLibrary');
|
| - }
|
| -
|
| - test_libraryPrefix2() async {
|
| - // SimpleIdentifier MethodInvocation ExpressionStatement
|
| - addTestSource('import "dart:async" as bar; foo() {bar.^ print("f")}');
|
| - await computeSuggestions();
|
| - // Suggested by LibraryMemberContributor
|
| - assertNotSuggested('Future');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_libraryPrefix3() async {
|
| - // SimpleIdentifier MethodInvocation ExpressionStatement
|
| - addTestSource('import "dart:async" as bar; foo() {new bar.F^ print("f")}');
|
| + test_function_parameters_positional() async {
|
| + addTestSource('''
|
| +void m([x, int y]) {}
|
| +class B extends A {
|
| + main() {^}
|
| +}
|
| +''');
|
| await computeSuggestions();
|
| - // Suggested by LibraryMemberContributor
|
| - assertNotSuggested('Future');
|
| - assertNotSuggested('Future.delayed');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_libraryPrefix_deferred() async {
|
| - // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| - addTestSource('import "dart:async" deferred as bar; foo() {bar.^}');
|
| + test_function_parameters_required() async {
|
| + addTestSource('''
|
| +void m(x, int y) {}
|
| +class B extends A {
|
| + main() {^}
|
| +}
|
| +''');
|
| await computeSuggestions();
|
| - // Suggested by LibraryMemberContributor
|
| - assertNotSuggested('Future');
|
| - assertNotSuggested('loadLibrary');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_libraryPrefix_with_exports() async {
|
| - addSource('/libA.dart', 'library libA; class A { }');
|
| - addSource('/libB.dart', 'library libB; export "/libA.dart"; class B { }');
|
| - addTestSource('import "/libB.dart" as foo; main() {foo.^} class C { }');
|
| + test_ignore_symbol_being_completed() async {
|
| + addTestSource('class MyClass { } main(MC^) { }');
|
| await computeSuggestions();
|
| - // Suggested by LibraryMemberContributor
|
| - assertNotSuggested('B');
|
| - assertNotSuggested('A');
|
| + assertNotSuggested('MyClass');
|
| + assertNotSuggested('MC');
|
| }
|
|
|
| - test_local() async {
|
| - addTestSource('foo() {String x = "bar"; x.^}');
|
| + test_inDartDoc_reference1() async {
|
| + addTestSource('''
|
| +/// The [^
|
| +main(aaa, bbb) {}''');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| + assertNotSuggested('main');
|
| }
|
|
|
| - test_local_is() async {
|
| - addTestSource('foo() {var x; if (x is String) x.^}');
|
| + test_inDartDoc_reference2() async {
|
| + addTestSource('''
|
| +/// The [m^
|
| +main(aaa, bbb) {}''');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| + assertNotSuggested('main');
|
| }
|
|
|
| - test_local_propogatedType() async {
|
| - addTestSource('foo() {var x = "bar"; x.^}');
|
| + test_inDartDoc_reference3() async {
|
| + addTestSource('''
|
| +/// The [^]
|
| +main(aaa, bbb) {}''');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| + assertNotSuggested('main');
|
| }
|
|
|
| - test_method_parameters_mixed_required_and_named() async {
|
| + test_inDartDoc_reference4() async {
|
| addTestSource('''
|
| -class C {
|
| - void m(x, {int y}) {}
|
| -}
|
| -void main() {new C().^}''');
|
| +/// The [m^]
|
| +main(aaa, bbb) {}''');
|
| await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'void');
|
| - expect(suggestion.parameterNames, hasLength(2));
|
| - expect(suggestion.parameterNames[0], 'x');
|
| - expect(suggestion.parameterTypes[0], 'dynamic');
|
| - expect(suggestion.parameterNames[1], 'y');
|
| - expect(suggestion.parameterTypes[1], 'int');
|
| - expect(suggestion.requiredParameterCount, 1);
|
| - expect(suggestion.hasNamedParameters, true);
|
| + assertNotSuggested('main');
|
| }
|
|
|
| - test_method_parameters_mixed_required_and_positional() async {
|
| + test_InstanceCreationExpression() async {
|
| addTestSource('''
|
| -class C {
|
| - void m(x, [int y]) {}
|
| -}
|
| -void main() {new C().^}''');
|
| +class A {foo(){var f; {var x;}}}
|
| +class B {B(this.x, [String boo]) { } int x;}
|
| +class C {C.bar({boo: 'hoo', int z: 0}) { } }
|
| +main() {new ^ String x = "hello";}''');
|
| await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'void');
|
| + CompletionSuggestion suggestion;
|
| +
|
| + suggestion = assertSuggestConstructor('A', elemOffset: -1);
|
| + expect(suggestion.element.parameters, '()');
|
| + expect(suggestion.element.returnType, 'A');
|
| + expect(suggestion.declaringType, 'A');
|
| + expect(suggestion.parameterNames, hasLength(0));
|
| + expect(suggestion.requiredParameterCount, 0);
|
| + expect(suggestion.hasNamedParameters, false);
|
| +
|
| + suggestion = assertSuggestConstructor('B');
|
| + expect(suggestion.element.parameters, '(int x, [String boo])');
|
| + expect(suggestion.element.returnType, 'B');
|
| + expect(suggestion.declaringType, 'B');
|
| expect(suggestion.parameterNames, hasLength(2));
|
| expect(suggestion.parameterNames[0], 'x');
|
| - expect(suggestion.parameterTypes[0], 'dynamic');
|
| - expect(suggestion.parameterNames[1], 'y');
|
| - expect(suggestion.parameterTypes[1], 'int');
|
| + expect(suggestion.parameterTypes[0], 'int');
|
| + expect(suggestion.parameterNames[1], 'boo');
|
| + expect(suggestion.parameterTypes[1], 'String');
|
| expect(suggestion.requiredParameterCount, 1);
|
| expect(suggestion.hasNamedParameters, false);
|
| - }
|
|
|
| - test_method_parameters_named() async {
|
| - addTestSource('''
|
| -class C {
|
| - void m({x, int y}) {}
|
| -}
|
| -void main() {new C().^}''');
|
| - await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'void');
|
| + suggestion = assertSuggestConstructor('C.bar');
|
| + expect(suggestion.element.parameters, '({dynamic boo: \'hoo\', int z: 0})');
|
| + expect(suggestion.element.returnType, 'C');
|
| + expect(suggestion.declaringType, 'C');
|
| expect(suggestion.parameterNames, hasLength(2));
|
| - expect(suggestion.parameterNames[0], 'x');
|
| + expect(suggestion.parameterNames[0], 'boo');
|
| expect(suggestion.parameterTypes[0], 'dynamic');
|
| - expect(suggestion.parameterNames[1], 'y');
|
| + expect(suggestion.parameterNames[1], 'z');
|
| expect(suggestion.parameterTypes[1], 'int');
|
| expect(suggestion.requiredParameterCount, 0);
|
| expect(suggestion.hasNamedParameters, true);
|
| }
|
|
|
| - test_method_parameters_none() async {
|
| + test_method_parameters_mixed_required_and_named() async {
|
| addTestSource('''
|
| -class C {
|
| - void m() {}
|
| +class A {
|
| + void m(x, {int y}) {}
|
| }
|
| -void main() {new C().^}''');
|
| - await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'void');
|
| - expect(suggestion.parameterNames, isEmpty);
|
| - expect(suggestion.parameterTypes, isEmpty);
|
| - expect(suggestion.requiredParameterCount, 0);
|
| - expect(suggestion.hasNamedParameters, false);
|
| - }
|
| -
|
| - test_method_parameters_positional() async {
|
| - addTestSource('''
|
| -class C {
|
| - void m([x, int y]) {}
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| -void main() {new C().^}''');
|
| +''');
|
| await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'void');
|
| - expect(suggestion.parameterNames, hasLength(2));
|
| - expect(suggestion.parameterNames[0], 'x');
|
| - expect(suggestion.parameterTypes[0], 'dynamic');
|
| - expect(suggestion.parameterNames[1], 'y');
|
| - expect(suggestion.parameterTypes[1], 'int');
|
| - expect(suggestion.requiredParameterCount, 0);
|
| - expect(suggestion.hasNamedParameters, false);
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_method_parameters_required() async {
|
| + test_method_parameters_mixed_required_and_positional() async {
|
| addTestSource('''
|
| -class C {
|
| - void m(x, int y) {}
|
| +class A {
|
| + void m(x, [int y]) {}
|
| }
|
| -void main() {new C().^}''');
|
| - await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestMethod('m', 'C', 'void');
|
| - expect(suggestion.parameterNames, hasLength(2));
|
| - expect(suggestion.parameterNames[0], 'x');
|
| - expect(suggestion.parameterTypes[0], 'dynamic');
|
| - expect(suggestion.parameterNames[1], 'y');
|
| - expect(suggestion.parameterTypes[1], 'int');
|
| - expect(suggestion.requiredParameterCount, 2);
|
| - expect(suggestion.hasNamedParameters, false);
|
| - }
|
| -
|
| - test_no_parameters_field() async {
|
| - addTestSource('''
|
| -class C {
|
| - int x;
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| -void main() {new C().^}''');
|
| +''');
|
| await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestField('x', 'int');
|
| - assertHasNoParameterInfo(suggestion);
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_no_parameters_getter() async {
|
| + test_method_parameters_named() async {
|
| addTestSource('''
|
| -class C {
|
| - int get x => null;
|
| +class A {
|
| + void m({x, int y}) {}
|
| }
|
| -void main() {int y = new C().^}''');
|
| - await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestGetter('x', 'int');
|
| - assertHasNoParameterInfo(suggestion);
|
| - }
|
| -
|
| - test_no_parameters_setter() async {
|
| - addTestSource('''
|
| -class C {
|
| - set x(int value) {};
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| -void main() {int y = new C().^}''');
|
| +''');
|
| await computeSuggestions();
|
| - CompletionSuggestion suggestion = assertSuggestSetter('x');
|
| - assertHasNoParameterInfo(suggestion);
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_only_instance() async {
|
| - // SimpleIdentifier PropertyAccess ExpressionStatement
|
| + test_method_parameters_none() async {
|
| addTestSource('''
|
| -class C {
|
| - int f1;
|
| - static int f2;
|
| - m1() {}
|
| - static m2() {}
|
| +class A {
|
| + void m() {}
|
| +}
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| -void main() {new C().^}''');
|
| +''');
|
| await computeSuggestions();
|
| - assertSuggestField('f1', 'int');
|
| - assertNotSuggested('f2');
|
| - assertSuggestMethod('m1', 'C', null);
|
| - assertNotSuggested('m2');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_only_instance2() async {
|
| - // SimpleIdentifier MethodInvocation ExpressionStatement
|
| + test_method_parameters_positional() async {
|
| addTestSource('''
|
| -class C {
|
| - int f1;
|
| - static int f2;
|
| - m1() {}
|
| - static m2() {}
|
| +class A {
|
| + void m([x, int y]) {}
|
| }
|
| -void main() {new C().^ print("something");}''');
|
| +class B extends A {
|
| + main() {^}
|
| +}
|
| +''');
|
| await computeSuggestions();
|
| - assertSuggestField('f1', 'int');
|
| - assertNotSuggested('f2');
|
| - assertSuggestMethod('m1', 'C', null);
|
| - assertNotSuggested('m2');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_only_static() async {
|
| - // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| + test_method_parameters_required() async {
|
| addTestSource('''
|
| -class C {
|
| - int f1;
|
| - static int f2;
|
| - m1() {}
|
| - static m2() {}
|
| +class A {
|
| + void m(x, int y) {}
|
| +}
|
| +class B extends A {
|
| + main() {^}
|
| }
|
| -void main() {C.^}''');
|
| +''');
|
| await computeSuggestions();
|
| - assertNotSuggested('f1');
|
| - // Suggested by StaticMemberContributor
|
| - assertNotSuggested('f2');
|
| - assertNotSuggested('m1');
|
| - assertNotSuggested('m2');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_only_static2() async {
|
| - // SimpleIdentifier MethodInvocation ExpressionStatement
|
| - addTestSource('''
|
| -class C {
|
| - int f1;
|
| - static int f2;
|
| - m1() {}
|
| - static m2() {}
|
| -}
|
| -void main() {C.^ print("something");}''');
|
| + test_missing_params_constructor() async {
|
| + addTestSource('class C1{C1{} main(){C^}}');
|
| await computeSuggestions();
|
| - assertNotSuggested('f1');
|
| - // Suggested by StaticMemberContributor
|
| - assertNotSuggested('f2');
|
| - assertNotSuggested('m1');
|
| - assertNotSuggested('m2');
|
| }
|
|
|
| - test_param() async {
|
| - addTestSource('foo(String x) {x.^}');
|
| + test_missing_params_function() async {
|
| + addTestSource('int f1{} main(){f^}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| }
|
|
|
| - test_param_is() async {
|
| - addTestSource('foo(x) {if (x is String) x.^}');
|
| + test_missing_params_method() async {
|
| + addTestSource('class C1{int f1{} main(){f^}}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| }
|
|
|
| - test_shadowing_field_over_field() =>
|
| - check_shadowing('int x;', 'int x;', true);
|
| -
|
| - test_shadowing_field_over_getter() =>
|
| - check_shadowing('int x;', 'int get x => null;', true);
|
| -
|
| - test_shadowing_field_over_method() =>
|
| - check_shadowing('int x;', 'void x() {}', true);
|
| -
|
| - test_shadowing_field_over_setter() =>
|
| - check_shadowing('int x;', 'set x(int value) {}', true);
|
| -
|
| - test_shadowing_getter_over_field() =>
|
| - check_shadowing('int get x => null;', 'int x;', false);
|
| -
|
| - test_shadowing_getter_over_getter() =>
|
| - check_shadowing('int get x => null;', 'int get x => null;', true);
|
| -
|
| - test_shadowing_getter_over_method() =>
|
| - check_shadowing('int get x => null;', 'void x() {}', true);
|
| -
|
| - test_shadowing_getter_over_setter() =>
|
| - check_shadowing('int get x => null;', 'set x(int value) {}', false);
|
| -
|
| - test_shadowing_method_over_field() =>
|
| - check_shadowing('void x() {}', 'int x;', true);
|
| -
|
| - test_shadowing_method_over_getter() =>
|
| - check_shadowing('void x() {}', 'int get x => null;', true);
|
| -
|
| - test_shadowing_method_over_method() =>
|
| - check_shadowing('void x() {}', 'void x() {}', true);
|
| -
|
| - test_shadowing_method_over_setter() =>
|
| - check_shadowing('void x() {}', 'set x(int value) {}', true);
|
| -
|
| - test_shadowing_mixin_order() async {
|
| + test_overrides() async {
|
| addTestSource('''
|
| -class Base {
|
| -}
|
| -class Mixin1 {
|
| - void f() {}
|
| -}
|
| -class Mixin2 {
|
| - void f() {}
|
| -}
|
| -class Derived extends Base with Mixin1, Mixin2 {
|
| -}
|
| -void test(Derived d) {
|
| - d.^
|
| -}
|
| +class A {m() {}}
|
| +class B extends A {m() {^}}
|
| ''');
|
| await computeSuggestions();
|
| - // Note: due to dartbug.com/22069, analyzer currently analyzes mixins in
|
| - // reverse order. The correct order is that Derived inherits from
|
| - // "Base with Mixin1, Mixin2", which inherits from "Base with Mixin1",
|
| - // which inherits from "Base". So the definition of f in Mixin2 should
|
| - // shadow the definition in Mixin1.
|
| - assertSuggestMethod('f', 'Mixin2', 'void');
|
| + assertNotSuggested('m');
|
| }
|
|
|
| - test_shadowing_mixin_over_superclass() async {
|
| - addTestSource('''
|
| -class Base {
|
| - void f() {}
|
| -}
|
| -class Mixin {
|
| - void f() {}
|
| -}
|
| -class Derived extends Base with Mixin {
|
| -}
|
| -void test(Derived d) {
|
| - d.^
|
| -}
|
| -''');
|
| + test_prioritization() async {
|
| + addTestSource('main() {var ab; var _ab; ^}');
|
| await computeSuggestions();
|
| - assertSuggestMethod('f', 'Mixin', 'void');
|
| + assertNotSuggested('ab');
|
| + assertNotSuggested('_ab');
|
| }
|
|
|
| - test_shadowing_setter_over_field() =>
|
| - check_shadowing('set x(int value) {}', 'int x;', false);
|
| -
|
| - test_shadowing_setter_over_getter() =>
|
| - check_shadowing('set x(int value) {}', 'int get x => null;', false);
|
| -
|
| - test_shadowing_setter_over_method() =>
|
| - check_shadowing('set x(int value) {}', 'void x() {}', true);
|
| -
|
| - test_shadowing_setter_over_setter() =>
|
| - check_shadowing('set x(int value) {}', 'set x(int value) {}', true);
|
| + test_prioritization_private() async {
|
| + addTestSource('main() {var ab; var _ab; _^}');
|
| + await computeSuggestions();
|
| + assertNotSuggested('ab');
|
| + assertNotSuggested('_ab');
|
| + }
|
|
|
| - test_shadowing_superclass_over_interface() async {
|
| - addTestSource('''
|
| -class Base {
|
| - void f() {}
|
| -}
|
| -class Interface {
|
| - void f() {}
|
| -}
|
| -class Derived extends Base implements Interface {
|
| -}
|
| -void test(Derived d) {
|
| - d.^
|
| -}
|
| -''');
|
| + test_prioritization_public() async {
|
| + addTestSource('main() {var ab; var _ab; a^}');
|
| await computeSuggestions();
|
| - assertSuggestMethod('f', 'Base', 'void');
|
| + assertNotSuggested('ab');
|
| + assertNotSuggested('_ab');
|
| }
|
|
|
| - test_super() async {
|
| - // SimpleIdentifier MethodInvocation ExpressionStatement
|
| - addTestSource('''
|
| -class C3 {
|
| - int fi3;
|
| - static int fs3;
|
| - m() {}
|
| - mi3() {}
|
| - static ms3() {}
|
| -}
|
| -class C2 {
|
| - int fi2;
|
| - static int fs2;
|
| - m() {}
|
| - mi2() {}
|
| - static ms2() {}
|
| -}
|
| -class C1 extends C2 implements C3 {
|
| - int fi1;
|
| - static int fs1;
|
| - m() {super.^}
|
| - mi1() {}
|
| - static ms1() {}
|
| -}''');
|
| + test_shadowed_name() async {
|
| + addTestSource('var a; class A { var a; m() { ^ } }');
|
| await computeSuggestions();
|
| - assertNotSuggested('fi1');
|
| - assertNotSuggested('fs1');
|
| - assertNotSuggested('mi1');
|
| - assertNotSuggested('ms1');
|
| - assertSuggestField('fi2', 'int');
|
| - assertNotSuggested('fs2');
|
| - assertSuggestMethod('mi2', 'C2', null);
|
| - assertNotSuggested('ms2');
|
| - assertSuggestMethod('m', 'C2', null, relevance: DART_RELEVANCE_HIGH);
|
| - assertNotSuggested('fi3');
|
| - assertNotSuggested('fs3');
|
| - assertNotSuggested('mi3');
|
| - assertNotSuggested('ms3');
|
| + assertNotSuggested('a');
|
| }
|
|
|
| test_ArgumentList() async {
|
| @@ -625,15 +393,16 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - bool hasLength(int expected) { }
|
| - void baz() { }''');
|
| +library A;
|
| +bool hasLength(int expected) { }
|
| +void baz() { }''');
|
| addTestSource('''
|
| - import '/libA.dart';
|
| - class B { }
|
| - String bar() => true;
|
| - void main() {expect(^)}''');
|
| +import '/libA.dart';
|
| +class B { }
|
| +String bar() => true;
|
| +void main() {expect(^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
|
| @@ -652,16 +421,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - bool hasLength(int expected) { }
|
| - expect(arg) { }
|
| - void baz() { }''');
|
| +library A;
|
| +bool hasLength(int expected) { }
|
| +expect(arg) { }
|
| +void baz() { }''');
|
| addTestSource('''
|
| - import '/libA.dart'
|
| - class B { }
|
| - String bar() => true;
|
| - void main() {expect(^)}''');
|
| +import '/libA.dart'
|
| +class B { }
|
| +String bar() => true;
|
| +void main() {expect(^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
|
| @@ -680,17 +450,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - class A { A(f()) { } }
|
| - bool hasLength(int expected) { }
|
| - void baz() { }''');
|
| +library A;
|
| +class A { A(f()) { } }
|
| +bool hasLength(int expected) { }
|
| +void baz() { }''');
|
| addTestSource('''
|
| - import 'dart:async';
|
| - import '/libA.dart';
|
| - class B { }
|
| - String bar() => true;
|
| - void main() {new A(^)}''');
|
| +import 'dart:async';
|
| +import '/libA.dart';
|
| +class B { }
|
| +String bar() => true;
|
| +void main() {new A(^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
|
| @@ -710,18 +481,19 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - typedef Funct();
|
| - class A { A(Funct f) { } }
|
| - bool hasLength(int expected) { }
|
| - void baz() { }''');
|
| +library A;
|
| +typedef Funct();
|
| +class A { A(Funct f) { } }
|
| +bool hasLength(int expected) { }
|
| +void baz() { }''');
|
| addTestSource('''
|
| - import 'dart:async';
|
| - import '/libA.dart';
|
| - class B { }
|
| - String bar() => true;
|
| - void main() {new A(^)}''');
|
| +import 'dart:async';
|
| +import '/libA.dart';
|
| +class B { }
|
| +String bar() => true;
|
| +void main() {new A(^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
|
| @@ -741,16 +513,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - bool hasLength(int expected) { }
|
| - void baz() { }''');
|
| +library A;
|
| +bool hasLength(int expected) { }
|
| +void baz() { }''');
|
| addTestSource('''
|
| - import '/libA.dart'
|
| - expect(arg) { }
|
| - class B { }
|
| - String bar() => true;
|
| - void main() {expect(^)}''');
|
| +import '/libA.dart'
|
| +expect(arg) { }
|
| +class B { }
|
| +String bar() => true;
|
| +void main() {expect(^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
|
| @@ -769,16 +542,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - bool hasLength(int expected) { }
|
| - void baz() { }''');
|
| +library A;
|
| +bool hasLength(int expected) { }
|
| +void baz() { }''');
|
| addTestSource('''
|
| - import '/libA.dart'
|
| - class B {
|
| - expect(arg) { }
|
| - void foo() {expect(^)}}
|
| - String bar() => true;''');
|
| +import '/libA.dart'
|
| +class B {
|
| + expect(arg) { }
|
| + void foo() {expect(^)}}
|
| +String bar() => true;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
|
| @@ -797,17 +571,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - class A { A(f()) { } }
|
| - bool hasLength(int expected) { }
|
| - void baz() { }''');
|
| +library A;
|
| +class A { A(f()) { } }
|
| +bool hasLength(int expected) { }
|
| +void baz() { }''');
|
| addTestSource('''
|
| - import 'dart:async';
|
| - import '/libA.dart';
|
| - class B { }
|
| - String bar(f()) => true;
|
| - void main() {bar(^);}''');
|
| +import 'dart:async';
|
| +import '/libA.dart';
|
| +class B { }
|
| +String bar(f()) => true;
|
| +void main() {bar(^);}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
|
| @@ -827,16 +602,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - class A { A(f()) { } }
|
| - bool hasLength(int expected) { }
|
| - void baz() { }''');
|
| +library A;
|
| +class A { A(f()) { } }
|
| +bool hasLength(int expected) { }
|
| +void baz() { }''');
|
| addTestSource('''
|
| - import 'dart:async';
|
| - import '/libA.dart';
|
| - class B { String bar(f()) => true; }
|
| - void main() {new B().bar(^);}''');
|
| +import 'dart:async';
|
| +import '/libA.dart';
|
| +class B { String bar(f()) => true; }
|
| +void main() {new B().bar(^);}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
|
| @@ -856,13 +632,14 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/libA.dart',
|
| '''
|
| - library A;
|
| - bool hasLength(int expected) { }''');
|
| +library A;
|
| +bool hasLength(int expected) { }''');
|
| addTestSource('''
|
| - import '/libA.dart'
|
| - String bar() => true;
|
| - void main() {expect(foo: ^)}''');
|
| +import '/libA.dart'
|
| +String bar() => true;
|
| +void main() {expect(foo: ^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('bar');
|
| @@ -875,6 +652,7 @@ class C1 extends C2 implements C3 {
|
| addTestSource('''
|
| class A {var b; X _c; foo() {var a; (a as ^).foo();}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('b');
|
| @@ -889,6 +667,7 @@ class C1 extends C2 implements C3 {
|
| // VariableDeclarationStatement Block
|
| addTestSource('class A {} main() {int a; int ^b = 1;}');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -897,6 +676,7 @@ class C1 extends C2 implements C3 {
|
| // VariableDeclarationStatement Block
|
| addTestSource('class A {} main() {int a; int b = ^}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -909,10 +689,12 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier TypeName VariableDeclarationList
|
| // VariableDeclarationStatement Block
|
| addTestSource('''
|
| - class A {} main() {
|
| - int a;
|
| - ^ b = 1;}''');
|
| +class A {} main() {
|
| + int a;
|
| + ^ b = 1;
|
| +}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| @@ -931,11 +713,13 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier TypeName VariableDeclarationList
|
| // VariableDeclarationStatement Block
|
| addTestSource('''
|
| - class A {} main() {
|
| - int a;
|
| - ^
|
| - b = 1;}''');
|
| +class A {} main() {
|
| + int a;
|
| + ^
|
| + b = 1;
|
| +}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| @@ -952,10 +736,12 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier TypeName VariableDeclarationList
|
| // VariableDeclarationStatement Block
|
| addTestSource('''
|
| - class A {} main() {
|
| - int a;
|
| - int^ b = 1;}''');
|
| +class A {} main() {
|
| + int a;
|
| + int^ b = 1;
|
| +}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 3);
|
| expect(replacementLength, 3);
|
| assertNotSuggested('A');
|
| @@ -974,11 +760,13 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier TypeName VariableDeclarationList
|
| // VariableDeclarationStatement Block
|
| addTestSource('''
|
| - class A {} main() {
|
| - int a;
|
| - i^
|
| - b = 1;}''');
|
| +class A {} main() {
|
| + int a;
|
| + i^
|
| + b = 1;
|
| +}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('A');
|
| @@ -994,9 +782,10 @@ class C1 extends C2 implements C3 {
|
| test_AwaitExpression() async {
|
| // SimpleIdentifier AwaitExpression ExpressionStatement
|
| addTestSource('''
|
| - class A {int x; int y() => 0;}
|
| - main() async {A a; await ^}''');
|
| +class A {int x; int y() => 0;}
|
| +main() async {A a; await ^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -1010,6 +799,7 @@ class C1 extends C2 implements C3 {
|
| // VariableDeclarationList VariableDeclarationStatement
|
| addTestSource('main() {int a = 1, b = ^ + 2;}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -1022,6 +812,7 @@ class C1 extends C2 implements C3 {
|
| // VariableDeclarationList VariableDeclarationStatement
|
| addTestSource('main() {int a = 1, b = 2 + ^;}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -1035,50 +826,50 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testAB.dart',
|
| '''
|
| - export "dart:math" hide max;
|
| - class A {int x;}
|
| - @deprecated D1() {int x;}
|
| - class _B {boo() { partBoo() {}} }''');
|
| +export "dart:math" hide max;
|
| +class A {int x;}
|
| +@deprecated D1() {int x;}
|
| +class _B {boo() { partBoo() {}} }''');
|
| addSource(
|
| '/testCD.dart',
|
| '''
|
| - String T1;
|
| - var _T2;
|
| - class C { }
|
| - class D { }''');
|
| +String T1;
|
| +var _T2;
|
| +class C { }
|
| +class D { }''');
|
| addSource(
|
| '/testEEF.dart',
|
| '''
|
| - class EE { }
|
| - class F { }''');
|
| +class EE { }
|
| +class F { }''');
|
| addSource('/testG.dart', 'class G { }');
|
| addSource(
|
| '/testH.dart',
|
| '''
|
| - class H { }
|
| - int T3;
|
| - var _T4;'''); // not imported
|
| +class H { }
|
| +int T3;
|
| +var _T4;'''); // not imported
|
| addTestSource('''
|
| - import "/testAB.dart";
|
| - import "/testCD.dart" hide D;
|
| - import "/testEEF.dart" show EE;
|
| - import "/testG.dart" as g;
|
| - int T5;
|
| - var _T6;
|
| - String get T7 => 'hello';
|
| - set T8(int value) { partT8() {} }
|
| - Z D2() {int x;}
|
| - class X {
|
| - int get clog => 8;
|
| - set blog(value) { }
|
| - a() {
|
| - var f;
|
| - localF(int arg1) { }
|
| - {var x;}
|
| - ^ var r;
|
| - }
|
| - void b() { }}
|
| - class Z { }''');
|
| +import "/testAB.dart";
|
| +import "/testCD.dart" hide D;
|
| +import "/testEEF.dart" show EE;
|
| +import "/testG.dart" as g;
|
| +int T5;
|
| +var _T6;
|
| +String get T7 => 'hello';
|
| +set T8(int value) { partT8() {} }
|
| +Z D2() {int x;}
|
| +class X {
|
| + int get clog => 8;
|
| + set blog(value) { }
|
| + a() {
|
| + var f;
|
| + localF(int arg1) { }
|
| + {var x;}
|
| + ^ var r;
|
| + }
|
| + void b() { }}
|
| +class Z { }''');
|
| await computeSuggestions();
|
|
|
| expect(replacementOffset, completionOffset);
|
| @@ -1108,13 +899,14 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('EE');
|
| // hidden element suggested as low relevance
|
| //assertNotSuggested('F');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('g');
|
| assertNotSuggested('G');
|
| //assertNotSuggested('H');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('min');
|
| assertNotSuggested('_T2');
|
| - //assertSuggestImportedTopLevelVar('T3', 'int', COMPLETION_RELEVANCE_LOW);
|
| + //assertNotSuggested('T3');
|
| assertNotSuggested('_T4');
|
| assertNotSuggested('T5');
|
| assertNotSuggested('_T6');
|
| @@ -1135,50 +927,50 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testAB.dart',
|
| '''
|
| - export "dart:math" hide max;
|
| - class A {int x;}
|
| - @deprecated D1() {int x;}
|
| - class _B {boo() { partBoo() {}} }''');
|
| +export "dart:math" hide max;
|
| +class A {int x;}
|
| +@deprecated D1() {int x;}
|
| +class _B {boo() { partBoo() {}} }''');
|
| addSource(
|
| '/testCD.dart',
|
| '''
|
| - String T1;
|
| - var _T2;
|
| - class C { }
|
| - class D { }''');
|
| +String T1;
|
| +var _T2;
|
| +class C { }
|
| +class D { }''');
|
| addSource(
|
| '/testEEF.dart',
|
| '''
|
| - class EE { }
|
| - class F { }''');
|
| +class EE { }
|
| +class F { }''');
|
| addSource('/testG.dart', 'class G { }');
|
| addSource(
|
| '/testH.dart',
|
| '''
|
| - class H { }
|
| - int T3;
|
| - var _T4;'''); // not imported
|
| +class H { }
|
| +int T3;
|
| +var _T4;'''); // not imported
|
| addTestSource('''
|
| - import "/testAB.dart";
|
| - import "/testCD.dart" hide D;
|
| - import "/testEEF.dart" show EE;
|
| - import "/testG.dart" as g;
|
| - int T5;
|
| - var _T6;
|
| - String get T7 => 'hello';
|
| - set T8(int value) { partT8() {} }
|
| - Z D2() {int x;}
|
| - class X {
|
| - int get clog => 8;
|
| - set blog(value) { }
|
| - a() {
|
| - var f;
|
| - localF(int arg1) { }
|
| - {var x;}
|
| - final ^
|
| - }
|
| - void b() { }}
|
| - class Z { }''');
|
| +import "/testAB.dart";
|
| +import "/testCD.dart" hide D;
|
| +import "/testEEF.dart" show EE;
|
| +import "/testG.dart" as g;
|
| +int T5;
|
| +var _T6;
|
| +String get T7 => 'hello';
|
| +set T8(int value) { partT8() {} }
|
| +Z D2() {int x;}
|
| +class X {
|
| + int get clog => 8;
|
| + set blog(value) { }
|
| + a() {
|
| + var f;
|
| + localF(int arg1) { }
|
| + {var x;}
|
| + final ^
|
| + }
|
| + void b() { }}
|
| +class Z { }''');
|
| await computeSuggestions();
|
|
|
| expect(replacementOffset, completionOffset);
|
| @@ -1208,6 +1000,7 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('EE');
|
| // hidden element suggested as low relevance
|
| //assertNotSuggested('F');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('g');
|
| assertNotSuggested('G');
|
| //assertNotSuggested('H');
|
| @@ -1220,7 +1013,7 @@ class C1 extends C2 implements C3 {
|
| // COMPLETION_RELEVANCE_LOW);
|
| assertNotSuggested('T1');
|
| assertNotSuggested('_T2');
|
| - //assertSuggestImportedTopLevelVar('T3', 'int', COMPLETION_RELEVANCE_LOW);
|
| + //assertNotSuggested('T3');
|
| assertNotSuggested('_T4');
|
| assertNotSuggested('T5');
|
| assertNotSuggested('_T6');
|
| @@ -1255,50 +1048,50 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testAB.dart',
|
| '''
|
| - export "dart:math" hide max;
|
| - class A {int x;}
|
| - @deprecated D1() {int x;}
|
| - class _B {boo() { partBoo() {}} }''');
|
| +export "dart:math" hide max;
|
| +class A {int x;}
|
| +@deprecated D1() {int x;}
|
| +class _B {boo() { partBoo() {}} }''');
|
| addSource(
|
| '/testCD.dart',
|
| '''
|
| - String T1;
|
| - var _T2;
|
| - class C { }
|
| - class D { }''');
|
| +String T1;
|
| +var _T2;
|
| +class C { }
|
| +class D { }''');
|
| addSource(
|
| '/testEEF.dart',
|
| '''
|
| - class EE { }
|
| - class F { }''');
|
| +class EE { }
|
| +class F { }''');
|
| addSource('/testG.dart', 'class G { }');
|
| addSource(
|
| '/testH.dart',
|
| '''
|
| - class H { }
|
| - int T3;
|
| - var _T4;'''); // not imported
|
| +class H { }
|
| +int T3;
|
| +var _T4;'''); // not imported
|
| addTestSource('''
|
| - import "/testAB.dart";
|
| - import "/testCD.dart" hide D;
|
| - import "/testEEF.dart" show EE;
|
| - import "/testG.dart" as g;
|
| - int T5;
|
| - var _T6;
|
| - String get T7 => 'hello';
|
| - set T8(int value) { partT8() {} }
|
| - Z D2() {int x;}
|
| - class X {
|
| - int get clog => 8;
|
| - set blog(value) { }
|
| - a() {
|
| - final ^
|
| - final var f;
|
| - localF(int arg1) { }
|
| - {var x;}
|
| - }
|
| - void b() { }}
|
| - class Z { }''');
|
| +import "/testAB.dart";
|
| +import "/testCD.dart" hide D;
|
| +import "/testEEF.dart" show EE;
|
| +import "/testG.dart" as g;
|
| +int T5;
|
| +var _T6;
|
| +String get T7 => 'hello';
|
| +set T8(int value) { partT8() {} }
|
| +Z D2() {int x;}
|
| +class X {
|
| + int get clog => 8;
|
| + set blog(value) { }
|
| + a() {
|
| + final ^
|
| + final var f;
|
| + localF(int arg1) { }
|
| + {var x;}
|
| + }
|
| + void b() { }}
|
| +class Z { }''');
|
| await computeSuggestions();
|
|
|
| expect(replacementOffset, completionOffset);
|
| @@ -1328,6 +1121,7 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('EE');
|
| // hidden element suggested as low relevance
|
| //assertNotSuggested('F');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('g');
|
| assertNotSuggested('G');
|
| //assertNotSuggested('H');
|
| @@ -1340,7 +1134,7 @@ class C1 extends C2 implements C3 {
|
| // COMPLETION_RELEVANCE_LOW);
|
| assertNotSuggested('T1');
|
| assertNotSuggested('_T2');
|
| - //assertSuggestImportedTopLevelVar('T3', 'int', COMPLETION_RELEVANCE_LOW);
|
| + //assertNotSuggested('T3');
|
| assertNotSuggested('_T4');
|
| assertNotSuggested('T5');
|
| assertNotSuggested('_T6');
|
| @@ -1361,50 +1155,50 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testAB.dart',
|
| '''
|
| - export "dart:math" hide max;
|
| - class A {int x;}
|
| - @deprecated D1() {int x;}
|
| - class _B {boo() { partBoo() {}} }''');
|
| +export "dart:math" hide max;
|
| +class A {int x;}
|
| +@deprecated D1() {int x;}
|
| +class _B {boo() { partBoo() {}} }''');
|
| addSource(
|
| '/testCD.dart',
|
| '''
|
| - String T1;
|
| - var _T2;
|
| - class C { }
|
| - class D { }''');
|
| +String T1;
|
| +var _T2;
|
| +class C { }
|
| +class D { }''');
|
| addSource(
|
| '/testEEF.dart',
|
| '''
|
| - class EE { }
|
| - class F { }''');
|
| +class EE { }
|
| +class F { }''');
|
| addSource('/testG.dart', 'class G { }');
|
| addSource(
|
| '/testH.dart',
|
| '''
|
| - class H { }
|
| - int T3;
|
| - var _T4;'''); // not imported
|
| +class H { }
|
| +int T3;
|
| +var _T4;'''); // not imported
|
| addTestSource('''
|
| - import "/testAB.dart";
|
| - import "/testCD.dart" hide D;
|
| - import "/testEEF.dart" show EE;
|
| - import "/testG.dart" as g;
|
| - int T5;
|
| - var _T6;
|
| - String get T7 => 'hello';
|
| - set T8(int value) { partT8() {} }
|
| - Z D2() {int x;}
|
| - class X {
|
| - int get clog => 8;
|
| - set blog(value) { }
|
| - a() {
|
| - final ^
|
| - var f;
|
| - localF(int arg1) { }
|
| - {var x;}
|
| - }
|
| - void b() { }}
|
| - class Z { }''');
|
| +import "/testAB.dart";
|
| +import "/testCD.dart" hide D;
|
| +import "/testEEF.dart" show EE;
|
| +import "/testG.dart" as g;
|
| +int T5;
|
| +var _T6;
|
| +String get T7 => 'hello';
|
| +set T8(int value) { partT8() {} }
|
| +Z D2() {int x;}
|
| +class X {
|
| + int get clog => 8;
|
| + set blog(value) { }
|
| + a() {
|
| + final ^
|
| + var f;
|
| + localF(int arg1) { }
|
| + {var x;}
|
| + }
|
| + void b() { }}
|
| +class Z { }''');
|
| await computeSuggestions();
|
|
|
| expect(replacementOffset, completionOffset);
|
| @@ -1434,6 +1228,7 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('EE');
|
| // hidden element suggested as low relevance
|
| //assertNotSuggested('F');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('g');
|
| assertNotSuggested('G');
|
| //assertNotSuggested('H');
|
| @@ -1446,7 +1241,7 @@ class C1 extends C2 implements C3 {
|
| // COMPLETION_RELEVANCE_LOW);
|
| assertNotSuggested('T1');
|
| assertNotSuggested('_T2');
|
| - //assertSuggestImportedTopLevelVar('T3', 'int', COMPLETION_RELEVANCE_LOW);
|
| + //assertNotSuggested('T3');
|
| assertNotSuggested('_T4');
|
| assertNotSuggested('T5');
|
| assertNotSuggested('_T6');
|
| @@ -1466,40 +1261,40 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testAB.dart',
|
| '''
|
| - export "dart:math" hide max;
|
| - class A {int x;}
|
| - @deprecated D1() {int x;}
|
| - class _B { }''');
|
| +export "dart:math" hide max;
|
| +class A {int x;}
|
| +@deprecated D1() {int x;}
|
| +class _B { }''');
|
| addSource(
|
| '/testCD.dart',
|
| '''
|
| - String T1;
|
| - var _T2;
|
| - class C { }
|
| - class D { }''');
|
| +String T1;
|
| +var _T2;
|
| +class C { }
|
| +class D { }''');
|
| addSource(
|
| '/testEEF.dart',
|
| '''
|
| - class EE { }
|
| - class F { }''');
|
| +class EE { }
|
| +class F { }''');
|
| addSource('/testG.dart', 'class G { }');
|
| addSource(
|
| '/testH.dart',
|
| '''
|
| - class H { }
|
| - class D3 { }
|
| - int T3;
|
| - var _T4;'''); // not imported
|
| +class H { }
|
| +class D3 { }
|
| +int T3;
|
| +var _T4;'''); // not imported
|
| addTestSource('''
|
| - import "/testAB.dart";
|
| - import "/testCD.dart" hide D;
|
| - import "/testEEF.dart" show EE;
|
| - import "/testG.dart" as g;
|
| - int T5;
|
| - var _T6;
|
| - Z D2() {int x;}
|
| - class X {a() {var f; {var x;} D^ var r;} void b() { }}
|
| - class Z { }''');
|
| +import "/testAB.dart";
|
| +import "/testCD.dart" hide D;
|
| +import "/testEEF.dart" show EE;
|
| +import "/testG.dart" as g;
|
| +int T5;
|
| +var _T6;
|
| +Z D2() {int x;}
|
| +class X {a() {var f; {var x;} D^ var r;} void b() { }}
|
| +class Z { }''');
|
| await computeSuggestions();
|
|
|
| expect(replacementOffset, completionOffset - 1);
|
| @@ -1527,7 +1322,7 @@ class C1 extends C2 implements C3 {
|
| //assertNotSuggested('EE');
|
| // hidden element suggested as low relevance
|
| //assertNotSuggested('F');
|
| - //assertNotSuggested('g');
|
| + //assertSuggestLibraryPrefix('g');
|
| assertNotSuggested('G');
|
| //assertNotSuggested('H');
|
| //assertNotSuggested('Object');
|
| @@ -1539,10 +1334,10 @@ class C1 extends C2 implements C3 {
|
| // COMPLETION_RELEVANCE_LOW);
|
| //assertSuggestTopLevelVarGetterSetter('T1', 'String');
|
| assertNotSuggested('_T2');
|
| - //assertSuggestImportedTopLevelVar('T3', 'int', COMPLETION_RELEVANCE_LOW);
|
| + //assertNotSuggested('T3');
|
| assertNotSuggested('_T4');
|
| //assertNotSuggested('T5');
|
| - //assertNotSuggested('_T6');
|
| + //assertSuggestTopLevelVar('_T6', null);
|
| assertNotSuggested('==');
|
| // TODO (danrubel) suggest HtmlElement as low relevance
|
| assertNotSuggested('HtmlElement');
|
| @@ -1553,14 +1348,14 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
|
| - class E extends F { var e1; e2() { } }
|
| - class I { int i1; i2() { } }
|
| - class M { var m1; int m2() { } }''');
|
| +lib B;
|
| +class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
|
| +class E extends F { var e1; e2() { } }
|
| +class I { int i1; i2() { } }
|
| +class M { var m1; int m2() { } }''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - class A extends E implements I with M {a() {^}}''');
|
| +import "/testB.dart";
|
| +class A extends E implements I with M {a() {^}}''');
|
| await computeSuggestions();
|
|
|
| expect(replacementOffset, completionOffset);
|
| @@ -1584,12 +1379,13 @@ class C1 extends C2 implements C3 {
|
| test_Block_inherited_local() async {
|
| // Block BlockFunctionBody MethodDeclaration ClassDeclaration
|
| addTestSource('''
|
| - class F { var f1; f2() { } get f3 => 0; set f4(fx) { } }
|
| - class E extends F { var e1; e2() { } }
|
| - class I { int i1; i2() { } }
|
| - class M { var m1; int m2() { } }
|
| - class A extends E implements I with M {a() {^}}''');
|
| +class F { var f1; f2() { } get f3 => 0; set f4(fx) { } }
|
| +class E extends F { var e1; e2() { } }
|
| +class I { int i1; i2() { } }
|
| +class M { var m1; int m2() { } }
|
| +class A extends E implements I with M {a() {^}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('e1');
|
| @@ -1608,53 +1404,55 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testAB.dart',
|
| '''
|
| - export "dart:math" hide max;
|
| - class A {int x;}
|
| - @deprecated D1() {int x;}
|
| - class _B {boo() { partBoo() {}} }''');
|
| +export "dart:math" hide max;
|
| +class A {int x;}
|
| +@deprecated D1() {int x;}
|
| +class _B {boo() { partBoo() {}} }''');
|
| addSource(
|
| '/testCD.dart',
|
| '''
|
| - String T1;
|
| - var _T2;
|
| - class C { }
|
| - class D { }''');
|
| +String T1;
|
| +var _T2;
|
| +class C { }
|
| +class D { }''');
|
| addSource(
|
| '/testEEF.dart',
|
| '''
|
| - class EE { }
|
| - class F { }''');
|
| +class EE { }
|
| +class F { }''');
|
| addSource('/testG.dart', 'class G { }');
|
| addSource(
|
| '/testH.dart',
|
| '''
|
| - class H { }
|
| - int T3;
|
| - var _T4;'''); // not imported
|
| - addTestSource('''
|
| - import "/testAB.dart";
|
| - import "/testCD.dart" hide D;
|
| - import "/testEEF.dart" show EE;
|
| - import "/testG.dart" as g;
|
| - int T5;
|
| - var _T6;
|
| - String get T7 => 'hello';
|
| - set T8(int value) { partT8() {} }
|
| - Z D2() {int x;}
|
| - class X {
|
| - int get clog => 8;
|
| - set blog(value) { }
|
| - a() {
|
| - var f;
|
| - localF(int arg1) { }
|
| - {var x;}
|
| - p^ var r;
|
| - }
|
| - void b() { }}
|
| - class Z { }''');
|
| +class H { }
|
| +int T3;
|
| +var _T4;'''); // not imported
|
| + addTestSource('''
|
| +import "/testAB.dart";
|
| +import "/testCD.dart" hide D;
|
| +import "/testEEF.dart" show EE;
|
| +import "/testG.dart" as g;
|
| +int T5;
|
| +var _T6;
|
| +String get T7 => 'hello';
|
| +set T8(int value) { partT8() {} }
|
| +Z D2() {int x;}
|
| +class X {
|
| + int get clog => 8;
|
| + set blog(value) { }
|
| + a() {
|
| + var f;
|
| + localF(int arg1) { }
|
| + {var x;}
|
| + p^ var r;
|
| + }
|
| + void b() { }}
|
| +class Z { }''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| +
|
| assertNotSuggested('partT8');
|
| assertNotSuggested('partBoo');
|
| assertNotSuggested('parseIPv6Address');
|
| @@ -1668,6 +1466,7 @@ class C1 extends C2 implements C3 {
|
| testFile = '/proj/completionTest.dart';
|
| addTestSource('class C {foo(){F^}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('Foo');
|
| @@ -1676,50 +1475,25 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('Future');
|
| }
|
|
|
| - test_CascadeExpression_method1() async {
|
| - // PropertyAccess CascadeExpression ExpressionStatement Block
|
| - addSource(
|
| - '/testB.dart',
|
| - '''
|
| - class B { }''');
|
| - addTestSource('''
|
| - import "/testB.dart";
|
| - class A {var b; X _c;}
|
| - class X{}
|
| - // looks like a cascade to the parser
|
| - // but the user is trying to get completions for a non-cascade
|
| - main() {A a; a.^.z()}''');
|
| - await computeSuggestions();
|
| - expect(replacementOffset, completionOffset);
|
| - expect(replacementLength, 0);
|
| - assertSuggestField('b', null);
|
| - assertSuggestField('_c', 'X');
|
| - assertNotSuggested('Object');
|
| - assertNotSuggested('A');
|
| - assertNotSuggested('B');
|
| - assertNotSuggested('X');
|
| - assertNotSuggested('z');
|
| - assertNotSuggested('==');
|
| - }
|
| -
|
| test_CascadeExpression_selector1() async {
|
| // PropertyAccess CascadeExpression ExpressionStatement Block
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - class A {var b; X _c;}
|
| - class X{}
|
| - // looks like a cascade to the parser
|
| - // but the user is trying to get completions for a non-cascade
|
| - main() {A a; a.^.z}''');
|
| +import "/testB.dart";
|
| +class A {var b; X _c;}
|
| +class X{}
|
| +// looks like a cascade to the parser
|
| +// but the user is trying to get completions for a non-cascade
|
| +main() {A a; a.^.z}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestField('b', null);
|
| - assertSuggestField('_c', 'X');
|
| + assertNotSuggested('b');
|
| + assertNotSuggested('_c');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('A');
|
| assertNotSuggested('B');
|
| @@ -1733,17 +1507,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - class A {var b; X _c;}
|
| - class X{}
|
| - main() {A a; a..^z}''');
|
| +import "/testB.dart";
|
| +class A {var b; X _c;}
|
| +class X{}
|
| +main() {A a; a..^z}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 1);
|
| - assertSuggestField('b', null);
|
| - assertSuggestField('_c', 'X');
|
| + assertNotSuggested('b');
|
| + assertNotSuggested('_c');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('A');
|
| assertNotSuggested('B');
|
| @@ -1757,17 +1532,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - class A {var b; X _c;}
|
| - class X{}
|
| - main() {A a; a..^ return}''');
|
| +import "/testB.dart";
|
| +class A {var b; X _c;}
|
| +class X{}
|
| +main() {A a; a..^ return}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestField('b', null);
|
| - assertSuggestField('_c', 'X');
|
| + assertNotSuggested('b');
|
| + assertNotSuggested('_c');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('A');
|
| assertNotSuggested('B');
|
| @@ -1779,10 +1555,11 @@ class C1 extends C2 implements C3 {
|
| test_CascadeExpression_target() async {
|
| // SimpleIdentifier CascadeExpression ExpressionStatement
|
| addTestSource('''
|
| - class A {var b; X _c;}
|
| - class X{}
|
| - main() {A a; a^..b}''');
|
| +class A {var b; X _c;}
|
| +class X{}
|
| +main() {A a; a^..b}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('b');
|
| @@ -1799,6 +1576,7 @@ class C1 extends C2 implements C3 {
|
| // TypeName CatchClause TryStatement
|
| addTestSource('class A {a() {try{var x;} on ^ {}}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| @@ -1811,6 +1589,7 @@ class C1 extends C2 implements C3 {
|
| // TypeName CatchClause TryStatement
|
| addTestSource('class A {a() {try{var x;} on ^}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| @@ -1822,6 +1601,7 @@ class C1 extends C2 implements C3 {
|
| // Block CatchClause TryStatement
|
| addTestSource('class A {a() {try{var x;} on E catch (e) {^}}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('e');
|
| @@ -1834,6 +1614,7 @@ class C1 extends C2 implements C3 {
|
| // Block CatchClause TryStatement
|
| addTestSource('class A {a() {try{var x;} catch (e, s) {^}}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('e');
|
| @@ -1848,19 +1629,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "testB.dart" as x;
|
| - @deprecated class A {^}
|
| - class _B {}
|
| - A T;''');
|
| +import "testB.dart" as x;
|
| +@deprecated class A {^}
|
| +class _B {}
|
| +A T;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| assertNotSuggested('_B');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('T');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('x');
|
| }
|
|
|
| @@ -1869,19 +1652,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "testB.dart" as x;
|
| - class A {final ^}
|
| - class _B {}
|
| - A T;''');
|
| +import "testB.dart" as x;
|
| +class A {final ^}
|
| +class _B {}
|
| +A T;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| assertNotSuggested('_B');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('T');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('x');
|
| }
|
|
|
| @@ -1890,19 +1675,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "testB.dart" as x;
|
| - class A {final ^ A(){}}
|
| - class _B {}
|
| - A T;''');
|
| +import "testB.dart" as x;
|
| +class A {final ^ A(){}}
|
| +class _B {}
|
| +A T;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| assertNotSuggested('_B');
|
| assertNotSuggested('String');
|
| assertNotSuggested('T');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('x');
|
| }
|
|
|
| @@ -1911,19 +1698,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "testB.dart" as Soo;
|
| - class A {final S^ A();}
|
| - class _B {}
|
| - A Sew;''');
|
| +import "testB.dart" as Soo;
|
| +class A {final S^ A();}
|
| +class _B {}
|
| +A Sew;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('A');
|
| assertNotSuggested('_B');
|
| assertNotSuggested('String');
|
| assertNotSuggested('Sew');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('Soo');
|
| }
|
|
|
| @@ -1932,19 +1721,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "testB.dart" as x;
|
| - class A {final ^ final foo;}
|
| - class _B {}
|
| - A T;''');
|
| +import "testB.dart" as x;
|
| +class A {final ^ final foo;}
|
| +class _B {}
|
| +A T;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| assertNotSuggested('_B');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('T');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('x');
|
| }
|
|
|
| @@ -1953,19 +1744,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - class B { }''');
|
| +class B { }''');
|
| addTestSource('''
|
| - import "testB.dart" as x;
|
| - class A {final ^ var foo;}
|
| - class _B {}
|
| - A T;''');
|
| +import "testB.dart" as x;
|
| +class A {final ^ var foo;}
|
| +class _B {}
|
| +A T;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| assertNotSuggested('_B');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('T');
|
| + // Suggested by LibraryPrefixContributor
|
| assertNotSuggested('x');
|
| }
|
|
|
| @@ -1974,27 +1767,28 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testAB.dart',
|
| '''
|
| - library libAB;
|
| - part '/partAB.dart';
|
| - class A { }
|
| - class B { }''');
|
| +library libAB;
|
| +part '/partAB.dart';
|
| +class A { }
|
| +class B { }''');
|
| addSource(
|
| '/partAB.dart',
|
| '''
|
| - part of libAB;
|
| - var T1;
|
| - PB F1() => new PB();
|
| - class PB { }''');
|
| +part of libAB;
|
| +var T1;
|
| +PB F1() => new PB();
|
| +class PB { }''');
|
| addSource(
|
| '/testCD.dart',
|
| '''
|
| - class C { }
|
| - class D { }''');
|
| +class C { }
|
| +class D { }''');
|
| addTestSource('''
|
| - import "/testAB.dart" hide ^;
|
| - import "/testCD.dart";
|
| - class X {}''');
|
| +import "/testAB.dart" hide ^;
|
| +import "/testCD.dart";
|
| +class X {}''');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -2003,29 +1797,30 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testAB.dart',
|
| '''
|
| - library libAB;
|
| - part '/partAB.dart';
|
| - class A { }
|
| - class B { }''');
|
| +library libAB;
|
| +part '/partAB.dart';
|
| +class A { }
|
| +class B { }''');
|
| addSource(
|
| '/partAB.dart',
|
| '''
|
| - part of libAB;
|
| - var T1;
|
| - PB F1() => new PB();
|
| - typedef PB2 F2(int blat);
|
| - class Clz = Object with Object;
|
| - class PB { }''');
|
| +part of libAB;
|
| +var T1;
|
| +PB F1() => new PB();
|
| +typedef PB2 F2(int blat);
|
| +class Clz = Object with Object;
|
| +class PB { }''');
|
| addSource(
|
| '/testCD.dart',
|
| '''
|
| - class C { }
|
| - class D { }''');
|
| +class C { }
|
| +class D { }''');
|
| addTestSource('''
|
| - import "/testAB.dart" show ^;
|
| - import "/testCD.dart";
|
| - class X {}''');
|
| +import "/testAB.dart" show ^;
|
| +import "/testCD.dart";
|
| +class X {}''');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -2034,20 +1829,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - class A {int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +class A {int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - class B {int x;}
|
| - class C {foo(){var f; {var x;} return a ? T1 : T^}}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +class B {int x;}
|
| +class C {foo(){var f; {var x;} return a ? T1 : T^}}''');
|
| await computeSuggestions();
|
| +
|
| // top level results are partially filtered based on first char
|
| assertNotSuggested('T2');
|
| // TODO (danrubel) getter is being suggested instead of top level var
|
| - //assertSuggestImportedTopLevelVar('T1', 'int');
|
| + //assertNotSuggested('T1');
|
| }
|
|
|
| test_ConditionalExpression_elseExpression_empty() async {
|
| @@ -2055,16 +1851,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - class A {int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +class A {int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - class B {int x;}
|
| - class C {foo(){var f; {var x;} return a ? T1 : ^}}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +class B {int x;}
|
| +class C {foo(){var f; {var x;} return a ? T1 : ^}}''');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('x');
|
| assertNotSuggested('f');
|
| assertNotSuggested('foo');
|
| @@ -2074,7 +1871,7 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('A');
|
| assertNotSuggested('F1');
|
| // TODO (danrubel) getter is being suggested instead of top level var
|
| - //assertSuggestImportedTopLevelVar('T1', 'int');
|
| + //assertNotSuggested('T1');
|
| }
|
|
|
| test_ConditionalExpression_partial_thenExpression() async {
|
| @@ -2082,20 +1879,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - class A {int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +class A {int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - class B {int x;}
|
| - class C {foo(){var f; {var x;} return a ? T^}}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +class B {int x;}
|
| +class C {foo(){var f; {var x;} return a ? T^}}''');
|
| await computeSuggestions();
|
| +
|
| // top level results are partially filtered based on first char
|
| assertNotSuggested('T2');
|
| // TODO (danrubel) getter is being suggested instead of top level var
|
| - //assertSuggestImportedTopLevelVar('T1', 'int');
|
| + //assertNotSuggested('T1');
|
| }
|
|
|
| test_ConditionalExpression_partial_thenExpression_empty() async {
|
| @@ -2103,16 +1901,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - class A {int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +class A {int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - class B {int x;}
|
| - class C {foo(){var f; {var x;} return a ? ^}}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +class B {int x;}
|
| +class C {foo(){var f; {var x;} return a ? ^}}''');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('x');
|
| assertNotSuggested('f');
|
| assertNotSuggested('foo');
|
| @@ -2122,7 +1921,7 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('A');
|
| assertNotSuggested('F1');
|
| // TODO (danrubel) getter is being suggested instead of top level var
|
| - //assertSuggestImportedTopLevelVar('T1', 'int');
|
| + //assertNotSuggested('T1');
|
| }
|
|
|
| test_ConditionalExpression_thenExpression() async {
|
| @@ -2130,20 +1929,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - class A {int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +class A {int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - class B {int x;}
|
| - class C {foo(){var f; {var x;} return a ? T^ : c}}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +class B {int x;}
|
| +class C {foo(){var f; {var x;} return a ? T^ : c}}''');
|
| await computeSuggestions();
|
| +
|
| // top level results are partially filtered based on first char
|
| assertNotSuggested('T2');
|
| // TODO (danrubel) getter is being suggested instead of top level var
|
| - //assertSuggestImportedTopLevelVar('T1', 'int');
|
| + //assertNotSuggested('T1');
|
| }
|
|
|
| test_ConstructorName_importedClass() async {
|
| @@ -2152,15 +1952,16 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - int T1;
|
| - F1() { }
|
| - class X {X.c(); X._d(); z() {}}''');
|
| +lib B;
|
| +int T1;
|
| +F1() { }
|
| +class X {X.c(); X._d(); z() {}}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - var m;
|
| - main() {new X.^}''');
|
| +import "/testB.dart";
|
| +var m;
|
| +main() {new X.^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Suggested by NamedConstructorContributor
|
| @@ -2178,15 +1979,16 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - int T1;
|
| - F1() { }
|
| - class X {factory X.c(); factory X._d(); z() {}}''');
|
| +lib B;
|
| +int T1;
|
| +F1() { }
|
| +class X {factory X.c(); factory X._d(); z() {}}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - var m;
|
| - main() {new X.^}''');
|
| +import "/testB.dart";
|
| +var m;
|
| +main() {new X.^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Suggested by NamedConstructorContributor
|
| @@ -2204,6 +2006,7 @@ class C1 extends C2 implements C3 {
|
| addTestSource('''
|
| main() {new String.fr^omCharCodes([]);}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 2);
|
| expect(replacementLength, 13);
|
| // Suggested by NamedConstructorContributor
|
| @@ -2219,11 +2022,12 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
|
| // InstanceCreationExpression
|
| addTestSource('''
|
| - int T1;
|
| - F1() { }
|
| - class X {X.c(); X._d(); z() {}}
|
| - main() {new X.^}''');
|
| +int T1;
|
| +F1() { }
|
| +class X {X.c(); X._d(); z() {}}
|
| +main() {new X.^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Suggested by NamedConstructorContributor
|
| @@ -2239,11 +2043,12 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
|
| // InstanceCreationExpression
|
| addTestSource('''
|
| - int T1;
|
| - F1() { }
|
| - class X {factory X.c(); factory X._d(); z() {}}
|
| - main() {new X.^}''');
|
| +int T1;
|
| +F1() { }
|
| +class X {factory X.c(); factory X._d(); z() {}}
|
| +main() {new X.^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Suggested by NamedConstructorContributor
|
| @@ -2258,10 +2063,11 @@ class C1 extends C2 implements C3 {
|
| test_DefaultFormalParameter_named_expression() async {
|
| // DefaultFormalParameter FormalParameterList MethodDeclaration
|
| addTestSource('''
|
| - foo() { }
|
| - void bar() { }
|
| - class A {a(blat: ^) { }}''');
|
| +foo() { }
|
| +void bar() { }
|
| +class A {a(blat: ^) { }}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('foo');
|
| @@ -2277,15 +2083,16 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - _B F1() { }
|
| - class A {int x;}
|
| - class _B { }''');
|
| +_B F1() { }
|
| +class A {int x;}
|
| +class _B { }''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - typedef int F2(int blat);
|
| - class Clz = Object with Object;
|
| - class C {foo(){^} void bar() {}}''');
|
| +import "/testA.dart";
|
| +typedef int F2(int blat);
|
| +class Clz = Object with Object;
|
| +class C {foo(){^} void bar() {}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('A');
|
| @@ -2311,6 +2118,7 @@ class C1 extends C2 implements C3 {
|
| import "/testA.dart";
|
| class C {a() {C ^}}''');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -2322,6 +2130,7 @@ class C1 extends C2 implements C3 {
|
| import "/testA.dart";
|
| class C {A ^}''');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -2333,6 +2142,7 @@ class C1 extends C2 implements C3 {
|
| import "/testA.dart";
|
| class C {var ^}''');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -2340,6 +2150,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifer FieldFormalParameter FormalParameterList
|
| addTestSource('class A {B(this.^foo) {}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 3);
|
| assertNoSuggestions();
|
| @@ -2349,6 +2160,7 @@ class C1 extends C2 implements C3 {
|
| // Block ForEachStatement
|
| addTestSource('main(args) {for (int foo in bar) {^}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('args');
|
| @@ -2360,6 +2172,7 @@ class C1 extends C2 implements C3 {
|
| // Block ForEachStatement
|
| addTestSource('main(args) {for (foo in bar) {^}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('args');
|
| @@ -2371,6 +2184,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier ForEachStatement Block
|
| addTestSource('main(args) {for (int foo in ^) {}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('args');
|
| @@ -2381,6 +2195,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier ForEachStatement Block
|
| addTestSource('main(args) {for (^ in args) {}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('args');
|
| @@ -2391,6 +2206,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier ForEachStatement Block
|
| addTestSource('main(args) {for (^ foo in args) {}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('args');
|
| @@ -2402,6 +2218,7 @@ class C1 extends C2 implements C3 {
|
| // DeclaredIdentifier ForEachStatement Block
|
| addTestSource('main(args) {for (S^ foo in args) {}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('args');
|
| @@ -2412,10 +2229,11 @@ class C1 extends C2 implements C3 {
|
| test_FormalParameterList() async {
|
| // FormalParameterList MethodDeclaration
|
| addTestSource('''
|
| - foo() { }
|
| - void bar() { }
|
| - class A {a(^) { }}''');
|
| +foo() { }
|
| +void bar() { }
|
| +class A {a(^) { }}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('foo');
|
| @@ -2430,6 +2248,7 @@ class C1 extends C2 implements C3 {
|
| // Block ForStatement
|
| addTestSource('main(args) {for (int i; i < 10; ++i) {^}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('i');
|
| @@ -2440,6 +2259,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier ForStatement
|
| addTestSource('main() {for (int index = 0; i^)}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('index');
|
| @@ -2449,6 +2269,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier ForStatement
|
| addTestSource('main() {List a; for (^)}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -2460,6 +2281,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier ForStatement
|
| addTestSource('main() {for (int index = 0; index < 10; i^)}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('index');
|
| @@ -2468,9 +2290,10 @@ class C1 extends C2 implements C3 {
|
| test_ForStatement_updaters_prefix_expression() async {
|
| // SimpleIdentifier PrefixExpression ForStatement
|
| addTestSource('''
|
| - void bar() { }
|
| - main() {for (int index = 0; index < 10; ++i^)}''');
|
| +void bar() { }
|
| +main() {for (int index = 0; index < 10; ++i^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('index');
|
| @@ -2483,18 +2306,19 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 { }
|
| - /* */ ^ zoo(z) { } String name;''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 { }
|
| +/* */ ^ zoo(z) { } String name;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| @@ -2514,18 +2338,19 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 { }
|
| - /** */ ^ zoo(z) { } String name;''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 { }
|
| +/** */ ^ zoo(z) { } String name;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| @@ -2545,19 +2370,20 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - /// some dartdoc
|
| - class C2 { }
|
| - ^ zoo(z) { } String name;''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +/// some dartdoc
|
| +class C2 { }
|
| +^ zoo(z) { } String name;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| @@ -2576,7 +2402,7 @@ class C1 extends C2 implements C3 {
|
| // Block BlockFunctionBody FunctionExpression
|
| addTestSource('''
|
| void bar() { }
|
| - String foo(List args) {x.then((R b) {^}''');
|
| + String foo(List args) {x.then((R b) {^});}''');
|
| await computeSuggestions();
|
|
|
| expect(replacementOffset, completionOffset);
|
| @@ -2593,6 +2419,7 @@ class C1 extends C2 implements C3 {
|
| addTestSource('''
|
| class A {var b; X _c; foo() {A a; if (true) ^}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('b');
|
| @@ -2605,9 +2432,10 @@ class C1 extends C2 implements C3 {
|
| test_IfStatement_condition() async {
|
| // SimpleIdentifier IfStatement Block BlockFunctionBody
|
| addTestSource('''
|
| - class A {int x; int y() => 0;}
|
| - main(){var a; if (^)}''');
|
| +class A {int x; int y() => 0;}
|
| +main(){var a; if (^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -2621,6 +2449,7 @@ class C1 extends C2 implements C3 {
|
| addTestSource('''
|
| class A {var b; X _c; foo() {A a; if (^) something}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('b');
|
| @@ -2633,11 +2462,12 @@ class C1 extends C2 implements C3 {
|
| test_IfStatement_invocation() async {
|
| // SimpleIdentifier PrefixIdentifier IfStatement
|
| addTestSource('''
|
| - main() {var a; if (a.^) something}''');
|
| +main() {var a; if (a.^) something}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestMethod('toString', 'Object', 'String');
|
| + assertNotSuggested('toString');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('A');
|
| assertNotSuggested('==');
|
| @@ -2646,9 +2476,10 @@ class C1 extends C2 implements C3 {
|
| test_ImportDirective_dart() async {
|
| // SimpleStringLiteral ImportDirective
|
| addTestSource('''
|
| - import "dart^";
|
| - main() {}''');
|
| +import "dart^";
|
| +main() {}''');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -2657,16 +2488,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - class A {int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +class A {int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - class B {int x;}
|
| - class C {foo(){var f; {var x;} f[^]}}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +class B {int x;}
|
| +class C {foo(){var f; {var x;} f[^]}}''');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('x');
|
| assertNotSuggested('f');
|
| assertNotSuggested('foo');
|
| @@ -2676,7 +2508,7 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('A');
|
| assertNotSuggested('F1');
|
| // TODO (danrubel) getter is being suggested instead of top level var
|
| - //assertSuggestImportedTopLevelVar('T1', 'int');
|
| + //assertNotSuggested('T1');
|
| }
|
|
|
| test_IndexExpression2() async {
|
| @@ -2684,20 +2516,21 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - class A {int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +class A {int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - class B {int x;}
|
| - class C {foo(){var f; {var x;} f[T^]}}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +class B {int x;}
|
| +class C {foo(){var f; {var x;} f[T^]}}''');
|
| await computeSuggestions();
|
| +
|
| // top level results are partially filtered based on first char
|
| assertNotSuggested('T2');
|
| // TODO (danrubel) getter is being suggested instead of top level var
|
| - //assertSuggestImportedTopLevelVar('T1', 'int');
|
| + //assertNotSuggested('T1');
|
| }
|
|
|
| test_InstanceCreationExpression_imported() async {
|
| @@ -2705,24 +2538,25 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - class A {A(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +class A {A(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - import "dart:async";
|
| - int T2;
|
| - F2() { }
|
| - class B {B(this.x, [String boo]) { } int x;}
|
| - class C {foo(){var f; {var x;} new ^}}''');
|
| +import "/testA.dart";
|
| +import "dart:async";
|
| +int T2;
|
| +F2() { }
|
| +class B {B(this.x, [String boo]) { } int x;}
|
| +class C {foo(){var f; {var x;} new ^}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| assertNotSuggested('Future');
|
| assertNotSuggested('A');
|
| - assertNotSuggested('B');
|
| - assertNotSuggested('C');
|
| + assertSuggestConstructor('B');
|
| + assertSuggestConstructor('C');
|
| assertNotSuggested('f');
|
| assertNotSuggested('x');
|
| assertNotSuggested('foo');
|
| @@ -2737,6 +2571,7 @@ class C1 extends C2 implements C3 {
|
| addSource('/testAB.dart', 'class Foo { }');
|
| addTestSource('class C {foo(){new F^}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('Future');
|
| @@ -2748,22 +2583,23 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 { }
|
| - main() {String name; print("hello \$^");}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 { }
|
| +main() {String name; print("hello \$^");}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| - // TODO(danrubel) should return top level var rather than getter
|
| + assertNotSuggested('T1');
|
| assertNotSuggested('F1');
|
| assertNotSuggested('D1');
|
| assertNotSuggested('C1');
|
| @@ -2779,21 +2615,23 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 { }
|
| - main() {String name; print("hello \${^}");}''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 { }
|
| +main() {String name; print("hello \${^}");}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| + assertNotSuggested('T1');
|
| assertNotSuggested('F1');
|
| assertNotSuggested('D1');
|
| assertNotSuggested('C1');
|
| @@ -2808,6 +2646,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier InterpolationExpression StringInterpolation
|
| addTestSource('main() {String name; print("hello \${n^}");}');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('name');
|
| // top level results are partially filtered
|
| //assertNotSuggested('Object');
|
| @@ -2817,9 +2656,10 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier PrefixedIdentifier InterpolationExpression
|
| addTestSource('main() {String name; print("hello \${name.^}");}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestGetter('length', 'int');
|
| + assertNotSuggested('length');
|
| assertNotSuggested('name');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('==');
|
| @@ -2829,6 +2669,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier PrefixedIdentifier InterpolationExpression
|
| addTestSource('main() {String name; print("hello \$name.^");}');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -2836,6 +2677,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier PrefixedIdentifier InterpolationExpression
|
| addTestSource('main() {String name; print("hello \${nam^e.length}");}');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('name');
|
| // top level results are partially filtered
|
| //assertNotSuggested('Object');
|
| @@ -2847,14 +2689,15 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - foo() { }
|
| - class X {X.c(); X._d(); z() {}}''');
|
| +lib B;
|
| +foo() { }
|
| +class X {X.c(); X._d(); z() {}}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - class Y {Y.c(); Y._d(); z() {}}
|
| - main() {var x; if (x is ^) { }}''');
|
| +import "/testB.dart";
|
| +class Y {Y.c(); Y._d(); z() {}}
|
| +main() {var x; if (x is ^) { }}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('X');
|
| @@ -2867,11 +2710,12 @@ class C1 extends C2 implements C3 {
|
| test_IsExpression_target() async {
|
| // IfStatement Block BlockFunctionBody
|
| addTestSource('''
|
| - foo() { }
|
| - void bar() { }
|
| - class A {int x; int y() => 0;}
|
| - main(){var a; if (^ is A)}''');
|
| +foo() { }
|
| +void bar() { }
|
| +class A {int x; int y() => 0;}
|
| +main(){var a; if (^ is A)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -2885,9 +2729,10 @@ class C1 extends C2 implements C3 {
|
| test_IsExpression_type() async {
|
| // SimpleIdentifier TypeName IsExpression IfStatement
|
| addTestSource('''
|
| - class A {int x; int y() => 0;}
|
| - main(){var a; if (a is ^)}''');
|
| +class A {int x; int y() => 0;}
|
| +main(){var a; if (a is ^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -2899,9 +2744,10 @@ class C1 extends C2 implements C3 {
|
| test_IsExpression_type_partial() async {
|
| // SimpleIdentifier TypeName IsExpression IfStatement
|
| addTestSource('''
|
| - class A {int x; int y() => 0;}
|
| - main(){var a; if (a is Obj^)}''');
|
| +class A {int x; int y() => 0;}
|
| +main(){var a; if (a is Obj^)}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 3);
|
| expect(replacementLength, 3);
|
| assertNotSuggested('a');
|
| @@ -2910,21 +2756,22 @@ class C1 extends C2 implements C3 {
|
| assertNotSuggested('Object');
|
| }
|
|
|
| - test_keyword2() async {
|
| + test_keyword() async {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - int newT1;
|
| - int T1;
|
| - nowIsIt() { }
|
| - class X {factory X.c(); factory X._d(); z() {}}''');
|
| +lib B;
|
| +int newT1;
|
| +int T1;
|
| +nowIsIt() { }
|
| +class X {factory X.c(); factory X._d(); z() {}}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - String newer() {}
|
| - var m;
|
| - main() {new^ X.c();}''');
|
| +import "/testB.dart";
|
| +String newer() {}
|
| +var m;
|
| +main() {new^ X.c();}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 3);
|
| expect(replacementLength, 3);
|
| assertNotSuggested('c');
|
| @@ -2932,6 +2779,7 @@ class C1 extends C2 implements C3 {
|
| // Imported suggestion are filtered by 1st character
|
| assertNotSuggested('nowIsIt');
|
| assertNotSuggested('T1');
|
| + assertNotSuggested('newT1');
|
| assertNotSuggested('z');
|
| assertNotSuggested('m');
|
| assertNotSuggested('newer');
|
| @@ -2941,6 +2789,7 @@ class C1 extends C2 implements C3 {
|
| // ']' ListLiteral ArgumentList MethodInvocation
|
| addTestSource('main() {var Some; print([^]);}');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('Some');
|
| assertNotSuggested('String');
|
| }
|
| @@ -2949,6 +2798,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier ListLiteral ArgumentList MethodInvocation
|
| addTestSource('main() {var Some; print([S^]);}');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('Some');
|
| assertNotSuggested('String');
|
| }
|
| @@ -2957,6 +2807,7 @@ class C1 extends C2 implements C3 {
|
| // SimpleStringLiteral ExpressionStatement Block
|
| addTestSource('class A {a() {"hel^lo"}}');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -2965,21 +2816,23 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 { }
|
| - foo = {^''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 { }
|
| +foo = {^''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| + assertNotSuggested('T1');
|
| assertNotSuggested('F1');
|
| assertNotSuggested('D1');
|
| assertNotSuggested('C1');
|
| @@ -2994,20 +2847,22 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 { }
|
| - foo = {T^''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 { }
|
| +foo = {T^''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| + assertNotSuggested('T1');
|
| assertNotSuggested('T2');
|
| }
|
|
|
| @@ -3016,20 +2871,22 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 { }
|
| - foo = {7:T^};''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 { }
|
| +foo = {7:T^};''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| + assertNotSuggested('T1');
|
| assertNotSuggested('T2');
|
| }
|
|
|
| @@ -3037,6 +2894,7 @@ class C1 extends C2 implements C3 {
|
| // Block BlockFunctionBody MethodDeclaration
|
| addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -3049,25 +2907,26 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testC.dart',
|
| '''
|
| - class C {
|
| - c1() {}
|
| - var c2;
|
| - static c3() {}
|
| - static var c4;}''');
|
| - addTestSource('''
|
| - import "/testC.dart";
|
| - class B extends C {
|
| - b1() {}
|
| - var b2;
|
| - static b3() {}
|
| - static var b4;}
|
| - class A extends B {
|
| - a1() {}
|
| - var a2;
|
| - static a3() {}
|
| - static var a4;
|
| - static a() {^}}''');
|
| +class C {
|
| + c1() {}
|
| + var c2;
|
| + static c3() {}
|
| + static var c4;}''');
|
| + addTestSource('''
|
| +import "/testC.dart";
|
| +class B extends C {
|
| + b1() {}
|
| + var b2;
|
| + static b3() {}
|
| + static var b4;}
|
| +class A extends B {
|
| + a1() {}
|
| + var a2;
|
| + static a3() {}
|
| + static var a4;
|
| + static a() {^}}''');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('a1');
|
| assertNotSuggested('a2');
|
| assertNotSuggested('a3');
|
| @@ -3086,8 +2945,10 @@ class C1 extends C2 implements C3 {
|
| // Block BlockFunctionBody MethodDeclaration
|
| addTestSource('class A {@deprecated X f; Z _a() {^} var _g;}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| +
|
| assertNotSuggested('_a');
|
| assertNotSuggested('f');
|
| assertNotSuggested('_g');
|
| @@ -3098,6 +2959,7 @@ class C1 extends C2 implements C3 {
|
| // Block BlockFunctionBody MethodDeclaration
|
| addTestSource('class A {@deprecated Z a(X x, _, b, {y: boo}) {^}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('a');
|
| @@ -3111,10 +2973,11 @@ class C1 extends C2 implements C3 {
|
| test_MethodDeclaration_parameters_positional() async {
|
| // Block BlockFunctionBody MethodDeclaration
|
| addTestSource('''
|
| - foo() { }
|
| - void bar() { }
|
| - class A {Z a(X x, [int y=1]) {^}}''');
|
| +foo() { }
|
| +void bar() { }
|
| +class A {Z a(X x, [int y=1]) {^}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('foo');
|
| @@ -3130,17 +2993,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 {^ zoo(z) { } String name; }''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 {^ zoo(z) { } String name; }''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| @@ -3160,17 +3024,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 {/* */ ^ zoo(z) { } String name; }''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 {/* */ ^ zoo(z) { } String name; }''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| @@ -3190,17 +3055,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 {/** */ ^ zoo(z) { } String name; }''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 {/** */ ^ zoo(z) { } String name; }''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| @@ -3220,19 +3086,20 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - int T1;
|
| - F1() { }
|
| - typedef D1();
|
| - class C1 {C1(this.x) { } int x;}''');
|
| +int T1;
|
| +F1() { }
|
| +typedef D1();
|
| +class C1 {C1(this.x) { } int x;}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - int T2;
|
| - F2() { }
|
| - typedef D2();
|
| - class C2 {
|
| - /// some dartdoc
|
| - ^ zoo(z) { } String name; }''');
|
| +import "/testA.dart";
|
| +int T2;
|
| +F2() { }
|
| +typedef D2();
|
| +class C2 {
|
| + /// some dartdoc
|
| + ^ zoo(z) { } String name; }''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| @@ -3250,20 +3117,21 @@ class C1 extends C2 implements C3 {
|
| test_MethodInvocation_no_semicolon() async {
|
| // MethodInvocation ExpressionStatement Block
|
| addTestSource('''
|
| - main() { }
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - // no semicolon between completion point and next statement
|
| - set s1(I x) {} set _s2(I x) {x.^ m(null);}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +main() { }
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + // no semicolon between completion point and next statement
|
| + set s1(I x) {} set _s2(I x) {x.^ m(null);}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestGetter('f', 'X');
|
| - assertSuggestGetter('_g', null);
|
| + assertNotSuggested('f');
|
| + assertNotSuggested('_g');
|
| assertNotSuggested('b');
|
| assertNotSuggested('_c');
|
| assertNotSuggested('d');
|
| @@ -3282,9 +3150,10 @@ class C1 extends C2 implements C3 {
|
| test_new_instance() async {
|
| addTestSource('import "dart:math"; class A {x() {new Random().^}}');
|
| await computeSuggestions();
|
| - assertSuggestMethod('nextBool', 'Random', 'bool');
|
| - assertSuggestMethod('nextDouble', 'Random', 'double');
|
| - assertSuggestMethod('nextInt', 'Random', 'int');
|
| +
|
| + assertNotSuggested('nextBool');
|
| + assertNotSuggested('nextDouble');
|
| + assertNotSuggested('nextInt');
|
| assertNotSuggested('Random');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('A');
|
| @@ -3293,6 +3162,7 @@ class C1 extends C2 implements C3 {
|
| test_parameterName_excludeTypes() async {
|
| addTestSource('m(int ^) {}');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('int');
|
| assertNotSuggested('bool');
|
| }
|
| @@ -3302,26 +3172,28 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - int T1;
|
| - F1() { }
|
| - class X {X.c(); X._d(); z() {}}''');
|
| +lib B;
|
| +int T1;
|
| +F1() { }
|
| +class X {X.c(); X._d(); z() {}}''');
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - library libA;
|
| - import "/testB.dart";
|
| - part "$testFile";
|
| - class A { }
|
| - var m;''');
|
| +library libA;
|
| +import "/testB.dart";
|
| +part "$testFile";
|
| +class A { }
|
| +var m;''');
|
| addTestSource('''
|
| - part of libA;
|
| - class B { factory B.bar(int x) => null; }
|
| - main() {new ^}''');
|
| +part of libA;
|
| +class B { factory B.bar(int x) => null; }
|
| +main() {new ^}''');
|
| + await computeLibrariesContaining();
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertNotSuggested('B.bar');
|
| + assertSuggestConstructor('B.bar');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('X.c');
|
| assertNotSuggested('X._d');
|
| @@ -3338,26 +3210,27 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - int T1;
|
| - F1() { }
|
| - class X {X.c(); X._d(); z() {}}''');
|
| +lib B;
|
| +int T1;
|
| +F1() { }
|
| +class X {X.c(); X._d(); z() {}}''');
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - part of libA;
|
| - class B { }''');
|
| +part of libA;
|
| +class B { }''');
|
| addTestSource('''
|
| - library libA;
|
| - import "/testB.dart";
|
| - part "/testA.dart";
|
| - class A { A({String boo: 'hoo'}) { } }
|
| - main() {new ^}
|
| - var m;''');
|
| +library libA;
|
| +import "/testB.dart";
|
| +part "/testA.dart";
|
| +class A { A({String boo: 'hoo'}) { } }
|
| +main() {new ^}
|
| +var m;''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertNotSuggested('A');
|
| + assertSuggestConstructor('A');
|
| assertNotSuggested('Object');
|
| assertNotSuggested('X.c');
|
| assertNotSuggested('X._d');
|
| @@ -3374,25 +3247,26 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - class I {
|
| - static const scI = 'boo';
|
| - X get f => new A();
|
| - get _g => new A();}
|
| - class B implements I {
|
| - static const int scB = 12;
|
| - var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - set s1(I x) {} set _s2(I x) {}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +lib B;
|
| +class I {
|
| + static const scI = 'boo';
|
| + X get f => new A();
|
| + get _g => new A();}
|
| +class B implements I {
|
| + static const int scB = 12;
|
| + var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + set s1(I x) {} set _s2(I x) {}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - class A extends B {
|
| - static const String scA = 'foo';
|
| - w() { }}
|
| - main() {A.^}''');
|
| +import "/testB.dart";
|
| +class A extends B {
|
| + static const String scA = 'foo';
|
| + w() { }}
|
| +main() {A.^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Suggested by StaticMemberContributor
|
| @@ -3422,31 +3296,32 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - static const int sc = 12;
|
| - @deprecated var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - set s1(I x) {} set _s2(I x) {}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +lib B;
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + static const int sc = 12;
|
| + @deprecated var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + set s1(I x) {} set _s2(I x) {}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - main() {A a; a.^}''');
|
| +import "/testB.dart";
|
| +main() {A a; a.^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('sc');
|
| - assertSuggestField('b', null, isDeprecated: true);
|
| + assertNotSuggested('b');
|
| assertNotSuggested('_c');
|
| - assertSuggestGetter('d', 'X');
|
| + assertNotSuggested('d');
|
| assertNotSuggested('_e');
|
| - assertSuggestGetter('f', 'X');
|
| + assertNotSuggested('f');
|
| assertNotSuggested('_g');
|
| - assertSuggestSetter('s1');
|
| + assertNotSuggested('s1');
|
| assertNotSuggested('_s2');
|
| - assertSuggestMethod('m', 'A', null);
|
| + assertNotSuggested('m');
|
| assertNotSuggested('_n');
|
| assertNotSuggested('a');
|
| assertNotSuggested('A');
|
| @@ -3458,29 +3333,30 @@ class C1 extends C2 implements C3 {
|
| test_PrefixedIdentifier_class_local() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('''
|
| - main() {A a; a.^}
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - static const int sc = 12;
|
| - var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - set s1(I x) {} set _s2(I x) {}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +main() {A a; a.^}
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + static const int sc = 12;
|
| + var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + set s1(I x) {} set _s2(I x) {}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('sc');
|
| - assertSuggestField('b', null);
|
| - assertSuggestField('_c', 'X');
|
| - assertSuggestGetter('d', 'X');
|
| - assertSuggestGetter('_e', null);
|
| - assertSuggestGetter('f', 'X');
|
| - assertSuggestGetter('_g', null);
|
| - assertSuggestSetter('s1');
|
| - assertSuggestSetter('_s2');
|
| - assertSuggestMethod('m', 'A', null);
|
| - assertSuggestMethod('_n', 'A', 'I');
|
| + assertNotSuggested('b');
|
| + assertNotSuggested('_c');
|
| + assertNotSuggested('d');
|
| + assertNotSuggested('_e');
|
| + assertNotSuggested('f');
|
| + assertNotSuggested('_g');
|
| + assertNotSuggested('s1');
|
| + assertNotSuggested('_s2');
|
| + assertNotSuggested('m');
|
| + assertNotSuggested('_n');
|
| assertNotSuggested('a');
|
| assertNotSuggested('A');
|
| assertNotSuggested('X');
|
| @@ -3492,7 +3368,8 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('String get g => "one"; f() {g.^}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_library() async {
|
| @@ -3500,16 +3377,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - var T1;
|
| - class X { }
|
| - class Y { }''');
|
| +lib B;
|
| +var T1;
|
| +class X { }
|
| +class Y { }''');
|
| addTestSource('''
|
| - import "/testB.dart" as b;
|
| - var T2;
|
| - class A { }
|
| - main() {b.^}''');
|
| +import "/testB.dart" as b;
|
| +var T2;
|
| +class A { }
|
| +main() {b.^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Suggested by LibraryMemberContributor
|
| @@ -3528,16 +3406,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - var T1;
|
| - class X { }
|
| - class Y { }''');
|
| +lib B;
|
| +var T1;
|
| +class X { }
|
| +class Y { }''');
|
| addTestSource('''
|
| - import "/testB.dart" as b;
|
| - var T2;
|
| - class A { }
|
| - foo(b.^ f) {}''');
|
| +import "/testB.dart" as b;
|
| +var T2;
|
| +class A { }
|
| +foo(b.^ f) {}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Suggested by LibraryMemberContributor
|
| @@ -3556,16 +3435,17 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - var T1;
|
| - class X { }
|
| - class Y { }''');
|
| +lib B;
|
| +var T1;
|
| +class X { }
|
| +class Y { }''');
|
| addTestSource('''
|
| - import "/testB.dart" as b;
|
| - var T2;
|
| - class A { }
|
| - foo(b.^) {}''');
|
| +import "/testB.dart" as b;
|
| +var T2;
|
| +class A { }
|
| +foo(b.^) {}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Suggested by LibraryMemberContributor
|
| @@ -3584,17 +3464,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - class _W {M y; var _z;}
|
| - class X extends _W {}
|
| - class M{}''');
|
| +lib B;
|
| +class _W {M y; var _z;}
|
| +class X extends _W {}
|
| +class M{}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - foo(X x) {x.^}''');
|
| +import "/testB.dart";
|
| +foo(X x) {x.^}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestField('y', 'M');
|
| + assertNotSuggested('y');
|
| assertNotSuggested('_z');
|
| assertNotSuggested('==');
|
| }
|
| @@ -3604,12 +3485,13 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - class A {static int bar = 10;}
|
| - _B() {}''');
|
| +class A {static int bar = 10;}
|
| +_B() {}''');
|
| addTestSource('''
|
| - import "/testA.dart";
|
| - class X {foo(){A^.bar}}''');
|
| +import "/testA.dart";
|
| +class X {foo(){A^.bar}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('A');
|
| @@ -3623,88 +3505,100 @@ class C1 extends C2 implements C3 {
|
| // PrefixedIdentifier ExpressionStatement Block BlockFunctionBody
|
| addTestSource('class A {String x; int get foo {x.^}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestGetter('isEmpty', 'bool');
|
| - assertSuggestMethod('compareTo', 'Comparable', 'int');
|
| + assertNotSuggested('isEmpty');
|
| + assertNotSuggested('compareTo');
|
| }
|
|
|
| test_PrefixedIdentifier_propertyAccess_newStmt() async {
|
| // PrefixedIdentifier ExpressionStatement Block BlockFunctionBody
|
| addTestSource('class A {String x; int get foo {x.^ int y = 0;}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestGetter('isEmpty', 'bool');
|
| - assertSuggestMethod('compareTo', 'Comparable', 'int');
|
| + assertNotSuggested('isEmpty');
|
| + assertNotSuggested('compareTo');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_const() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('const String g = "hello"; f() {g.^ int y = 0;}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_field() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('class A {String g; f() {g.^ int y = 0;}}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_function() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('String g() => "one"; f() {g.^ int y = 0;}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_functionTypeAlias() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('typedef String g(); f() {g.^ int y = 0;}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_getter() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('String get g => "one"; f() {g.^ int y = 0;}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_local_typed() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('f() {String g; g.^ int y = 0;}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_local_untyped() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('f() {var g = "hello"; g.^ int y = 0;}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_method() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('class A {String g() {}; f() {g.^ int y = 0;}}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_param() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('class A {f(String g) {g.^ int y = 0;}}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_localVariableDeclarationName() async {
|
| addTestSource('main() {String m^}');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('main');
|
| assertNotSuggested('min');
|
| }
|
| @@ -3713,23 +3607,26 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('f(String g) {g.^ int y = 0;}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PrefixedIdentifier_trailingStmt_topLevelVar() async {
|
| // SimpleIdentifier PrefixedIdentifier ExpressionStatement
|
| addTestSource('String g; f() {g.^ int y = 0;}');
|
| await computeSuggestions();
|
| - assertSuggestGetter('length', 'int');
|
| +
|
| + assertNotSuggested('length');
|
| }
|
|
|
| test_PropertyAccess_expression() async {
|
| // SimpleIdentifier MethodInvocation PropertyAccess ExpressionStatement
|
| addTestSource('class A {a() {"hello".to^String().length}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 2);
|
| expect(replacementLength, 8);
|
| - assertSuggestGetter('length', 'int');
|
| + assertNotSuggested('length');
|
| assertNotSuggested('A');
|
| assertNotSuggested('a');
|
| assertNotSuggested('Object');
|
| @@ -3741,6 +3638,7 @@ class C1 extends C2 implements C3 {
|
| addSource('/testAB.dart', 'class Foo { }');
|
| addTestSource('class C {foo(){.^}}');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -3749,6 +3647,7 @@ class C1 extends C2 implements C3 {
|
| addSource('/testAB.dart', 'class Foo { }');
|
| addTestSource('main() {.^}');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -3756,9 +3655,10 @@ class C1 extends C2 implements C3 {
|
| // SimpleIdentifier PropertyAccess ExpressionStatement Block
|
| addTestSource('class A {a() {"hello".length.^}}');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestGetter('isEven', 'bool');
|
| + assertNotSuggested('isEven');
|
| assertNotSuggested('A');
|
| assertNotSuggested('a');
|
| assertNotSuggested('Object');
|
| @@ -3769,6 +3669,7 @@ class C1 extends C2 implements C3 {
|
| // SwitchStatement Block BlockFunctionBody MethodDeclaration
|
| addTestSource('class A {String g(int x) {switch(x) {c^}}}');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -3776,6 +3677,7 @@ class C1 extends C2 implements C3 {
|
| // SwitchStatement Block BlockFunctionBody MethodDeclaration
|
| addTestSource('class A {String g(int x) {var t; switch(x) {case 0: ^}}}');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('A');
|
| assertNotSuggested('g');
|
| assertNotSuggested('t');
|
| @@ -3786,36 +3688,38 @@ class C1 extends C2 implements C3 {
|
| // SwitchStatement Block BlockFunctionBody MethodDeclaration
|
| addTestSource('class A {String g(int x) {switch(x) {^}}}');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| test_ThisExpression_block() async {
|
| // MethodInvocation ExpressionStatement Block
|
| addTestSource('''
|
| - main() { }
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - A() {}
|
| - A.z() {}
|
| - var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - // no semicolon between completion point and next statement
|
| - set s1(I x) {} set _s2(I x) {this.^ m(null);}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +main() { }
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + A() {}
|
| + A.z() {}
|
| + var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + // no semicolon between completion point and next statement
|
| + set s1(I x) {} set _s2(I x) {this.^ m(null);}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestField('b', null);
|
| - assertSuggestField('_c', 'X');
|
| - assertSuggestGetter('d', 'X');
|
| - assertSuggestGetter('_e', null);
|
| - assertSuggestGetter('f', 'X');
|
| - assertSuggestGetter('_g', null);
|
| - assertSuggestMethod('m', 'A', null);
|
| - assertSuggestMethod('_n', 'A', 'I');
|
| - assertSuggestSetter('s1');
|
| - assertSuggestSetter('_s2');
|
| + assertNotSuggested('b');
|
| + assertNotSuggested('_c');
|
| + assertNotSuggested('d');
|
| + assertNotSuggested('_e');
|
| + assertNotSuggested('f');
|
| + assertNotSuggested('_g');
|
| + assertNotSuggested('m');
|
| + assertNotSuggested('_n');
|
| + assertNotSuggested('s1');
|
| + assertNotSuggested('_s2');
|
| assertNotSuggested('z');
|
| assertNotSuggested('I');
|
| assertNotSuggested('A');
|
| @@ -3827,30 +3731,31 @@ class C1 extends C2 implements C3 {
|
| test_ThisExpression_constructor() async {
|
| // MethodInvocation ExpressionStatement Block
|
| addTestSource('''
|
| - main() { }
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - A() {this.^}
|
| - A.z() {}
|
| - var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - // no semicolon between completion point and next statement
|
| - set s1(I x) {} set _s2(I x) {m(null);}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +main() { }
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + A() {this.^}
|
| + A.z() {}
|
| + var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + // no semicolon between completion point and next statement
|
| + set s1(I x) {} set _s2(I x) {m(null);}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| - assertSuggestField('b', null);
|
| - assertSuggestField('_c', 'X');
|
| - assertSuggestGetter('d', 'X');
|
| - assertSuggestGetter('_e', null);
|
| - assertSuggestGetter('f', 'X');
|
| - assertSuggestGetter('_g', null);
|
| - assertSuggestMethod('m', 'A', null);
|
| - assertSuggestMethod('_n', 'A', 'I');
|
| - assertSuggestSetter('s1');
|
| - assertSuggestSetter('_s2');
|
| + assertNotSuggested('b');
|
| + assertNotSuggested('_c');
|
| + assertNotSuggested('d');
|
| + assertNotSuggested('_e');
|
| + assertNotSuggested('f');
|
| + assertNotSuggested('_g');
|
| + assertNotSuggested('m');
|
| + assertNotSuggested('_n');
|
| + assertNotSuggested('s1');
|
| + assertNotSuggested('_s2');
|
| assertNotSuggested('z');
|
| assertNotSuggested('I');
|
| assertNotSuggested('A');
|
| @@ -3862,18 +3767,19 @@ class C1 extends C2 implements C3 {
|
| test_ThisExpression_constructor_param() async {
|
| // SimpleIdentifier FieldFormalParameter FormalParameterList
|
| addTestSource('''
|
| - main() { }
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - A(this.^) {}
|
| - A.z() {}
|
| - var b; X _c; static sb;
|
| - X get d => new A();get _e => new A();
|
| - // no semicolon between completion point and next statement
|
| - set s1(I x) {} set _s2(I x) {m(null);}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +main() { }
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + A(this.^) {}
|
| + A.z() {}
|
| + var b; X _c; static sb;
|
| + X get d => new A();get _e => new A();
|
| + // no semicolon between completion point and next statement
|
| + set s1(I x) {} set _s2(I x) {m(null);}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| // Contributed by FieldFormalConstructorContributor
|
| @@ -3899,18 +3805,19 @@ class C1 extends C2 implements C3 {
|
| test_ThisExpression_constructor_param2() async {
|
| // SimpleIdentifier FieldFormalParameter FormalParameterList
|
| addTestSource('''
|
| - main() { }
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - A(this.b^) {}
|
| - A.z() {}
|
| - var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - // no semicolon between completion point and next statement
|
| - set s1(I x) {} set _s2(I x) {m(null);}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +main() { }
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + A(this.b^) {}
|
| + A.z() {}
|
| + var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + // no semicolon between completion point and next statement
|
| + set s1(I x) {} set _s2(I x) {m(null);}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| // Contributed by FieldFormalConstructorContributor
|
| @@ -3935,18 +3842,19 @@ class C1 extends C2 implements C3 {
|
| test_ThisExpression_constructor_param3() async {
|
| // SimpleIdentifier FieldFormalParameter FormalParameterList
|
| addTestSource('''
|
| - main() { }
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - A(this.^b) {}
|
| - A.z() {}
|
| - var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - // no semicolon between completion point and next statement
|
| - set s1(I x) {} set _s2(I x) {m(null);}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +main() { }
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + A(this.^b) {}
|
| + A.z() {}
|
| + var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + // no semicolon between completion point and next statement
|
| + set s1(I x) {} set _s2(I x) {m(null);}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 1);
|
| // Contributed by FieldFormalConstructorContributor
|
| @@ -3971,18 +3879,19 @@ class C1 extends C2 implements C3 {
|
| test_ThisExpression_constructor_param4() async {
|
| // SimpleIdentifier FieldFormalParameter FormalParameterList
|
| addTestSource('''
|
| - main() { }
|
| - class I {X get f => new A();get _g => new A();}
|
| - class A implements I {
|
| - A(this.b, this.^) {}
|
| - A.z() {}
|
| - var b; X _c;
|
| - X get d => new A();get _e => new A();
|
| - // no semicolon between completion point and next statement
|
| - set s1(I x) {} set _s2(I x) {m(null);}
|
| - m(X x) {} I _n(X x) {}}
|
| - class X{}''');
|
| +main() { }
|
| +class I {X get f => new A();get _g => new A();}
|
| +class A implements I {
|
| + A(this.b, this.^) {}
|
| + A.z() {}
|
| + var b; X _c;
|
| + X get d => new A();get _e => new A();
|
| + // no semicolon between completion point and next statement
|
| + set s1(I x) {} set _s2(I x) {m(null);}
|
| + m(X x) {} I _n(X x) {}}
|
| +class X{}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('b');
|
| @@ -4009,6 +3918,7 @@ class C1 extends C2 implements C3 {
|
| // TopLevelVariableDeclaration
|
| addTestSource('class A {} B ^');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -4017,6 +3927,7 @@ class C1 extends C2 implements C3 {
|
| // TopLevelVariableDeclaration
|
| addTestSource('class A {} var ^');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -4025,17 +3936,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - class C1 {int x;}
|
| - F1() => 0;
|
| - typedef String T1(int blat);''');
|
| +class C1 {int x;}
|
| +F1() => 0;
|
| +typedef String T1(int blat);''');
|
| addTestSource('''
|
| - import "/testA.dart";'
|
| - class C2 {int x;}
|
| - F2() => 0;
|
| - typedef int T2(int blat);
|
| - class C<E> {}
|
| - main() { C<^> c; }''');
|
| +import "/testA.dart";'
|
| +class C2 {int x;}
|
| +F2() => 0;
|
| +typedef int T2(int blat);
|
| +class C<E> {}
|
| +main() { C<^> c; }''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('Object');
|
| @@ -4052,17 +3964,18 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testA.dart',
|
| '''
|
| - class C1 {int x;}
|
| - F1() => 0;
|
| - typedef String T1(int blat);''');
|
| +class C1 {int x;}
|
| +F1() => 0;
|
| +typedef String T1(int blat);''');
|
| addTestSource('''
|
| - import "/testA.dart";'
|
| - class C2 {int x;}
|
| - F2() => 0;
|
| - typedef int T2(int blat);
|
| - class C<E> {}
|
| - main() { C<C^> c; }''');
|
| +import "/testA.dart";'
|
| +class C2 {int x;}
|
| +F2() => 0;
|
| +typedef int T2(int blat);
|
| +class C<E> {}
|
| +main() { C<C^> c; }''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset - 1);
|
| expect(replacementLength, 1);
|
| assertNotSuggested('C1');
|
| @@ -4075,15 +3988,16 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - foo() { }
|
| - class _B { }
|
| - class X {X.c(); X._d(); z() {}}''');
|
| +lib B;
|
| +foo() { }
|
| +class _B { }
|
| +class X {X.c(); X._d(); z() {}}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - class Y {Y.c(); Y._d(); z() {}}
|
| - main() {var ^}''');
|
| +import "/testB.dart";
|
| +class Y {Y.c(); Y._d(); z() {}}
|
| +main() {var ^}''');
|
| await computeSuggestions();
|
| +
|
| assertNoSuggestions();
|
| }
|
|
|
| @@ -4091,6 +4005,7 @@ class C1 extends C2 implements C3 {
|
| // VariableDeclarationList VariableDeclarationStatement Block
|
| addTestSource('main() {final ^} class C { }');
|
| await computeSuggestions();
|
| +
|
| assertNotSuggested('Object');
|
| assertNotSuggested('C');
|
| assertNotSuggested('==');
|
| @@ -4102,15 +4017,16 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - foo() { }
|
| - class _B { }
|
| - class X {X.c(); X._d(); z() {}}''');
|
| +lib B;
|
| +foo() { }
|
| +class _B { }
|
| +class X {X.c(); X._d(); z() {}}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - class Y {Y.c(); Y._d(); z() {}}
|
| - class C {bar(){var f; {var x;} var e = ^}}''');
|
| +import "/testB.dart";
|
| +class Y {Y.c(); Y._d(); z() {}}
|
| +class C {bar(){var f; {var x;} var e = ^}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('X');
|
| @@ -4128,18 +4044,19 @@ class C1 extends C2 implements C3 {
|
| addSource(
|
| '/testB.dart',
|
| '''
|
| - lib B;
|
| - foo1() { }
|
| - void bar1() { }
|
| - class _B { }
|
| - class X {X.c(); X._d(); z() {}}''');
|
| +lib B;
|
| +foo1() { }
|
| +void bar1() { }
|
| +class _B { }
|
| +class X {X.c(); X._d(); z() {}}''');
|
| addTestSource('''
|
| - import "/testB.dart";
|
| - foo2() { }
|
| - void bar2() { }
|
| - class Y {Y.c(); Y._d(); z() {}}
|
| - class C {bar(){var f; {var x;} var e = ^ var g}}''');
|
| +import "/testB.dart";
|
| +foo2() { }
|
| +void bar2() { }
|
| +class Y {Y.c(); Y._d(); z() {}}
|
| +class C {bar(){var f; {var x;} var e = ^ var g}}''');
|
| await computeSuggestions();
|
| +
|
| expect(replacementOffset, completionOffset);
|
| expect(replacementLength, 0);
|
| assertNotSuggested('X');
|
|
|