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

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

Issue 1878223002: Infer type of extract index expressions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 analyzer.test.src.summary.resynthesize_ast_test; 5 library analyzer.test.src.summary.resynthesize_ast_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/src/dart/element/element.dart'; 9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/generated/engine.dart' 10 import 'package:analyzer/src/generated/engine.dart'
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void test_downwardsInferenceYieldYieldStar() { 202 void test_downwardsInferenceYieldYieldStar() {
203 super.test_downwardsInferenceYieldYieldStar(); 203 super.test_downwardsInferenceYieldYieldStar();
204 } 204 }
205 205
206 @override 206 @override
207 @failingTest 207 @failingTest
208 void test_genericMethods_inferJSBuiltin() { 208 void test_genericMethods_inferJSBuiltin() {
209 super.test_genericMethods_inferJSBuiltin(); 209 super.test_genericMethods_inferJSBuiltin();
210 } 210 }
211 211
212 void test_infer_extractIndex_custom() {
213 var unit = checkFile('''
214 class A {
215 String operator [](_) => null;
216 }
217 var a = new A();
218 var b = a[0];
219 ''');
220 expect(unit.topLevelVariables[1].type.toString(), 'String');
221 }
222
223 void test_infer_extractIndex_fromList() {
224 var unit = checkFile('''
225 var a = <int>[1, 2, 3];
226 var b = a[0];
227 ''');
228 expect(unit.topLevelVariables[1].type.toString(), 'int');
229 }
230
231 void test_infer_extractIndex_fromMap() {
232 var unit = checkFile('''
233 var a = <int, double>{};
234 var b = a[0];
235 ''');
236 expect(unit.topLevelVariables[1].type.toString(), 'double');
237 }
238
212 void test_infer_extractProperty_getter() { 239 void test_infer_extractProperty_getter() {
213 checkFile(r''' 240 checkFile(r'''
214 var a = 1.isEven; 241 var a = 1.isEven;
215 var b = 2.isNaN; 242 var b = 2.isNaN;
216 var c = 3.foo; 243 var c = 3.foo;
217 var d = foo.bar; 244 var d = foo.bar;
218 '''); 245 ''');
219 } 246 }
220 247
221 void test_infer_extractProperty_method() { 248 void test_infer_extractProperty_method() {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 582 }
556 583
557 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource); 584 UnlinkedUnit definingUnit = _getUnlinkedUnit(librarySource);
558 LinkedLibraryBuilder linkedLibrary = 585 LinkedLibraryBuilder linkedLibrary =
559 prelink(definingUnit, getPart, getImport); 586 prelink(definingUnit, getPart, getImport);
560 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) { 587 linkedLibrary.dependencies.skip(1).forEach((LinkedDependency d) {
561 _serializeLibrary(resolveRelativeUri(d.uri)); 588 _serializeLibrary(resolveRelativeUri(d.uri));
562 }); 589 });
563 } 590 }
564 } 591 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698