logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

Nice/src/bossa/syntax niceclass.nice,1.9,1.10: msg#00088

lang.nice.cvs

Subject: Nice/src/bossa/syntax niceclass.nice,1.9,1.10

Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20732/src/bossa/syntax

Modified Files:
niceclass.nice
Log Message:
Correctly handle native parent constructors retyped with type parameters
(fixes bug #1090888).


Index: niceclass.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/niceclass.nice,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** niceclass.nice 20 Dec 2004 16:05:18 -0000 1.9
--- niceclass.nice 26 Dec 2004 06:21:17 -0000 1.10
***************
*** 550,555 ****
FormalParameters values = new FormalParameters(params.toArray());

notNull(constructorMethod)[i] = new DefaultConstructor
! (new LocatedString("<init>",definition.location()), values, cst,
Monotype.resolve(definition.getLocalScope(), values.types()),
Monotype.sure(new
mlsub.typing.MonotypeConstructor(definition.getTC(),
definition.getTypeParameters())),
--- 550,565 ----
FormalParameters values = new FormalParameters(params.toArray());

+ mlsub.typing.Constraint specificCst = cst;
+ // If the parent is a native method, it might have been retyped
+ // with a complex constraint. In that case we need to combine
+ // the two constraints.
+ // There might be simpler code to do this, and we could avoid
+ // duplicating the type variables.
+ if (parent instanceof JavaMethod && ! parent.getType().isMonomorphic())
+ specificCst = identifyTypeParameters(cst, parent, typeParameters);
+
notNull(constructorMethod)[i] = new DefaultConstructor
! (new LocatedString("<init>",definition.location()), values,
! specificCst,
Monotype.resolve(definition.getLocalScope(), values.types()),
Monotype.sure(new
mlsub.typing.MonotypeConstructor(definition.getTC(),
definition.getTypeParameters())),
***************
*** 677,680 ****
--- 687,722 ----
}

+ /**
+ Return a constraint that includes cst, the method's type constraint,
+ further constraining type parameters to be the same as the type parameters
+ of the return type of the method.
+ */
+ mlsub.typing.Constraint identifyTypeParameters
+ (mlsub.typing.Constraint cst,
+ MethodDeclaration method,
+ mlsub.typing.Monotype[] typeParameters)
+ {
+ mlsub.typing.MonotypeConstructor result =
+ cast(nice.tools.typing.Types.rawType(method.getType().codomain()));
+ let methodTP = result.getTP();
+
+ let cst2 = method.getType().getConstraint();
+ mlsub.typing.Constraint and = mlsub.typing.Constraint.and(cst, cst2);
+
+ let atoms = and.atoms();
+ let n = atoms == null ? 0 : atoms.length;
+ let allAtoms = new mlsub.typing.AtomicConstraint[n + typeParameters.length
* 2];
+ if (n > 0)
+ System.arraycopy(atoms, 0, allAtoms, 2 * typeParameters.length, n);
+
+ for(int i = 0; i < typeParameters.length; i++)
+ {
+ allAtoms[2*i] = new mlsub.typing.MonotypeLeqCst(typeParameters[i],
methodTP[i]);
+ allAtoms[2*i+1] = new mlsub.typing.MonotypeLeqCst(methodTP[i],
typeParameters[i]);
+ }
+
+ return new mlsub.typing.Constraint(and.binders(), cast(allAtoms));
+ }
+
let gnu.bytecode.Method cloneMethod =
notNull(gnu.bytecode.Type.pointer_type).getDeclaredMethod("clone", 0);



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/





Only community members can participate in forum threads. You must Register or log in to contribute.

<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo