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

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_common.dart

Issue 2761633002: Infer fields/getters/setters types according to the new top-level inference rules. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.src.serialization.elements_test; 5 library test.src.serialization.elements_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
9 import 'package:analyzer/dart/constant/value.dart'; 9 import 'package:analyzer/dart/constant/value.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 4706 matching lines...) Expand 10 before | Expand all | Expand 10 after
4717 const vGenericClass = D; 4717 const vGenericClass = D;
4718 const vEnum = E; 4718 const vEnum = E;
4719 const vFunctionTypeAlias = F; 4719 const vFunctionTypeAlias = F;
4720 '''); 4720 ''');
4721 if (isStrongMode) { 4721 if (isStrongMode) {
4722 checkElementText( 4722 checkElementText(
4723 library, 4723 library,
4724 r''' 4724 r'''
4725 typedef dynamic F(int a, String b); 4725 typedef dynamic F(int a, String b);
4726 enum E { 4726 enum E {
4727 final int index; 4727 synthetic final int index;
4728 static const List<E> values; 4728 synthetic static const List<E> values;
4729 static const E a; 4729 static const E a;
4730 static const E b; 4730 static const E b;
4731 static const E c; 4731 static const E c;
4732 } 4732 }
4733 class C { 4733 class C {
4734 } 4734 }
4735 class D<T> { 4735 class D<T> {
4736 } 4736 }
4737 const Type vDynamic = 4737 const Type vDynamic =
4738 dynamic/*location: dynamic*/; 4738 dynamic/*location: dynamic*/;
4739 const Type vNull = 4739 const Type vNull =
4740 Null/*location: dart:core;Null*/; 4740 Null/*location: dart:core;Null*/;
4741 const Type vObject = 4741 const Type vObject =
4742 Object/*location: dart:core;Object*/; 4742 Object/*location: dart:core;Object*/;
4743 const Type vClass = 4743 const Type vClass =
4744 C/*location: test.dart;C*/; 4744 C/*location: test.dart;C*/;
4745 const Type vGenericClass = 4745 const Type vGenericClass =
4746 D/*location: test.dart;D*/; 4746 D/*location: test.dart;D*/;
4747 const Type vEnum = 4747 const Type vEnum =
4748 E/*location: test.dart;E*/; 4748 E/*location: test.dart;E*/;
4749 const Type vFunctionTypeAlias = 4749 const Type vFunctionTypeAlias =
4750 F/*location: test.dart;F*/; 4750 F/*location: test.dart;F*/;
4751 '''); 4751 ''');
4752 } else { 4752 } else {
4753 checkElementText( 4753 checkElementText(
4754 library, 4754 library,
4755 r''' 4755 r'''
4756 typedef dynamic F(int a, String b); 4756 typedef dynamic F(int a, String b);
4757 enum E { 4757 enum E {
4758 final int index; 4758 synthetic final int index;
4759 static const List<E> values; 4759 synthetic static const List<E> values;
4760 static const E a; 4760 static const E a;
4761 static const E b; 4761 static const E b;
4762 static const E c; 4762 static const E c;
4763 } 4763 }
4764 class C { 4764 class C {
4765 } 4765 }
4766 class D<T> { 4766 class D<T> {
4767 } 4767 }
4768 const dynamic vDynamic = 4768 const dynamic vDynamic =
4769 dynamic/*location: dynamic*/; 4769 dynamic/*location: dynamic*/;
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
5448 enum E {a, b, c} 5448 enum E {a, b, c}
5449 final vValue = E.a; 5449 final vValue = E.a;
5450 final vValues = E.values; 5450 final vValues = E.values;
5451 final vIndex = E.a.index; 5451 final vIndex = E.a.index;
5452 '''); 5452 ''');
5453 if (isStrongMode) { 5453 if (isStrongMode) {
5454 checkElementText( 5454 checkElementText(
5455 library, 5455 library,
5456 r''' 5456 r'''
5457 enum E { 5457 enum E {
5458 final int index; 5458 synthetic final int index;
5459 static const List<E> values; 5459 synthetic static const List<E> values;
5460 static const E a; 5460 static const E a;
5461 static const E b; 5461 static const E b;
5462 static const E c; 5462 static const E c;
5463 } 5463 }
5464 final E vValue; 5464 final E vValue;
5465 final List<E> vValues; 5465 final List<E> vValues;
5466 final dynamic vIndex; 5466 final dynamic vIndex;
5467 '''); 5467 ''');
5468 } else { 5468 } else {
5469 checkElementText( 5469 checkElementText(
5470 library, 5470 library,
5471 r''' 5471 r'''
5472 enum E { 5472 enum E {
5473 final int index; 5473 synthetic final int index;
5474 static const List<E> values; 5474 synthetic static const List<E> values;
5475 static const E a; 5475 static const E a;
5476 static const E b; 5476 static const E b;
5477 static const E c; 5477 static const E c;
5478 } 5478 }
5479 final dynamic vValue; 5479 final dynamic vValue;
5480 final dynamic vValues; 5480 final dynamic vValues;
5481 final dynamic vIndex; 5481 final dynamic vIndex;
5482 '''); 5482 ''');
5483 } 5483 }
5484 } 5484 }
5485 5485
5486 test_constExpr_pushReference_enum_method() { 5486 test_constExpr_pushReference_enum_method() {
5487 var library = checkLibrary(''' 5487 var library = checkLibrary('''
5488 enum E {a} 5488 enum E {a}
5489 final vToString = E.a.toString(); 5489 final vToString = E.a.toString();
5490 '''); 5490 ''');
5491 if (isStrongMode) { 5491 if (isStrongMode) {
5492 checkElementText( 5492 checkElementText(
5493 library, 5493 library,
5494 r''' 5494 r'''
5495 enum E { 5495 enum E {
5496 final int index; 5496 synthetic final int index;
5497 static const List<E> values; 5497 synthetic static const List<E> values;
5498 static const E a; 5498 static const E a;
5499 } 5499 }
5500 final String vToString; 5500 final String vToString;
5501 '''); 5501 ''');
5502 } else { 5502 } else {
5503 checkElementText( 5503 checkElementText(
5504 library, 5504 library,
5505 r''' 5505 r'''
5506 enum E { 5506 enum E {
5507 final int index; 5507 synthetic final int index;
5508 static const List<E> values; 5508 synthetic static const List<E> values;
5509 static const E a; 5509 static const E a;
5510 } 5510 }
5511 final dynamic vToString; 5511 final dynamic vToString;
5512 '''); 5512 ''');
5513 } 5513 }
5514 } 5514 }
5515 5515
5516 test_constExpr_pushReference_field_simpleIdentifier() { 5516 test_constExpr_pushReference_field_simpleIdentifier() {
5517 var library = checkLibrary(''' 5517 var library = checkLibrary('''
5518 class C { 5518 class C {
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
6931 */ 6931 */
6932 enum E { v }'''); 6932 enum E { v }''');
6933 if (isStrongMode) { 6933 if (isStrongMode) {
6934 checkElementText( 6934 checkElementText(
6935 library, 6935 library,
6936 r''' 6936 r'''
6937 /** 6937 /**
6938 * Docs 6938 * Docs
6939 */ 6939 */
6940 enum E { 6940 enum E {
6941 final int index; 6941 synthetic final int index;
6942 static const List<E> values; 6942 synthetic static const List<E> values;
6943 static const E v; 6943 static const E v;
6944 } 6944 }
6945 '''); 6945 ''');
6946 } else { 6946 } else {
6947 checkElementText( 6947 checkElementText(
6948 library, 6948 library,
6949 r''' 6949 r'''
6950 /** 6950 /**
6951 * Docs 6951 * Docs
6952 */ 6952 */
6953 enum E { 6953 enum E {
6954 final int index; 6954 synthetic final int index;
6955 static const List<E> values; 6955 synthetic static const List<E> values;
6956 static const E v; 6956 static const E v;
6957 } 6957 }
6958 '''); 6958 ''');
6959 } 6959 }
6960 } 6960 }
6961 6961
6962 test_enum_value_documented() { 6962 test_enum_value_documented() {
6963 var library = checkLibrary(''' 6963 var library = checkLibrary('''
6964 enum E { 6964 enum E {
6965 /** 6965 /**
6966 * Docs 6966 * Docs
6967 */ 6967 */
6968 v 6968 v
6969 }'''); 6969 }''');
6970 if (isStrongMode) { 6970 if (isStrongMode) {
6971 checkElementText( 6971 checkElementText(
6972 library, 6972 library,
6973 r''' 6973 r'''
6974 enum E { 6974 enum E {
6975 final int index; 6975 synthetic final int index;
6976 static const List<E> values; 6976 synthetic static const List<E> values;
6977 /** 6977 /**
6978 * Docs 6978 * Docs
6979 */ 6979 */
6980 static const E v; 6980 static const E v;
6981 } 6981 }
6982 '''); 6982 ''');
6983 } else { 6983 } else {
6984 checkElementText( 6984 checkElementText(
6985 library, 6985 library,
6986 r''' 6986 r'''
6987 enum E { 6987 enum E {
6988 final int index; 6988 synthetic final int index;
6989 static const List<E> values; 6989 synthetic static const List<E> values;
6990 /** 6990 /**
6991 * Docs 6991 * Docs
6992 */ 6992 */
6993 static const E v; 6993 static const E v;
6994 } 6994 }
6995 '''); 6995 ''');
6996 } 6996 }
6997 } 6997 }
6998 6998
6999 test_enum_values() { 6999 test_enum_values() {
7000 var library = checkLibrary('enum E { v1, v2 }'); 7000 var library = checkLibrary('enum E { v1, v2 }');
7001 if (isStrongMode) { 7001 if (isStrongMode) {
7002 checkElementText( 7002 checkElementText(
7003 library, 7003 library,
7004 r''' 7004 r'''
7005 enum E { 7005 enum E {
7006 final int index; 7006 synthetic final int index;
7007 static const List<E> values; 7007 synthetic static const List<E> values;
7008 static const E v1; 7008 static const E v1;
7009 static const E v2; 7009 static const E v2;
7010 } 7010 }
7011 '''); 7011 ''');
7012 } else { 7012 } else {
7013 checkElementText( 7013 checkElementText(
7014 library, 7014 library,
7015 r''' 7015 r'''
7016 enum E { 7016 enum E {
7017 final int index; 7017 synthetic final int index;
7018 static const List<E> values; 7018 synthetic static const List<E> values;
7019 static const E v1; 7019 static const E v1;
7020 static const E v2; 7020 static const E v2;
7021 } 7021 }
7022 '''); 7022 ''');
7023 } 7023 }
7024 } 7024 }
7025 7025
7026 test_enums() { 7026 test_enums() {
7027 var library = checkLibrary('enum E1 { v1 } enum E2 { v2 }'); 7027 var library = checkLibrary('enum E1 { v1 } enum E2 { v2 }');
7028 if (isStrongMode) { 7028 if (isStrongMode) {
7029 checkElementText( 7029 checkElementText(
7030 library, 7030 library,
7031 r''' 7031 r'''
7032 enum E1 { 7032 enum E1 {
7033 final int index; 7033 synthetic final int index;
7034 static const List<E1> values; 7034 synthetic static const List<E1> values;
7035 static const E1 v1; 7035 static const E1 v1;
7036 } 7036 }
7037 enum E2 { 7037 enum E2 {
7038 final int index; 7038 synthetic final int index;
7039 static const List<E2> values; 7039 synthetic static const List<E2> values;
7040 static const E2 v2; 7040 static const E2 v2;
7041 } 7041 }
7042 '''); 7042 ''');
7043 } else { 7043 } else {
7044 checkElementText( 7044 checkElementText(
7045 library, 7045 library,
7046 r''' 7046 r'''
7047 enum E1 { 7047 enum E1 {
7048 final int index; 7048 synthetic final int index;
7049 static const List<E1> values; 7049 synthetic static const List<E1> values;
7050 static const E1 v1; 7050 static const E1 v1;
7051 } 7051 }
7052 enum E2 { 7052 enum E2 {
7053 final int index; 7053 synthetic final int index;
7054 static const List<E2> values; 7054 synthetic static const List<E2> values;
7055 static const E2 v2; 7055 static const E2 v2;
7056 } 7056 }
7057 '''); 7057 ''');
7058 } 7058 }
7059 } 7059 }
7060 7060
7061 test_error_extendsEnum() { 7061 test_error_extendsEnum() {
7062 var library = checkLibrary(''' 7062 var library = checkLibrary('''
7063 enum E {a, b, c} 7063 enum E {a, b, c}
7064 7064
(...skipping 11 matching lines...) Expand all
7076 foo() {} 7076 foo() {}
7077 } 7077 }
7078 7078
7079 class D = Object with M, E; 7079 class D = Object with M, E;
7080 '''); 7080 ''');
7081 if (isStrongMode) { 7081 if (isStrongMode) {
7082 checkElementText( 7082 checkElementText(
7083 library, 7083 library,
7084 r''' 7084 r'''
7085 enum E { 7085 enum E {
7086 final int index; 7086 synthetic final int index;
7087 static const List<E> values; 7087 synthetic static const List<E> values;
7088 static const E a; 7088 static const E a;
7089 static const E b; 7089 static const E b;
7090 static const E c; 7090 static const E c;
7091 } 7091 }
7092 class M { 7092 class M {
7093 } 7093 }
7094 class A { 7094 class A {
7095 dynamic foo() {} 7095 dynamic foo() {}
7096 } 7096 }
7097 class B implements M { 7097 class B implements M {
7098 dynamic foo() {} 7098 dynamic foo() {}
7099 } 7099 }
7100 class C extends Object with M { 7100 class C extends Object with M {
7101 synthetic C(); 7101 synthetic C();
7102 dynamic foo() {} 7102 dynamic foo() {}
7103 } 7103 }
7104 class alias D extends Object with M { 7104 class alias D extends Object with M {
7105 synthetic D() = Object; 7105 synthetic D() = Object;
7106 } 7106 }
7107 '''); 7107 ''');
7108 } else { 7108 } else {
7109 checkElementText( 7109 checkElementText(
7110 library, 7110 library,
7111 r''' 7111 r'''
7112 enum E { 7112 enum E {
7113 final int index; 7113 synthetic final int index;
7114 static const List<E> values; 7114 synthetic static const List<E> values;
7115 static const E a; 7115 static const E a;
7116 static const E b; 7116 static const E b;
7117 static const E c; 7117 static const E c;
7118 } 7118 }
7119 class M { 7119 class M {
7120 } 7120 }
7121 class A { 7121 class A {
7122 dynamic foo() {} 7122 dynamic foo() {}
7123 } 7123 }
7124 class B implements M { 7124 class B implements M {
(...skipping 3884 matching lines...) Expand 10 before | Expand all | Expand 10 after
11009 11009
11010 test_metadata_enumDeclaration() { 11010 test_metadata_enumDeclaration() {
11011 var library = checkLibrary('const a = null; @a enum E { v }'); 11011 var library = checkLibrary('const a = null; @a enum E { v }');
11012 if (isStrongMode) { 11012 if (isStrongMode) {
11013 checkElementText( 11013 checkElementText(
11014 library, 11014 library,
11015 r''' 11015 r'''
11016 @ 11016 @
11017 a/*location: test.dart;a?*/ 11017 a/*location: test.dart;a?*/
11018 enum E { 11018 enum E {
11019 final int index; 11019 synthetic final int index;
11020 static const List<E> values; 11020 synthetic static const List<E> values;
11021 static const E v; 11021 static const E v;
11022 } 11022 }
11023 const dynamic a = null; 11023 const dynamic a = null;
11024 '''); 11024 ''');
11025 } else { 11025 } else {
11026 checkElementText( 11026 checkElementText(
11027 library, 11027 library,
11028 r''' 11028 r'''
11029 @ 11029 @
11030 a/*location: test.dart;a?*/ 11030 a/*location: test.dart;a?*/
11031 enum E { 11031 enum E {
11032 final int index; 11032 synthetic final int index;
11033 static const List<E> values; 11033 synthetic static const List<E> values;
11034 static const E v; 11034 static const E v;
11035 } 11035 }
11036 const dynamic a = null; 11036 const dynamic a = null;
11037 '''); 11037 ''');
11038 } 11038 }
11039 } 11039 }
11040 11040
11041 test_metadata_exportDirective() { 11041 test_metadata_exportDirective() {
11042 addLibrarySource('/foo.dart', ''); 11042 addLibrarySource('/foo.dart', '');
11043 var library = checkLibrary('@a export "foo.dart"; const a = null;'); 11043 var library = checkLibrary('@a export "foo.dart"; const a = null;');
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after
13136 13136
13137 test_type_reference_lib_to_lib() { 13137 test_type_reference_lib_to_lib() {
13138 var library = 13138 var library =
13139 checkLibrary('class C {} enum E { v } typedef F(); C c; E e; F f;'); 13139 checkLibrary('class C {} enum E { v } typedef F(); C c; E e; F f;');
13140 if (isStrongMode) { 13140 if (isStrongMode) {
13141 checkElementText( 13141 checkElementText(
13142 library, 13142 library,
13143 r''' 13143 r'''
13144 typedef dynamic F(); 13144 typedef dynamic F();
13145 enum E { 13145 enum E {
13146 final int index; 13146 synthetic final int index;
13147 static const List<E> values; 13147 synthetic static const List<E> values;
13148 static const E v; 13148 static const E v;
13149 } 13149 }
13150 class C { 13150 class C {
13151 } 13151 }
13152 C c; 13152 C c;
13153 E e; 13153 E e;
13154 F f; 13154 F f;
13155 '''); 13155 ''');
13156 } else { 13156 } else {
13157 checkElementText( 13157 checkElementText(
13158 library, 13158 library,
13159 r''' 13159 r'''
13160 typedef dynamic F(); 13160 typedef dynamic F();
13161 enum E { 13161 enum E {
13162 final int index; 13162 synthetic final int index;
13163 static const List<E> values; 13163 synthetic static const List<E> values;
13164 static const E v; 13164 static const E v;
13165 } 13165 }
13166 class C { 13166 class C {
13167 } 13167 }
13168 C c; 13168 C c;
13169 E e; 13169 E e;
13170 F f; 13170 F f;
13171 '''); 13171 ''');
13172 } 13172 }
13173 } 13173 }
13174 13174
13175 test_type_reference_lib_to_part() { 13175 test_type_reference_lib_to_part() {
13176 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();'); 13176 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();');
13177 var library = checkLibrary('library l; part "a.dart"; C c; E e; F f;'); 13177 var library = checkLibrary('library l; part "a.dart"; C c; E e; F f;');
13178 if (isStrongMode) { 13178 if (isStrongMode) {
13179 checkElementText( 13179 checkElementText(
13180 library, 13180 library,
13181 r''' 13181 r'''
13182 library l; 13182 library l;
13183 part 'a.dart'; 13183 part 'a.dart';
13184 C c; 13184 C c;
13185 E e; 13185 E e;
13186 F f; 13186 F f;
13187 -------------------- 13187 --------------------
13188 unit: a.dart 13188 unit: a.dart
13189 13189
13190 typedef dynamic F(); 13190 typedef dynamic F();
13191 enum E { 13191 enum E {
13192 final int index; 13192 synthetic final int index;
13193 static const List<E> values; 13193 synthetic static const List<E> values;
13194 static const E v; 13194 static const E v;
13195 } 13195 }
13196 class C { 13196 class C {
13197 } 13197 }
13198 '''); 13198 ''');
13199 } else { 13199 } else {
13200 checkElementText( 13200 checkElementText(
13201 library, 13201 library,
13202 r''' 13202 r'''
13203 library l; 13203 library l;
13204 part 'a.dart'; 13204 part 'a.dart';
13205 C c; 13205 C c;
13206 E e; 13206 E e;
13207 F f; 13207 F f;
13208 -------------------- 13208 --------------------
13209 unit: a.dart 13209 unit: a.dart
13210 13210
13211 typedef dynamic F(); 13211 typedef dynamic F();
13212 enum E { 13212 enum E {
13213 final int index; 13213 synthetic final int index;
13214 static const List<E> values; 13214 synthetic static const List<E> values;
13215 static const E v; 13215 static const E v;
13216 } 13216 }
13217 class C { 13217 class C {
13218 } 13218 }
13219 '''); 13219 ''');
13220 } 13220 }
13221 } 13221 }
13222 13222
13223 test_type_reference_part_to_lib() { 13223 test_type_reference_part_to_lib() {
13224 addSource('/a.dart', 'part of l; C c; E e; F f;'); 13224 addSource('/a.dart', 'part of l; C c; E e; F f;');
13225 var library = checkLibrary( 13225 var library = checkLibrary(
13226 'library l; part "a.dart"; class C {} enum E { v } typedef F();'); 13226 'library l; part "a.dart"; class C {} enum E { v } typedef F();');
13227 if (isStrongMode) { 13227 if (isStrongMode) {
13228 checkElementText( 13228 checkElementText(
13229 library, 13229 library,
13230 r''' 13230 r'''
13231 library l; 13231 library l;
13232 part 'a.dart'; 13232 part 'a.dart';
13233 typedef dynamic F(); 13233 typedef dynamic F();
13234 enum E { 13234 enum E {
13235 final int index; 13235 synthetic final int index;
13236 static const List<E> values; 13236 synthetic static const List<E> values;
13237 static const E v; 13237 static const E v;
13238 } 13238 }
13239 class C { 13239 class C {
13240 } 13240 }
13241 -------------------- 13241 --------------------
13242 unit: a.dart 13242 unit: a.dart
13243 13243
13244 C c; 13244 C c;
13245 E e; 13245 E e;
13246 F f; 13246 F f;
13247 '''); 13247 ''');
13248 } else { 13248 } else {
13249 checkElementText( 13249 checkElementText(
13250 library, 13250 library,
13251 r''' 13251 r'''
13252 library l; 13252 library l;
13253 part 'a.dart'; 13253 part 'a.dart';
13254 typedef dynamic F(); 13254 typedef dynamic F();
13255 enum E { 13255 enum E {
13256 final int index; 13256 synthetic final int index;
13257 static const List<E> values; 13257 synthetic static const List<E> values;
13258 static const E v; 13258 static const E v;
13259 } 13259 }
13260 class C { 13260 class C {
13261 } 13261 }
13262 -------------------- 13262 --------------------
13263 unit: a.dart 13263 unit: a.dart
13264 13264
13265 C c; 13265 C c;
13266 E e; 13266 E e;
13267 F f; 13267 F f;
(...skipping 10 matching lines...) Expand all
13278 library, 13278 library,
13279 r''' 13279 r'''
13280 library l; 13280 library l;
13281 part 'a.dart'; 13281 part 'a.dart';
13282 part 'b.dart'; 13282 part 'b.dart';
13283 -------------------- 13283 --------------------
13284 unit: a.dart 13284 unit: a.dart
13285 13285
13286 typedef dynamic F(); 13286 typedef dynamic F();
13287 enum E { 13287 enum E {
13288 final int index; 13288 synthetic final int index;
13289 static const List<E> values; 13289 synthetic static const List<E> values;
13290 static const E v; 13290 static const E v;
13291 } 13291 }
13292 class C { 13292 class C {
13293 } 13293 }
13294 -------------------- 13294 --------------------
13295 unit: b.dart 13295 unit: b.dart
13296 13296
13297 C c; 13297 C c;
13298 E e; 13298 E e;
13299 F f; 13299 F f;
13300 '''); 13300 ''');
13301 } else { 13301 } else {
13302 checkElementText( 13302 checkElementText(
13303 library, 13303 library,
13304 r''' 13304 r'''
13305 library l; 13305 library l;
13306 part 'a.dart'; 13306 part 'a.dart';
13307 part 'b.dart'; 13307 part 'b.dart';
13308 -------------------- 13308 --------------------
13309 unit: a.dart 13309 unit: a.dart
13310 13310
13311 typedef dynamic F(); 13311 typedef dynamic F();
13312 enum E { 13312 enum E {
13313 final int index; 13313 synthetic final int index;
13314 static const List<E> values; 13314 synthetic static const List<E> values;
13315 static const E v; 13315 static const E v;
13316 } 13316 }
13317 class C { 13317 class C {
13318 } 13318 }
13319 -------------------- 13319 --------------------
13320 unit: b.dart 13320 unit: b.dart
13321 13321
13322 C c; 13322 C c;
13323 E e; 13323 E e;
13324 F f; 13324 F f;
13325 '''); 13325 ''');
13326 } 13326 }
13327 } 13327 }
13328 13328
13329 test_type_reference_part_to_part() { 13329 test_type_reference_part_to_part() {
13330 addSource('/a.dart', 13330 addSource('/a.dart',
13331 'part of l; class C {} enum E { v } typedef F(); C c; E e; F f;'); 13331 'part of l; class C {} enum E { v } typedef F(); C c; E e; F f;');
13332 var library = checkLibrary('library l; part "a.dart";'); 13332 var library = checkLibrary('library l; part "a.dart";');
13333 if (isStrongMode) { 13333 if (isStrongMode) {
13334 checkElementText( 13334 checkElementText(
13335 library, 13335 library,
13336 r''' 13336 r'''
13337 library l; 13337 library l;
13338 part 'a.dart'; 13338 part 'a.dart';
13339 -------------------- 13339 --------------------
13340 unit: a.dart 13340 unit: a.dart
13341 13341
13342 typedef dynamic F(); 13342 typedef dynamic F();
13343 enum E { 13343 enum E {
13344 final int index; 13344 synthetic final int index;
13345 static const List<E> values; 13345 synthetic static const List<E> values;
13346 static const E v; 13346 static const E v;
13347 } 13347 }
13348 class C { 13348 class C {
13349 } 13349 }
13350 C c; 13350 C c;
13351 E e; 13351 E e;
13352 F f; 13352 F f;
13353 '''); 13353 ''');
13354 } else { 13354 } else {
13355 checkElementText( 13355 checkElementText(
13356 library, 13356 library,
13357 r''' 13357 r'''
13358 library l; 13358 library l;
13359 part 'a.dart'; 13359 part 'a.dart';
13360 -------------------- 13360 --------------------
13361 unit: a.dart 13361 unit: a.dart
13362 13362
13363 typedef dynamic F(); 13363 typedef dynamic F();
13364 enum E { 13364 enum E {
13365 final int index; 13365 synthetic final int index;
13366 static const List<E> values; 13366 synthetic static const List<E> values;
13367 static const E v; 13367 static const E v;
13368 } 13368 }
13369 class C { 13369 class C {
13370 } 13370 }
13371 C c; 13371 C c;
13372 E e; 13372 E e;
13373 F f; 13373 F f;
13374 '''); 13374 ''');
13375 } 13375 }
13376 } 13376 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
13438 } 13438 }
13439 } 13439 }
13440 13440
13441 test_type_reference_to_enum() { 13441 test_type_reference_to_enum() {
13442 var library = checkLibrary('enum E { v } E e;'); 13442 var library = checkLibrary('enum E { v } E e;');
13443 if (isStrongMode) { 13443 if (isStrongMode) {
13444 checkElementText( 13444 checkElementText(
13445 library, 13445 library,
13446 r''' 13446 r'''
13447 enum E { 13447 enum E {
13448 final int index; 13448 synthetic final int index;
13449 static const List<E> values; 13449 synthetic static const List<E> values;
13450 static const E v; 13450 static const E v;
13451 } 13451 }
13452 E e; 13452 E e;
13453 '''); 13453 ''');
13454 } else { 13454 } else {
13455 checkElementText( 13455 checkElementText(
13456 library, 13456 library,
13457 r''' 13457 r'''
13458 enum E { 13458 enum E {
13459 final int index; 13459 synthetic final int index;
13460 static const List<E> values; 13460 synthetic static const List<E> values;
13461 static const E v; 13461 static const E v;
13462 } 13462 }
13463 E e; 13463 E e;
13464 '''); 13464 ''');
13465 } 13465 }
13466 } 13466 }
13467 13467
13468 test_type_reference_to_import() { 13468 test_type_reference_to_import() {
13469 addLibrarySource('/a.dart', 'class C {} enum E { v }; typedef F();'); 13469 addLibrarySource('/a.dart', 'class C {} enum E { v }; typedef F();');
13470 var library = checkLibrary('import "a.dart"; C c; E e; F f;'); 13470 var library = checkLibrary('import "a.dart"; C c; E e; F f;');
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
14981 fail('Unexpectedly tried to get unlinked summary for $uri'); 14981 fail('Unexpectedly tried to get unlinked summary for $uri');
14982 } 14982 }
14983 return serializedUnit; 14983 return serializedUnit;
14984 } 14984 }
14985 14985
14986 @override 14986 @override
14987 bool hasLibrarySummary(String uri) { 14987 bool hasLibrarySummary(String uri) {
14988 return true; 14988 return true;
14989 } 14989 }
14990 } 14990 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/element_text.dart ('k') | pkg/analyzer/test/src/summary/top_level_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698