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

Side by Side Diff: pkg/analyzer/lib/src/task/strong/info.dart

Issue 1780783002: Don't report redundant type errors in strong mode. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Stop type propagation in test. Created 4 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 /// Defines static information collected by the type checker and used later by 5 /// Defines static information collected by the type checker and used later by
6 /// emitters to generate code. 6 /// emitters to generate code.
7 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be 7 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be
8 // refactored to fit into analyzer. 8 // refactored to fit into analyzer.
9 library analyzer.src.task.strong.info; 9 library analyzer.src.task.strong.info;
10 10
(...skipping 16 matching lines...) Expand all
27 String get name => 'STRONG_MODE_ASSIGNMENT_CAST'; 27 String get name => 'STRONG_MODE_ASSIGNMENT_CAST';
28 28
29 toErrorCode() => new HintCode(name, message); 29 toErrorCode() => new HintCode(name, message);
30 } 30 }
31 31
32 // Coercion which casts one type to another 32 // Coercion which casts one type to another
33 class Cast extends Coercion { 33 class Cast extends Coercion {
34 Cast(DartType fromType, DartType toType) : super(fromType, toType); 34 Cast(DartType fromType, DartType toType) : super(fromType, toType);
35 } 35 }
36 36
37
38 // TODO(rnystrom): Analyzer no longer produces or uses anything except Cast,
39 // so this should be eliminated once DDC no longer uses it.
37 // The abstract type of coercions mapping one type to another. 40 // The abstract type of coercions mapping one type to another.
38 // This class also exposes static builder functions which 41 // This class also exposes static builder functions which
39 // check for errors and reduce redundant coercions to the identity. 42 // check for errors and reduce redundant coercions to the identity.
40 abstract class Coercion { 43 abstract class Coercion {
41 final DartType fromType; 44 final DartType fromType;
42 final DartType toType; 45 final DartType toType;
43 Coercion(this.fromType, this.toType); 46 Coercion(this.fromType, this.toType);
44 static Coercion cast(DartType fromT, DartType toT) => new Cast(fromT, toT); 47 static Coercion cast(DartType fromT, DartType toT) => new Cast(fromT, toT);
45 static Coercion error() => new CoercionError(); 48 static Coercion error() => new CoercionError();
46 static Coercion identity(DartType type) => new Identity(type); 49 static Coercion identity(DartType type) => new Identity(type);
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 super(expression); 569 super(expression);
567 570
568 @override 571 @override
569 List<Object> get arguments => [node, baseType, expectedType]; 572 List<Object> get arguments => [node, baseType, expectedType];
570 @override 573 @override
571 String get message => 'Type check failed: {0} ({1}) is not of type {2}'; 574 String get message => 'Type check failed: {0} ({1}) is not of type {2}';
572 575
573 @override 576 @override
574 String get name => 'STRONG_MODE_STATIC_TYPE_ERROR'; 577 String get name => 'STRONG_MODE_STATIC_TYPE_ERROR';
575 } 578 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | pkg/analyzer/test/source/error_processor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698