[Nice-commit] Nice/src/bossa/syntax Pattern.java,1.83,1.84 Monotype.java,1.34,1.35 ClassDefinition.j
Brought to you by:
bonniot
From: Daniel B. <bo...@us...> - 2004-06-16 10:01:35
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32734/src/bossa/syntax Modified Files: Pattern.java Monotype.java ClassDefinition.java Log Message: Handle type variables that are used simultaneously with and without nullness markers (implements RFE #738496). Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** Pattern.java 9 Jun 2004 17:02:09 -0000 1.83 --- Pattern.java 16 Jun 2004 10:00:37 -0000 1.84 *************** *** 19,22 **** --- 19,23 ---- import mlsub.typing.Monotype; import mlsub.typing.MonotypeConstructor; + import mlsub.typing.Polytype; import mlsub.typing.Typing; import mlsub.typing.TypingEx; *************** *** 160,165 **** return; ! constraint = def.getResolvedConstraint(); ! patternType = new MonotypeConstructor(tc, def.getTypeParameters()); } --- 161,170 ---- return; ! Polytype classType = def.getConstrainedType(); ! if (classType != null) ! { ! constraint = classType.getConstraint(); ! patternType = classType.getMonotype(); ! } } Index: ClassDefinition.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/ClassDefinition.java,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** ClassDefinition.java 11 Jun 2004 15:53:35 -0000 1.105 --- ClassDefinition.java 16 Jun 2004 10:00:38 -0000 1.106 *************** *** 442,445 **** --- 442,462 ---- } + /** + Return the type representing a constrained instance of this class, + or null if this class has no constraint on its type parameters. + */ + mlsub.typing.Polytype getConstrainedType() + { + mlsub.typing.Constraint cst = getResolvedConstraint(); + + if (cst == null) + return null; + + mlsub.typing.Polytype res = new mlsub.typing.Polytype + (cst, lowlevelMonotype()); + + return res.cloneType(); + } + public abstract boolean isConcrete(); Index: Monotype.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Monotype.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Monotype.java 25 Feb 2004 11:23:29 -0000 1.34 --- Monotype.java 16 Jun 2004 10:00:37 -0000 1.35 *************** *** 109,114 **** { case none: return raw; ! case maybe: return maybe(raw); ! case sure: return sure(raw); case absent: if (raw instanceof MonotypeVar) --- 109,114 ---- { case none: return raw; ! case maybe: return sourceMaybe(raw); ! case sure: return sourceSure(raw); case absent: if (raw instanceof MonotypeVar) *************** *** 281,284 **** --- 281,294 ---- ****************************************************************/ + /** + Return a maybe type based on the raw type of the argument + if the argument is a full type. + */ + static mlsub.typing.Monotype sourceMaybe(mlsub.typing.Monotype type) + { + mlsub.typing.Monotype raw = nice.tools.typing.Types.rawType(type); + return maybe(raw); + } + public static mlsub.typing.Monotype maybe(mlsub.typing.Monotype type) { *************** *** 287,290 **** --- 297,310 ---- } + /** + Return a sure type based on the raw type of the argument + if the argument is a full type. + */ + static mlsub.typing.Monotype sourceSure(mlsub.typing.Monotype type) + { + mlsub.typing.Monotype raw = nice.tools.typing.Types.rawType(type); + return sure(raw); + } + public static mlsub.typing.Monotype sure(mlsub.typing.Monotype type) { |