[svn] r6028: nemerle/trunk/ncc: testsuite/positive/this-as-type.n typing/TyVarEnv.n

malekith svnadmin at nemerle.org
Wed Dec 21 12:06:19 CET 2005


Log:
Allow 'this' to be used as the full type of the current class.

Author: malekith
Date: Wed Dec 21 12:06:18 2005
New Revision: 6028

Added:
   nemerle/trunk/ncc/testsuite/positive/this-as-type.n
Modified:
   nemerle/trunk/ncc/typing/TyVarEnv.n

Added: nemerle/trunk/ncc/testsuite/positive/this-as-type.n
==============================================================================
--- (empty file)
+++ nemerle/trunk/ncc/testsuite/positive/this-as-type.n	Wed Dec 21 12:06:18 2005
@@ -0,0 +1,17 @@
+class A {
+  public foo (x : this) : this
+  {
+    x
+  }
+}
+class B['a] {
+  public foo (x : this) : this
+  {
+    x
+  }
+}
+
+def a = A ();
+_ = a.foo (a) : A;
+def b = B.[int]();
+_ = b.foo(b) : B[int];

Modified: nemerle/trunk/ncc/typing/TyVarEnv.n
==============================================================================
--- nemerle/trunk/ncc/typing/TyVarEnv.n	(original)
+++ nemerle/trunk/ncc/typing/TyVarEnv.n	Wed Dec 21 12:06:18 2005
@@ -269,6 +269,9 @@
           | <[ @* (.. $args) ]> =>
             MType.Tuple (List.Map (args, fun (t) { f2 (t, allow_ref) }))
             
+          | <[ this ]> =>
+            curtc.GetMemType ()
+            
           | PExpr.Void => InternalType.Void
 
           | PExpr.Indexer



More information about the svn mailing list