[ductilej] push by samskivert - Improved handling of numeric promotion on unresolvable types. For the ... on 2010-12-06 19:16 GMT

4 views
Skip to first unread message

duct...@googlecode.com

unread,
Dec 6, 2010, 2:17:14 PM12/6/10
to ductil...@googlegroups.com
Revision: f86c0458a1
Author: Michael Bayne <m...@samskivert.com>
Date: Mon Dec 6 11:16:52 2010
Log: Improved handling of numeric promotion on unresolvable types. For the
unop
case, we just propagate the unknown type (null), and for the binop case we
choose the type of the known side if we have one, otherwise we propagate
unknown.
http://code.google.com/p/ductilej/source/detail?r=f86c0458a1

Modified:
/src/main/java/org/ductilej/detyper/Resolver.java

=======================================
--- /src/main/java/org/ductilej/detyper/Resolver.java Mon Nov 29 16:45:40
2010
+++ /src/main/java/org/ductilej/detyper/Resolver.java Mon Dec 6 11:16:52
2010
@@ -362,7 +362,7 @@
return expr.type;
}

- // Debug.temp("Resolving type", "expr", expr, "pkind", pkind);
+ // Debug.temp("Resolving type", "expr", expr, "tag",
expr.getTag(), "pkind", pkind);
switch (expr.getTag()) {
case JCTree.IDENT: {
Symbol sym = resolveSymbol(env, expr, pkind);
@@ -970,6 +970,9 @@

protected Type numericPromote (Type arg)
{
+ if (arg == null) {
+ return null; // type resolution failed, so just propagate lack
of type
+ }
if (arg.tag == TypeTags.CLASS) {
arg = _types.unboxedType(arg);
}
@@ -994,6 +997,12 @@

protected Type numericPromote (Type lhs, Type rhs)
{
+ if (lhs == null) {
+ return rhs; // return either the known type or null
+ } else if (rhs == null) {
+ return lhs; // return either the known type or null
+ }
+
if (lhs.tag == TypeTags.CLASS) {
lhs = _types.unboxedType(lhs);
}

Reply all
Reply to author
Forward
0 new messages