[svn] r7434: vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n

VladD2 svnadmin at nemerle.org
Fri Feb 16 03:08:39 CET 2007


Log:
Prevent crash on cyclic type.

Author: VladD2
Date: Fri Feb 16 03:08:37 2007
New Revision: 7434

Modified:
   vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n

Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	(original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Utils.n	Fri Feb 16 03:08:37 2007
@@ -197,13 +197,19 @@
         name
           
       | TyVarRef as r => r.tyvar.Name
-      | Fun as f => GetNameFromType (f.from.Fix ()) 
-          + " -> " + GetNameFromType (f.to.Fix ())
+      | Fun as f =>
+        def fromTy = f.from.Fix();
+        def toTy   = f.to.Fix();
+        if (fromTy : object == t || toTy : object == t)
+          "<error: cyclic type found>"
+        else
+          GetNameFromType(fromTy) + " -> " + GetNameFromType(toTy)
+
       | Tuple as tuple => tuple.args.Map(ToDisplayString).ToString(" * ")
-      | Array as a => "array[" + GetNameFromType (a.t.Fix ()) + "]"
+      | Array as a => "array[" + GetNameFromType(a.t.Fix()) + "]"
       | Void => "void"
-      | Ref as rf => "ref " + GetNameFromType (rf.t.Fix ())
-      | Out as ut => "out " + GetNameFromType (ut.t.Fix ())
+      | Ref as rf => "ref " + GetNameFromType (rf.t.Fix())
+      | Out as ut => "out " + GetNameFromType (ut.t.Fix())
       | Intersection(types) => $"one of $types"
     }
 



More information about the svn mailing list