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

Unified Diff: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java

Issue 11633024: Issue 3223. Don't report warning when call variable with not-function inferred type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
index fbeb242972265811a85b15711ee41f74dca8848d..743577d3be6f48ae53c49c01fb75b91f9e362cb1 100644
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -1016,8 +1016,8 @@ public class TypeAnalyzer implements DartCompilationPhase {
setVariableElementType(variable, mergedType, mergedTypeQuality);
}
}
-
- private boolean checkAssignable(DartNode node, Type t, Type s) {
+
+ private boolean isAssignable(Type t, Type s) {
t.getClass(); // Null check.
s.getClass(); // Null check.
// ignore inferred types, treat them as Dynamic
@@ -1026,15 +1026,22 @@ public class TypeAnalyzer implements DartCompilationPhase {
return true;
}
}
- // do check and report error
+ // do check
if (!types.isAssignable(t, s)) {
Brian Wilkerson 2012/12/19 21:23:40 I believe that 1029 - 1034 could be replaced by "r
scheglov 2012/12/20 00:59:44 Done.
+ return false;
+ }
+ // OK
+ return true;
+ }
+
+ private boolean checkAssignable(DartNode node, Type t, Type s) {
+ if (!isAssignable(t, s)) {
TypeErrorCode errorCode = TypeQuality.isInferred(t) || TypeQuality.isInferred(s)
? TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE_INFERRED
- : TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE;
+ : TypeErrorCode.TYPE_NOT_ASSIGNMENT_COMPATIBLE;
typeError(node, errorCode, s, t);
return false;
}
- // OK
return true;
}
@@ -2809,7 +2816,7 @@ public class TypeAnalyzer implements DartCompilationPhase {
case DYNAMIC:
return type;
default:
- if (types.isAssignable(functionType, type)) {
+ if (isAssignable(functionType, type)) {
// A subtype of interface Function.
return dynamicType;
} else if (name == null || currentClass == null) {
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698