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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_types.dart

Issue 21065002: Treat ambiguous types as malformed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Status updated. Created 7 years, 5 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
Index: sdk/lib/_internal/compiler/implementation/dart_types.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_types.dart b/sdk/lib/_internal/compiler/implementation/dart_types.dart
index a3e0821fa214fd7c6da7b96d7ce2cff181d9dc6e..f49028849b7759bee049eb9f94cc9defad44314b 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart
@@ -86,21 +86,6 @@ abstract class DartType {
* by the user.
*/
DartType get userProvidedBadType => null;
-
- /// Returns [:true:] if this type contains an ambiguous type.
- bool get containsAmbiguousTypes {
- return !forEachAmbiguousType((_) => false);
- }
-
- /**
- * Calls [f] with each [AmbiguousType] within this type.
- *
- * If [f] returns [: false :], the traversal stops prematurely.
- *
- * [forEachAmbiguousType] returns [: false :] if the traversal was stopped
- * prematurely.
- */
- bool forEachAmbiguousType(bool f(AmbiguousType type)) => true;
/// Is [: true :] if this type has no explict type arguments.
bool get isRaw => true;
@@ -364,14 +349,6 @@ class MalformedType extends DartType {
}
}
-class AmbiguousType extends MalformedType {
- AmbiguousType(ErroneousElement element,
- [Link<DartType> typeArguments = null])
- : super(element, null, typeArguments);
-
- bool forEachAmbiguousType(bool f(AmbiguousType type)) => f(this);
-}
-
abstract class GenericType extends DartType {
final Link<DartType> typeArguments;
@@ -401,15 +378,6 @@ abstract class GenericType extends DartType {
return this;
}
- bool forEachAmbiguousType(bool f(AmbiguousType type)) {
- for (DartType typeArgument in typeArguments) {
- if (!typeArgument.forEachAmbiguousType(f)) {
- return false;
- }
- }
- return true;
- }
-
TypeVariableType get typeVariableOccurrence {
return _findTypeVariableOccurrence(typeArguments);
}
@@ -686,28 +654,6 @@ class FunctionType extends DartType {
return this;
}
- bool forEachAmbiguousType(bool f(AmbiguousType type)) {
- if (!returnType.forEachAmbiguousType(f)) {
- return false;
- }
- for (DartType parameterType in parameterTypes) {
- if (!parameterType.forEachAmbiguousType(f)) {
- return false;
- }
- }
- for (DartType parameterType in optionalParameterTypes) {
- if (!parameterType.forEachAmbiguousType(f)) {
- return false;
- }
- }
- for (DartType parameterType in namedParameterTypes) {
- if (!parameterType.forEachAmbiguousType(f)) {
- return false;
- }
- }
- return true;
- }
-
DartType unalias(Compiler compiler) => this;
DartType get typeVariableOccurrence {
@@ -1239,23 +1185,6 @@ class Types {
}
/**
- * Combine error messages in a type containing ambiguous types to a single
- * message string.
- */
- static String fetchReasonsFromAmbiguousType(DartType type) {
- // TODO(johnniwinther): Figure out how to produce good error message in face
- // of multiple errors, and how to ensure non-localized error messages.
- var reasons = new List<String>();
- type.forEachAmbiguousType((AmbiguousType ambiguousType) {
- ErroneousElement error = ambiguousType.element;
- Message message = error.messageKind.message(error.messageArguments);
- reasons.add(message.toString());
- return true;
- });
- return reasons.join(', ');
- }
-
- /**
* Returns the [ClassElement] which declares the type variables occurring in
* [type], or [:null:] if [type] does not contain type variables.
*/
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/elements.dart » ('j') | tests/co19/co19-dart2js.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698