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

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

Issue 2754423002: Fail inference when an instance field is referenced. (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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/src/dart/analysis/driver.dart'; 8 import 'package:analyzer/src/dart/analysis/driver.dart';
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; 9 import 'package:test_reflective_loader/test_reflective_loader.dart';
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 library, 86 library,
87 r''' 87 r'''
88 int vBitXor; 88 int vBitXor;
89 int vBitAnd; 89 int vBitAnd;
90 int vBitOr; 90 int vBitOr;
91 int vBitShiftLeft; 91 int vBitShiftLeft;
92 int vBitShiftRight; 92 int vBitShiftRight;
93 '''); 93 ''');
94 } 94 }
95 95
96 @failingTest
96 test_initializer_cascade() async { 97 test_initializer_cascade() async {
97 var library = await _encodeDecodeLibrary(r''' 98 var library = await _encodeDecodeLibrary(r'''
98 class A { 99 class A {
99 int a; 100 int a;
100 void m() {} 101 void m() {}
101 } 102 }
102 var vSetField = new A()..a = 1; 103 var vSetField = new A()..a = 1;
103 var vInvokeMethod = new A()..m(); 104 var vInvokeMethod = new A()..m();
104 var vBoth = new A()..a = 1..m(); 105 var vBoth = new A()..a = 1..m();
105 '''); 106 ''');
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 /** 868 /**
868 * A getter, setter or field which overrides/implements only a getter is 869 * A getter, setter or field which overrides/implements only a getter is
869 * inferred to have the type taken from the overridden getter result type. 870 * inferred to have the type taken from the overridden getter result type.
870 * 871 *
871 * Note that overriding a field is addressed via the implicit induced 872 * Note that overriding a field is addressed via the implicit induced
872 * getter/setter pair (or just getter in the case of a final field). 873 * getter/setter pair (or just getter in the case of a final field).
873 * 874 *
874 * A field with no annotated type that does not override anything has the 875 * A field with no annotated type that does not override anything has the
875 * type inferred from its initializer. 876 * type inferred from its initializer.
876 */ 877 */
877 @failingTest
878 test_instanceField_preferOverride() async { 878 test_instanceField_preferOverride() async {
879 var library = await _encodeDecodeLibrary(r''' 879 var library = await _encodeDecodeLibrary(r'''
880 abstract class A { 880 abstract class A {
881 num x; 881 num x;
882 var y = 2; 882 var y = 2;
883 } 883 }
884 class B implements A { 884 class B implements A {
885 var x = 1; 885 var x = 1;
886 var y = 2; 886 var y = 2;
887 var z = 3; 887 var z = 3;
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 1499
1500 Future<LibraryElement> _encodeDecodeLibrary(String text) async { 1500 Future<LibraryElement> _encodeDecodeLibrary(String text) async {
1501 String path = _p('/test.dart'); 1501 String path = _p('/test.dart');
1502 provider.newFile(path, text); 1502 provider.newFile(path, text);
1503 UnitElementResult result = await driver.getUnitElement(path); 1503 UnitElementResult result = await driver.getUnitElement(path);
1504 return result.element.library; 1504 return result.element.library;
1505 } 1505 }
1506 1506
1507 String _p(String path) => provider.convertPath(path); 1507 String _p(String path) => provider.convertPath(path);
1508 } 1508 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698