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

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

Issue 13261008: Check for cyclic reference in typedefs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 3 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 | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/warnings.dart
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 93a1a04519898ba330aa159e9f3eae78e42aa10c..fe0c108f1e311faa46c1f8aca536736e06b98001 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -544,6 +544,32 @@ main() {
static const MessageKind CYCLIC_TYPE_VARIABLE = const MessageKind(
'Warning: Type variable "#{typeVariableName}" is a supertype of itself.');
+ static const CYCLIC_TYPEDEF = const MessageKind(
+ "Error: A typedef can't refer to itself.",
+ howToFix: "Try removing all references to '#{typedefName}' "
+ "in the definition of '#{typedefName}'.",
+ examples: const ["""
+typedef F F(); // The return type 'F' is a self-reference.
+main() { F f = null; }"""]);
+
+ static const CYCLIC_TYPEDEF_ONE = const MessageKind(
+ "Error: A typedef can't refer to itself through another typedef.",
+ howToFix: "Try removing all references to "
+ "'#{otherTypedefName}' in the definition of '#{typedefName}'.",
+ examples: const ["""
+typedef G F(); // The return type 'G' is a self-reference through typedef 'G'.
+typedef F G(); // The return type 'F' is a self-reference through typedef 'F'.
+main() { F f = null; }""",
+"""
+typedef G F(); // The return type 'G' creates a self-reference.
+typedef H G(); // The return type 'H' creates a self-reference.
+typedef H(F f); // The argument type 'F' creates a self-reference.
+main() { F f = null; }"""]);
+
+ static const CYCLIC_TYPEDEF_TYPEVAR = const MessageKind(
+ "Internal Error: Recursive type variable bounds are not "
+ "supported on typedefs.");
+
static const MessageKind CLASS_NAME_EXPECTED = const MessageKind(
'Error: Class name expected.');
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698