Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Unified Diff: pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart

Issue 1872073002: Code completion improvement in the DAS- only suggest completions on the RHS of an as-expression tha… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebase with bleeding_edge Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/test/completion_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 9edbe26b147558b50ca3ad974f450df5fed3192b..e617931231d0c1a055a40179739a39e2954f5f26 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -331,7 +331,7 @@ void main() {expect(foo: ^)}''');
assertNotSuggested('main');
}
- test_AsExpression() async {
+ test_AsExpression_type() async {
// SimpleIdentifier TypeName AsExpression
addTestSource('''
class A {var b; X _c; foo() {var a; (a as ^).foo();}''');
@@ -346,6 +346,38 @@ void main() {expect(foo: ^)}''');
assertNotSuggested('==');
}
+ test_AsExpression_type_filter_extends() async {
+ // SimpleIdentifier TypeName AsExpression
+ addTestSource('''
+class A {} class B extends A {} class C extends A {} class D {}
+f(A a){ (a as ^) }''');
+ await computeSuggestions();
+
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestClass('B');
+ assertSuggestClass('C');
+ assertNotSuggested('A');
+ assertNotSuggested('D');
+ assertNotSuggested('Object');
+ }
+
+ test_IsExpression_type_filter_implements() async {
+ // SimpleIdentifier TypeName AsExpression
+ addTestSource('''
+class A {} class B implements A {} class C implements A {} class D {}
+f(A a){ (a as ^) }''');
+ await computeSuggestions();
+
+ expect(replacementOffset, completionOffset);
+ expect(replacementLength, 0);
+ assertSuggestClass('B');
+ assertSuggestClass('C');
+ assertNotSuggested('A');
+ assertNotSuggested('D');
+ assertNotSuggested('Object');
+ }
+
test_AssignmentExpression_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
@@ -2750,7 +2782,7 @@ main(){var a; if (a is Obj^)}''');
assertNotSuggested('Object');
}
- test_IsExpression_type_subtype_extends_filter() async {
+ test_IsExpression_type_filter_extends() async {
// SimpleIdentifier TypeName IsExpression IfStatement
addTestSource('''
class A {} class B extends A {} class C extends A {} class D {}
« no previous file with comments | « pkg/analysis_server/test/completion_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698