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

Side by Side Diff: lib/src/checker/rules.dart

Issue 1165303002: remove covariant generics option (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | lib/src/options.dart » ('j') | 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) 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 dev_compiler.src.checker.rules; 5 library dev_compiler.src.checker.rules;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/resolver.dart'; 9 import 'package:analyzer/src/generated/resolver.dart';
10 10
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 List<DartType> tArgs1 = i1.typeArguments; 290 List<DartType> tArgs1 = i1.typeArguments;
291 List<DartType> tArgs2 = i2.typeArguments; 291 List<DartType> tArgs2 = i2.typeArguments;
292 292
293 // TODO(leafp): Verify that this is always true 293 // TODO(leafp): Verify that this is always true
294 // Do raw types get filled in? 294 // Do raw types get filled in?
295 assert(tArgs1.length == tArgs2.length); 295 assert(tArgs1.length == tArgs2.length);
296 296
297 for (int i = 0; i < tArgs1.length; i++) { 297 for (int i = 0; i < tArgs1.length; i++) {
298 DartType t1 = tArgs1[i]; 298 DartType t1 = tArgs1[i];
299 DartType t2 = tArgs2[i]; 299 DartType t2 = tArgs2[i];
300 if (options.covariantGenerics) { 300 if (!isSubTypeOf(t1, t2)) return false;
301 if (!isSubTypeOf(t1, t2)) return false;
302 } else {
303 if ((t1 != t2) && !t2.isDynamic) return false;
304 }
305 } 301 }
306 return true; 302 return true;
307 } 303 }
308 304
309 if (i2.isDartCoreFunction) { 305 if (i2.isDartCoreFunction) {
310 if (i1.element.getMethod("call") != null) return true; 306 if (i1.element.getMethod("call") != null) return true;
311 } 307 }
312 308
313 if (i1 == provider.objectType) return false; 309 if (i1 == provider.objectType) return false;
314 310
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 var entries = e.entries; 782 var entries = e.entries;
787 bool inferEntry(MapLiteralEntry entry) { 783 bool inferEntry(MapLiteralEntry entry) {
788 return _inferExpression(entry.key, kType, errors) && 784 return _inferExpression(entry.key, kType, errors) &&
789 _inferExpression(entry.value, vType, errors); 785 _inferExpression(entry.value, vType, errors);
790 } 786 }
791 var b = entries.every(inferEntry); 787 var b = entries.every(inferEntry);
792 if (b) annotateMapLiteral(e, targs); 788 if (b) annotateMapLiteral(e, targs);
793 return b; 789 return b;
794 } 790 }
795 } 791 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698