[svn] r6855: nemerle/trunk/ncc: generation/Typer3.n
testsuite/positive/tuples.n
malekith
svnadmin at nemerle.org
Wed Nov 8 22:50:15 CET 2006
Log:
Correctly process self-tail-call parameters in T3. Resolves #782.
Author: malekith
Date: Wed Nov 8 22:50:13 2006
New Revision: 6855
Modified:
nemerle/trunk/ncc/generation/Typer3.n
nemerle/trunk/ncc/testsuite/positive/tuples.n
Modified: nemerle/trunk/ncc/generation/Typer3.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer3.n (original)
+++ nemerle/trunk/ncc/generation/Typer3.n Wed Nov 8 22:50:13 2006
@@ -1689,13 +1689,15 @@
| TExpr.SelfTailCall (parms) =>
def clo_len = ClosureParmCount (current_local_fun);
+ foreach (p in parms)
+ p.expr = Walk (p.expr);
def (parms, ini) = TupleParms (current_local_fun, parms, clo_len);
def assigns =
List.Map2 (parms, current_local_fun.parms.ChopFirstN (clo_len),
fun (parm, fp) {
assert (parm.kind == ParmKind.Normal);
def ty = fp.ty;
- def conv = CheckedConversion (Walk (parm.expr), ty);
+ def conv = CheckedConversion (parm.expr, ty);
(fp.decl, conv)
});
Modified: nemerle/trunk/ncc/testsuite/positive/tuples.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/tuples.n (original)
+++ nemerle/trunk/ncc/testsuite/positive/tuples.n Wed Nov 8 22:50:13 2006
@@ -39,6 +39,12 @@
}
}
+[Record]
+class Results{ public y : int }
+
+[Record]
+class Input{ public x : int }
+
module M {
@@ -69,6 +75,36 @@
PairParameters.Run ();
TupleIdx.Go ();
+
+// bug #782
+def AskUser( y : Results ) : Input
+{
+ if(y == null) Input(5) else null
+}
+
+def DoMath( x : Input ) : Results
+{
+ Results(x.x*x.x)
+}
+
+def Calculator() : Results
+{
+ def AskFunc(results)
+ {
+ ( AskUser( results ), results )
+ }
+
+ def Calc(input,results)
+ {
+ | (null,_) => results
+ | _ => Calc( AskFunc( DoMath( input ) ) )
+ }
+
+ Calc( AskFunc(null) )
+}
+
+System.Console.WriteLine(Calculator());
+
}
}
@@ -104,6 +140,7 @@
(10, True)
foobar 42 Infinity
foobar 42 Infinity
+Results
END-OUTPUT
*/
More information about the svn
mailing list