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

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_common.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) 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 4056 matching lines...) Expand 10 before | Expand all | Expand 10 after
4067 } 4067 }
4068 4068
4069 test_const_length_ofStringLiteral() { 4069 test_const_length_ofStringLiteral() {
4070 var library = checkLibrary(r''' 4070 var library = checkLibrary(r'''
4071 const v = 'abc'.length; 4071 const v = 'abc'.length;
4072 '''); 4072 ''');
4073 if (isStrongMode) { 4073 if (isStrongMode) {
4074 checkElementText( 4074 checkElementText(
4075 library, 4075 library,
4076 r''' 4076 r'''
4077 const int v = 'abc'. 4077 const dynamic v = 'abc'.
4078 length/*location: dart:core;String;length?*/; 4078 length/*location: dart:core;String;length?*/;
4079 '''); 4079 ''');
4080 } else { 4080 } else {
4081 checkElementText( 4081 checkElementText(
4082 library, 4082 library,
4083 r''' 4083 r'''
4084 const dynamic v = 'abc'. 4084 const dynamic v = 'abc'.
4085 length/*location: dart:core;String;length?*/; 4085 length/*location: dart:core;String;length?*/;
4086 '''); 4086 ''');
4087 } 4087 }
4088 } 4088 }
4089 4089
4090 test_const_length_ofTopLevelVariable() { 4090 test_const_length_ofTopLevelVariable() {
4091 var library = checkLibrary(r''' 4091 var library = checkLibrary(r'''
4092 const String S = 'abc'; 4092 const String S = 'abc';
4093 const v = S.length; 4093 const v = S.length;
4094 '''); 4094 ''');
4095 if (isStrongMode) { 4095 if (isStrongMode) {
4096 checkElementText( 4096 checkElementText(
4097 library, 4097 library,
4098 r''' 4098 r'''
4099 const String S = 'abc'; 4099 const String S = 'abc';
4100 const int v = 4100 const dynamic v =
4101 S/*location: test.dart;S?*/. 4101 S/*location: test.dart;S?*/.
4102 length/*location: dart:core;String;length?*/; 4102 length/*location: dart:core;String;length?*/;
4103 '''); 4103 ''');
4104 } else { 4104 } else {
4105 checkElementText( 4105 checkElementText(
4106 library, 4106 library,
4107 r''' 4107 r'''
4108 const String S = 'abc'; 4108 const String S = 'abc';
4109 const dynamic v = 4109 const dynamic v =
4110 S/*location: test.dart;S?*/. 4110 S/*location: test.dart;S?*/.
(...skipping 10 matching lines...) Expand all
4121 '''); 4121 ''');
4122 var library = checkLibrary(r''' 4122 var library = checkLibrary(r'''
4123 import 'a.dart'; 4123 import 'a.dart';
4124 const v = S.length; 4124 const v = S.length;
4125 '''); 4125 ''');
4126 if (isStrongMode) { 4126 if (isStrongMode) {
4127 checkElementText( 4127 checkElementText(
4128 library, 4128 library,
4129 r''' 4129 r'''
4130 import 'a.dart'; 4130 import 'a.dart';
4131 const int v = 4131 const dynamic v =
4132 S/*location: a.dart;S?*/. 4132 S/*location: a.dart;S?*/.
4133 length/*location: dart:core;String;length?*/; 4133 length/*location: dart:core;String;length?*/;
4134 '''); 4134 ''');
4135 } else { 4135 } else {
4136 checkElementText( 4136 checkElementText(
4137 library, 4137 library,
4138 r''' 4138 r'''
4139 import 'a.dart'; 4139 import 'a.dart';
4140 const dynamic v = 4140 const dynamic v =
4141 S/*location: a.dart;S?*/. 4141 S/*location: a.dart;S?*/.
(...skipping 10 matching lines...) Expand all
4152 '''); 4152 ''');
4153 var library = checkLibrary(r''' 4153 var library = checkLibrary(r'''
4154 import 'a.dart' as p; 4154 import 'a.dart' as p;
4155 const v = p.S.length; 4155 const v = p.S.length;
4156 '''); 4156 ''');
4157 if (isStrongMode) { 4157 if (isStrongMode) {
4158 checkElementText( 4158 checkElementText(
4159 library, 4159 library,
4160 r''' 4160 r'''
4161 import 'a.dart' as p; 4161 import 'a.dart' as p;
4162 const int v = 4162 const dynamic v =
4163 p/*location: null*/. 4163 p/*location: null*/.
4164 S/*location: a.dart;S?*/. 4164 S/*location: a.dart;S?*/.
4165 length/*location: dart:core;String;length?*/; 4165 length/*location: dart:core;String;length?*/;
4166 '''); 4166 ''');
4167 } else { 4167 } else {
4168 checkElementText( 4168 checkElementText(
4169 library, 4169 library,
4170 r''' 4170 r'''
4171 import 'a.dart' as p; 4171 import 'a.dart' as p;
4172 const dynamic v = 4172 const dynamic v =
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
5456 r''' 5456 r'''
5457 enum E { 5457 enum E {
5458 final int index; 5458 final int index;
5459 static const List<E> values; 5459 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 int 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 final int index;
5474 static const List<E> values; 5474 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;
(...skipping 9504 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

Powered by Google App Engine
This is Rietveld 408576698