From: <yz...@us...> - 2011-05-06 23:03:28
|
Revision: 21621 http://x10.svn.sourceforge.net/x10/?rev=21621&view=rev Author: yzibin Date: 2011-05-06 23:03:22 +0000 (Fri, 06 May 2011) Log Message: ----------- Fixed regression for XTENLANG_2330 (in expanding property methods) Modified Paths: -------------- trunk/x10.compiler/src/x10/types/ConstrainedType.java trunk/x10.compiler/src/x10/types/XTypeTranslator.java trunk/x10.tests/examples/Issues/XTENLANG_2638.x10 Modified: trunk/x10.compiler/src/x10/types/ConstrainedType.java =================================================================== --- trunk/x10.compiler/src/x10/types/ConstrainedType.java 2011-05-06 20:25:43 UTC (rev 21620) +++ trunk/x10.compiler/src/x10/types/ConstrainedType.java 2011-05-06 23:03:22 UTC (rev 21621) @@ -511,13 +511,15 @@ MethodInstance mi = Types.getPropertyMethod(this, name); if (mi != null) { val = translator.translate(var, mi); - // expand it in order to handle Dist.rank() - val = XTypeTranslator.expandSelfPropertyMethod(val); } } } } } + if (val!=null) { + // expand it in order to handle Dist.rank() + val = XTypeTranslator.expandSelfPropertyMethod(val); + } return val; // todo: val can be null! if we build a synthetic term, then why not always build it??? } Modified: trunk/x10.compiler/src/x10/types/XTypeTranslator.java =================================================================== --- trunk/x10.compiler/src/x10/types/XTypeTranslator.java 2011-05-06 20:25:43 UTC (rev 21620) +++ trunk/x10.compiler/src/x10/types/XTypeTranslator.java 2011-05-06 23:03:22 UTC (rev 21621) @@ -63,6 +63,7 @@ import x10.constraint.XTerm; import x10.constraint.XTerms; import x10.constraint.XVar; +import x10.constraint.XField; import x10.errors.Errors; import x10.errors.Errors.IllegalConstraint; import x10.types.checker.PlaceChecker; @@ -258,10 +259,13 @@ aDef = cAtom.def(); args = cAtom.arguments(); } - if (term instanceof CField) { - CField cField = (CField) term; - aDef = cField.field(); - args = Collections.<XTerm>singletonList(cField.receiver); + if (term instanceof XField) { + XField cField = (XField) term; + Object o = cField.field(); + if (o instanceof Def) { + aDef = (Def) o; + args = Collections.<XTerm>singletonList(cField.receiver); + } } if (aDef==null || !(aDef instanceof X10MethodDef)) return term; XTerm receiver = args.get(0); Modified: trunk/x10.tests/examples/Issues/XTENLANG_2638.x10 =================================================================== --- trunk/x10.tests/examples/Issues/XTENLANG_2638.x10 2011-05-06 20:25:43 UTC (rev 21620) +++ trunk/x10.tests/examples/Issues/XTENLANG_2638.x10 2011-05-06 23:03:22 UTC (rev 21621) @@ -27,7 +27,7 @@ { at (place) { - for (pt:Point in mat | here)//(mat.dist | here)) + for (pt in mat | here)//(mat.dist | here)) { val x = mat(pt); val y = rhs(pt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |