[svn] r6213: nemerle/trunk/ncc:
testsuite/negative/poly-local-deep-fix.n
testsuite/positive/polymorphic-re...
malekith
svnadmin at nemerle.org
Tue May 2 19:28:12 CEST 2006
Log:
Do a deep-fix on polymorphic local function types. Resolves #657.
Author: malekith
Date: Tue May 2 19:28:10 2006
New Revision: 6213
Added:
nemerle/trunk/ncc/testsuite/negative/poly-local-deep-fix.n
Modified:
nemerle/trunk/ncc/testsuite/positive/polymorphic-recursion.n
nemerle/trunk/ncc/typing/Typer.n
Added: nemerle/trunk/ncc/testsuite/negative/poly-local-deep-fix.n
==============================================================================
--- (empty file)
+++ nemerle/trunk/ncc/testsuite/negative/poly-local-deep-fix.n Tue May 2 19:28:10 2006
@@ -0,0 +1,10 @@
+// bug 657
+def Sort[T](lst)
+{
+ | head :: tail => [head] + Sort (tail) // E: subtype
+ | [] => [] : list[T]
+}
+
+_ = Sort([1]);
+
+
Modified: nemerle/trunk/ncc/testsuite/positive/polymorphic-recursion.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/polymorphic-recursion.n (original)
+++ nemerle/trunk/ncc/testsuite/positive/polymorphic-recursion.n Tue May 2 19:28:10 2006
@@ -101,7 +101,7 @@
def zip4 ['a, 'b, 'c]
(
pl : list [list ['a] * list ['b] * list ['c] * string]
- )
+ ) : list ['a] * list ['b] * list ['c] * string
{
match (pl) {
| [] => ([], [], [], "")
Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n (original)
+++ nemerle/trunk/ncc/typing/Typer.n Tue May 2 19:28:10 2006
@@ -2374,10 +2374,11 @@
// XXX this fixes entire type, but we cannot do any better
// I guess
(sub, typarms) = Subst.Fresh (fun_header.typarms);
- sub.Apply (local.Type.Fix ())
+ sub.Apply (local.Type.DeepFix ())
}
_ = Expect (expected, fnty, "local function reference");
+ //Message.Debug ($"local fun ref: $typarms $fnty");
result = TExpr.LocalFunRef (expected, local, typarms);
// for block of type 'a, block exit is forall 'b. 'a -> 'b
More information about the svn
mailing list