[svn] r7369: nemerle/trunk/ncc: testsuite/negative/genspec3.n
typing/MType.n
nazgul
svnadmin at nemerle.org
Thu Feb 1 23:08:01 CET 2007
Log:
Fix ForAll2 usage
Author: nazgul
Date: Thu Feb 1 23:07:59 2007
New Revision: 7369
Modified:
nemerle/trunk/ncc/testsuite/negative/genspec3.n
nemerle/trunk/ncc/typing/MType.n
Modified: nemerle/trunk/ncc/testsuite/negative/genspec3.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/negative/genspec3.n (original)
+++ nemerle/trunk/ncc/testsuite/negative/genspec3.n Thu Feb 1 23:07:59 2007
@@ -3,5 +3,19 @@
public this (_ : int) { }
}
+namespace System {
+ public class Int32[T] {
+
+ }
+}
+
+
+module Bug868 {
+ foo () : void {
+ _ = int.[int]() // E: expected int, got System.Int32\[
+ }
+}
+
+
def t' = A.[int] (); // E: A..ctor doesn't take generic parameters
Modified: nemerle/trunk/ncc/typing/MType.n
==============================================================================
--- nemerle/trunk/ncc/typing/MType.n (original)
+++ nemerle/trunk/ncc/typing/MType.n Thu Feb 1 23:07:59 2007
@@ -196,6 +196,15 @@
}
#endregion
+ private pairWiseUnify (args1 : list [TyVar], args2 : list [TyVar]) : bool
+ {
+ | (x :: xs, y :: ys) =>
+ // do unify AFTER check of rest of list, so we can control that lengths match
+ pairWiseUnify (xs, ys) && x.Unify (y)
+ | ([], []) => true
+ | _ => false
+ }
+
#region Unification stuff
/** Check for type equality, taking intersection types
@@ -207,11 +216,8 @@
assert (!t.IsSeparated);
match ((this, t)) {
- | (Class (tc1, args1), Class (tc2, args2))
- when tc1.Equals (tc2) =>
- List.ForAll2 (args1, args2, fun (t1 : TyVar, t2 : TyVar) {
- t1.Unify (t2)
- })
+ | (Class (tc1, args1), Class (tc2, args2)) when tc1.Equals (tc2) =>
+ pairWiseUnify (args1, args2)
| (Intersection (l1), Intersection (l2))
when List.Length (l1) == List.Length (l2) =>
@@ -232,9 +238,7 @@
| (Fun (f1, t1), Fun (f2, t2)) =>
f1.Unify (f2) && t1.Unify (t2)
- | (Tuple (l1), Tuple (l2))
- when List.Length (l1) == List.Length (l2) =>
- List.ForAll2 (l1, l2, fun (x : TyVar, y : TyVar) { x.Unify (y) })
+ | (Tuple (l1), Tuple (l2)) => pairWiseUnify (l1, l2)
| (Array (t1, rank1), Array (t2, rank2)) when rank1 == rank2 =>
t1.Unify (t2)
More information about the svn
mailing list