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

Unified Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 895773004: Issue 22316. Don't propose to create invalid local variable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/lib/src/services/correction/fix_internal.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/correction/fix_test.dart
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index 232d5602e352af658a1891214df2c0dd843ae714..d833738ee50c86151c2ca5b77d185caccb841560 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -922,6 +922,34 @@ class A {
''');
}
+ void test_createLocalVariable_functionType_named() {
+ _indexTestUnit('''
+typedef MY_FUNCTION(int p);
+foo(MY_FUNCTION f) {}
+main() {
+ foo(bar);
+}
+''');
+ assertHasFix(FixKind.CREATE_LOCAL_VARIABLE, '''
+typedef MY_FUNCTION(int p);
+foo(MY_FUNCTION f) {}
+main() {
+ MY_FUNCTION bar;
+ foo(bar);
+}
+''');
+ }
+
+ void test_createLocalVariable_functionType_synthetic() {
+ _indexTestUnit('''
+foo(f(int p)) {}
+main() {
+ foo(bar);
+}
+''');
+ assertNoFix(FixKind.CREATE_LOCAL_VARIABLE);
+ }
+
void test_createLocalVariable_read_typeAssignment() {
_indexTestUnit('''
main() {
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698