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

Unified Diff: lib/src/checker/rules.dart

Issue 1303913003: Fixes #287 and other failures statically checking SDK tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Cleanup Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/checker/resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/checker/rules.dart
diff --git a/lib/src/checker/rules.dart b/lib/src/checker/rules.dart
index 047f85435411ab7dfd7a32c4fbe24203f89d24df..0877baba994ff17d0b09256b1ddfae24e087252d 100644
--- a/lib/src/checker/rules.dart
+++ b/lib/src/checker/rules.dart
@@ -264,7 +264,8 @@ class RestrictedRules extends TypeRules {
return true;
}
- throw new StateError("Unexpected type");
+ // We should not see any other type aside from malformed code.
+ return false;
}
/// Check that f1 is a subtype of f2. [ignoreReturn] is used in the DDC
@@ -407,6 +408,10 @@ class RestrictedRules extends TypeRules {
return isSubTypeOf(bound, t2);
}
+ if (t2 is TypeParameterType) {
+ return false;
+ }
+
if (t2.isDartCoreFunction) {
if (t1 is FunctionType) return true;
if (t1.element is ClassElement) {
@@ -513,6 +518,10 @@ class RestrictedRules extends TypeRules {
}
DartType elementType(Element e) {
+ if (e == null) {
+ // Malformed code - just return dynamic.
+ return provider.dynamicType;
+ }
return (e as dynamic).type;
}
@@ -704,6 +713,7 @@ class DownwardsInference {
// Check that we were not passed any type arguments
if (classTypeName.typeArguments != null) return false;
// Infer type arguments
+ if (t is! InterfaceType) return false;
var targs = _matchTypes(type, t);
if (targs == null) return false;
if (e.staticElement == null) return false;
« no previous file with comments | « lib/src/checker/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698