| OLD | NEW |
| 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 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 5079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5090 | 5090 |
| 5091 test_defaultValue_refersToGenericClass_constructor() async { | 5091 test_defaultValue_refersToGenericClass_constructor() async { |
| 5092 var library = await checkLibrary(''' | 5092 var library = await checkLibrary(''' |
| 5093 class B<T> { | 5093 class B<T> { |
| 5094 const B(); | 5094 const B(); |
| 5095 } | 5095 } |
| 5096 class C<T> { | 5096 class C<T> { |
| 5097 const C([B<T> b = const B()]); | 5097 const C([B<T> b = const B()]); |
| 5098 } | 5098 } |
| 5099 '''); | 5099 '''); |
| 5100 checkElementText(library, r''' | 5100 if (isSharedFrontEnd) { |
| 5101 checkElementText(library, r''' |
| 5101 class B<T> { | 5102 class B<T> { |
| 5102 const B(); | 5103 const B(); |
| 5103 } | 5104 } |
| 5105 class C<T> { |
| 5106 const C([B<T> b = const |
| 5107 B/*location: test.dart;B*/< |
| 5108 T/*location: test.dart;C;T*/>()]); |
| 5109 } |
| 5110 '''); |
| 5111 } else { |
| 5112 checkElementText(library, r''' |
| 5113 class B<T> { |
| 5114 const B(); |
| 5115 } |
| 5104 class C<T> { | 5116 class C<T> { |
| 5105 const C([B<T> b = const | 5117 const C([B<T> b = const |
| 5106 B/*location: test.dart;B*/()]); | 5118 B/*location: test.dart;B*/()]); |
| 5107 } | 5119 } |
| 5108 '''); | 5120 '''); |
| 5121 } |
| 5109 } | 5122 } |
| 5110 | 5123 |
| 5111 test_defaultValue_refersToGenericClass_constructor2() async { | 5124 test_defaultValue_refersToGenericClass_constructor2() async { |
| 5112 var library = await checkLibrary(''' | 5125 var library = await checkLibrary(''' |
| 5113 abstract class A<T> {} | 5126 abstract class A<T> {} |
| 5114 class B<T> implements A<T> { | 5127 class B<T> implements A<T> { |
| 5115 const B(); | 5128 const B(); |
| 5116 } | 5129 } |
| 5117 class C<T> implements A<Iterable<T>> { | 5130 class C<T> implements A<Iterable<T>> { |
| 5118 const C([A<T> a = const B()]); | 5131 const C([A<T> a = const B()]); |
| 5119 } | 5132 } |
| 5120 '''); | 5133 '''); |
| 5121 checkElementText(library, r''' | 5134 if (isSharedFrontEnd) { |
| 5135 checkElementText(library, r''' |
| 5122 abstract class A<T> { | 5136 abstract class A<T> { |
| 5123 } | 5137 } |
| 5124 class B<T> implements A<T> { | 5138 class B<T> implements A<T> { |
| 5139 const B(); |
| 5140 } |
| 5141 class C<T> implements A<Iterable<T>> { |
| 5142 const C([A<T> a = const |
| 5143 B/*location: test.dart;B*/< |
| 5144 T/*location: test.dart;C;T*/>()]); |
| 5145 } |
| 5146 '''); |
| 5147 } else { |
| 5148 checkElementText(library, r''' |
| 5149 abstract class A<T> { |
| 5150 } |
| 5151 class B<T> implements A<T> { |
| 5125 const B(); | 5152 const B(); |
| 5126 } | 5153 } |
| 5127 class C<T> implements A<Iterable<T>> { | 5154 class C<T> implements A<Iterable<T>> { |
| 5128 const C([A<T> a = const | 5155 const C([A<T> a = const |
| 5129 B/*location: test.dart;B*/()]); | 5156 B/*location: test.dart;B*/()]); |
| 5130 } | 5157 } |
| 5131 '''); | 5158 '''); |
| 5159 } |
| 5132 } | 5160 } |
| 5133 | 5161 |
| 5134 test_defaultValue_refersToGenericClass_functionG() async { | 5162 test_defaultValue_refersToGenericClass_functionG() async { |
| 5135 var library = await checkLibrary(''' | 5163 var library = await checkLibrary(''' |
| 5136 class B<T> { | 5164 class B<T> { |
| 5137 const B(); | 5165 const B(); |
| 5138 } | 5166 } |
| 5139 void foo<T>([B<T> b = const B()]) {} | 5167 void foo<T>([B<T> b = const B()]) {} |
| 5140 '''); | 5168 '''); |
| 5141 checkElementText(library, r''' | 5169 if (isSharedFrontEnd) { |
| 5170 checkElementText(library, r''' |
| 5171 class B<T> { |
| 5172 const B(); |
| 5173 } |
| 5174 void foo<T>([B<T> b = const |
| 5175 B/*location: test.dart;B*/< |
| 5176 T/*location: test.dart;foo;T*/>()]) {} |
| 5177 '''); |
| 5178 } else { |
| 5179 checkElementText(library, r''' |
| 5142 class B<T> { | 5180 class B<T> { |
| 5143 const B(); | 5181 const B(); |
| 5144 } | 5182 } |
| 5145 void foo<T>([B<T> b = const | 5183 void foo<T>([B<T> b = const |
| 5146 B/*location: test.dart;B*/()]) {} | 5184 B/*location: test.dart;B*/()]) {} |
| 5147 '''); | 5185 '''); |
| 5186 } |
| 5148 } | 5187 } |
| 5149 | 5188 |
| 5150 test_defaultValue_refersToGenericClass_methodG() async { | 5189 test_defaultValue_refersToGenericClass_methodG() async { |
| 5151 var library = await checkLibrary(''' | 5190 var library = await checkLibrary(''' |
| 5152 class B<T> { | 5191 class B<T> { |
| 5153 const B(); | 5192 const B(); |
| 5154 } | 5193 } |
| 5155 class C { | 5194 class C { |
| 5156 void foo<T>([B<T> b = const B()]) {} | 5195 void foo<T>([B<T> b = const B()]) {} |
| 5157 } | 5196 } |
| 5158 '''); | 5197 '''); |
| 5159 checkElementText(library, r''' | 5198 if (isSharedFrontEnd) { |
| 5199 checkElementText(library, r''' |
| 5160 class B<T> { | 5200 class B<T> { |
| 5161 const B(); | 5201 const B(); |
| 5162 } | 5202 } |
| 5203 class C { |
| 5204 void foo<T>([B<T> b = const |
| 5205 B/*location: test.dart;B*/< |
| 5206 T/*location: test.dart;C;foo;T*/>()]) {} |
| 5207 } |
| 5208 '''); |
| 5209 } else { |
| 5210 checkElementText(library, r''' |
| 5211 class B<T> { |
| 5212 const B(); |
| 5213 } |
| 5163 class C { | 5214 class C { |
| 5164 void foo<T>([B<T> b = const | 5215 void foo<T>([B<T> b = const |
| 5165 B/*location: test.dart;B*/()]) {} | 5216 B/*location: test.dart;B*/()]) {} |
| 5166 } | 5217 } |
| 5167 '''); | 5218 '''); |
| 5219 } |
| 5168 } | 5220 } |
| 5169 | 5221 |
| 5170 test_defaultValue_refersToGenericClass_methodG_classG() async { | 5222 test_defaultValue_refersToGenericClass_methodG_classG() async { |
| 5171 var library = await checkLibrary(''' | 5223 var library = await checkLibrary(''' |
| 5172 class B<T1, T2> { | 5224 class B<T1, T2> { |
| 5173 const B(); | 5225 const B(); |
| 5174 } | 5226 } |
| 5175 class C<E1> { | 5227 class C<E1> { |
| 5176 void foo<E2>([B<E1, E2> b = const B()]) {} | 5228 void foo<E2>([B<E1, E2> b = const B()]) {} |
| 5177 } | 5229 } |
| 5178 '''); | 5230 '''); |
| 5179 checkElementText(library, r''' | 5231 if (isSharedFrontEnd) { |
| 5232 checkElementText(library, r''' |
| 5180 class B<T1, T2> { | 5233 class B<T1, T2> { |
| 5181 const B(); | 5234 const B(); |
| 5182 } | 5235 } |
| 5236 class C<E1> { |
| 5237 void foo<E2>([B<E1, E2> b = const |
| 5238 B/*location: test.dart;B*/< |
| 5239 E1/*location: test.dart;C;E1*/, |
| 5240 E2/*location: test.dart;C;foo;E2*/>()]) {} |
| 5241 } |
| 5242 '''); |
| 5243 } else { |
| 5244 checkElementText(library, r''' |
| 5245 class B<T1, T2> { |
| 5246 const B(); |
| 5247 } |
| 5183 class C<E1> { | 5248 class C<E1> { |
| 5184 void foo<E2>([B<E1, E2> b = const | 5249 void foo<E2>([B<E1, E2> b = const |
| 5185 B/*location: test.dart;B*/()]) {} | 5250 B/*location: test.dart;B*/()]) {} |
| 5186 } | 5251 } |
| 5187 '''); | 5252 '''); |
| 5253 } |
| 5188 } | 5254 } |
| 5189 | 5255 |
| 5190 test_defaultValue_refersToGenericClass_methodNG() async { | 5256 test_defaultValue_refersToGenericClass_methodNG() async { |
| 5191 var library = await checkLibrary(''' | 5257 var library = await checkLibrary(''' |
| 5192 class B<T> { | 5258 class B<T> { |
| 5193 const B(); | 5259 const B(); |
| 5194 } | 5260 } |
| 5195 class C<T> { | 5261 class C<T> { |
| 5196 void foo([B<T> b = const B()]) {} | 5262 void foo([B<T> b = const B()]) {} |
| 5197 } | 5263 } |
| 5198 '''); | 5264 '''); |
| 5199 checkElementText(library, r''' | 5265 if (isSharedFrontEnd) { |
| 5266 checkElementText(library, r''' |
| 5200 class B<T> { | 5267 class B<T> { |
| 5201 const B(); | 5268 const B(); |
| 5202 } | 5269 } |
| 5270 class C<T> { |
| 5271 void foo([B<T> b = const |
| 5272 B/*location: test.dart;B*/< |
| 5273 T/*location: test.dart;C;T*/>()]) {} |
| 5274 } |
| 5275 '''); |
| 5276 } else { |
| 5277 checkElementText(library, r''' |
| 5278 class B<T> { |
| 5279 const B(); |
| 5280 } |
| 5203 class C<T> { | 5281 class C<T> { |
| 5204 void foo([B<T> b = const | 5282 void foo([B<T> b = const |
| 5205 B/*location: test.dart;B*/()]) {} | 5283 B/*location: test.dart;B*/()]) {} |
| 5206 } | 5284 } |
| 5207 '''); | 5285 '''); |
| 5286 } |
| 5208 } | 5287 } |
| 5209 | 5288 |
| 5210 test_enum_documented() async { | 5289 test_enum_documented() async { |
| 5211 var library = await checkLibrary(''' | 5290 var library = await checkLibrary(''' |
| 5212 // Extra comment so doc comment offset != 0 | 5291 // Extra comment so doc comment offset != 0 |
| 5213 /** | 5292 /** |
| 5214 * Docs | 5293 * Docs |
| 5215 */ | 5294 */ |
| 5216 enum E { v }'''); | 5295 enum E { v }'''); |
| 5217 checkElementText(library, r''' | 5296 checkElementText(library, r''' |
| (...skipping 4756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9974 fail('Unexpectedly tried to get unlinked summary for $uri'); | 10053 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 9975 } | 10054 } |
| 9976 return serializedUnit; | 10055 return serializedUnit; |
| 9977 } | 10056 } |
| 9978 | 10057 |
| 9979 @override | 10058 @override |
| 9980 bool hasLibrarySummary(String uri) { | 10059 bool hasLibrarySummary(String uri) { |
| 9981 return true; | 10060 return true; |
| 9982 } | 10061 } |
| 9983 } | 10062 } |
| OLD | NEW |