[svn] r7059: nemerle/trunk/ncc: hierarchy/TypeBuilder.n
testsuite/positive/names-lookup.n
malekith
svnadmin at nemerle.org
Wed Dec 6 14:41:24 CET 2006
Log:
Use correct type variables in subtyping declarations of types nested in generic types. Fixes one case from #712.
Author: malekith
Date: Wed Dec 6 14:41:23 2006
New Revision: 7059
Modified:
nemerle/trunk/ncc/hierarchy/TypeBuilder.n
nemerle/trunk/ncc/testsuite/positive/names-lookup.n
Modified: nemerle/trunk/ncc/hierarchy/TypeBuilder.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeBuilder.n (original)
+++ nemerle/trunk/ncc/hierarchy/TypeBuilder.n Wed Dec 6 14:41:23 2006
@@ -1079,11 +1079,25 @@
Util.ice ("this top declaration shouldn't survive to typing")
};
+ def nested_tyvars_subst =
+ if (enclosing_type == null || enclosing_type.typarms is []) null
+ else {
+ def sub = Subst (Manager);
+ def par_typarms = enclosing_type.typarms;
+ List.Iter2 (typarms.FirstN (par_typarms.Length), par_typarms, fun (t, pt) {
+ sub.Add (pt, MType.TyVarRef (t))
+ });
+ sub
+ }
+
def bind_to_class (t : PT.PExpr) {
match (this.tenv.MonoBind (this.GlobalEnv,
enclosing_type,
t, check_parms = false)) {
- | MType.Class as tcl => tcl
+ | MType.Class as tcl =>
+ if (nested_tyvars_subst == null) tcl
+ else nested_tyvars_subst.Apply (tcl) :> MType.Class
+
| _ => Message.FatalError (t.Location, "derived or implemented type must be a class");
};
}
@@ -1107,7 +1121,7 @@
}
else
this.parent_type = hd';
- this.t_implements = this.t_implements + List.RevMap (tl, bind_to_class)
+ this.t_implements = this.t_implements + List.RevMap (tl, bind_to_class);
| _ => this.parent_type = null
};
Modified: nemerle/trunk/ncc/testsuite/positive/names-lookup.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/names-lookup.n (original)
+++ nemerle/trunk/ncc/testsuite/positive/names-lookup.n Wed Dec 6 14:41:23 2006
@@ -231,6 +231,15 @@
using System.Text;
}
+namespace Bug712a {
+public class A['a] {
+ class B : System.IComparable[B] {
+ public CompareTo (_ : B) : int {
+ 0
+ }
+ }
+}
+}
/*
More information about the svn
mailing list