Nice/src/mlsub/typing Variance.java,1.17,1.18 NullnessKind.java,1.4,1.5 MonotypeVar.java,1.18,1.19
Daniel Bonniot <[email protected]> Wed, 25 May 2005 23:23:00 +0000
| Newsgroups | gmane.comp.lang.nice.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/nice/Nice/src/mlsub/typing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2569/src/mlsub/typing
Modified Files:
Variance.java NullnessKind.java MonotypeVar.java
Log Message:
Fix subtyping of wildcards. Should be safe, but overrestrictive, since
a wildcard is now not a subtype of itself.
Index: Variance.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/Variance.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Variance.java 30 Jul 2004 19:08:45 -0000 1.17
--- Variance.java 25 May 2005 23:22:57 -0000 1.18
***************
*** 252,261 ****
case INVARIANT:
if (tp2[i].isUnknown())
! return;
if (tp1[i].isUnknown())
{
tp2[i].setUnknown();
! return;
}
--- 252,261 ----
case INVARIANT:
if (tp2[i].isUnknown())
! continue;
if (tp1[i].isUnknown())
{
tp2[i].setUnknown();
! continue;
}
Index: MonotypeVar.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/MonotypeVar.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** MonotypeVar.java 30 Jul 2004 19:08:45 -0000 1.18
--- MonotypeVar.java 25 May 2005 23:22:57 -0000 1.19
***************
*** 208,212 ****
throws mlsub.typing.lowlevel.Unsatisfiable
{
! super.setUnknown();
this.unknown = true;
}
--- 208,216 ----
throws mlsub.typing.lowlevel.Unsatisfiable
{
! if (equivalent != null)
! equivalent.setUnknown();
!
! equivalent = UnknownMonotype.instance;
! persistentKind = null;
this.unknown = true;
}
***************
*** 278,281 ****
--- 282,287 ----
if (equivalent != null)
return equivalent.canonify();
+ if (isUnknown())
+ return UnknownMonotype.instance;
// A type var with kind TopKind is equivalent to Top.
else if (kind == TopMonotype.TopKind.instance)
Index: NullnessKind.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/NullnessKind.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** NullnessKind.java 16 Jun 2004 10:00:36 -0000 1.4
--- NullnessKind.java 25 May 2005 23:22:57 -0000 1.5
***************
*** 85,105 ****
throws Unsatisfiable
{
! MonotypeConstructor m1 = mc(e1), m2 = mc(e2);
! Engine.leq(m1.getTC(), m2.getTC());
! Engine.leq(m1.getTP()[0], m2.getTP()[0]);
}
! private MonotypeConstructor mc(Element e)
{
try
{
! return (MonotypeConstructor) ((Monotype) e).equivalent();
}
catch(ClassCastException ex)
{
throw new InternalError
! (e + " was expected to be a monotype constructor, " +
! " it's a " + e.getClass());
}
}
--- 85,111 ----
throws Unsatisfiable
{
! Monotype m1 = (Monotype) e1;
! Monotype m2 = (Monotype) e2;
!
! if (m1.isUnknown() || m2.isUnknown())
! throw LowlevelUnsatisfiable.instance;
!
! MonotypeConstructor mc1 = mc(m1), mc2 = mc(m2);
! Engine.leq(mc1.getTC(), mc2.getTC());
! Engine.leq(mc1.getTP()[0], mc2.getTP()[0]);
}
! private MonotypeConstructor mc(Monotype m)
{
try
{
! return (MonotypeConstructor) m.equivalent();
}
catch(ClassCastException ex)
{
throw new InternalError
! (m + " was expected to be a monotype constructor, " +
! " it's a " + m.getClass());
}
}
-------------------------------------------------------
SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate
online with coworkers and clients while avoiding the high cost of travel and
communications. There is no equipment to buy and you can meet as often as
you want. Try it free.http://ads.osdn.com/?ad_id=7402&alloc_id=16135&op=click