[val] in ecj we were constructing a different type than for javac, when using ‘val’ on an intersection type.

This commit is contained in:
Reinier Zwitserloot committed 2019-04-24 13:52:49 +02:00
1 parent ccaefff69f
commit 1730a991b5
1 file changed
+9 -5
@@ -263,11 +263,15 @@ public class PatchVal {
resolved = null;
}
if (resolved != null) {
try {
replacement = makeType(resolved, local.type, false);
if (!decomponent) init.resolvedType = replacement.resolveType(scope);
} catch (Exception e) {
// Some type thing failed.
if (resolved.getClass().getSimpleName().startsWith("IntersectionTypeBinding")) {
// We intentionally deconstruct these into simply 'Object', because picking an arbitrary type amongst the intersection feels worse.
} else {
try {
replacement = makeType(resolved, local.type, false);
if (!decomponent) init.resolvedType = replacement.resolveType(scope);
} catch (Exception e) {
// Some type thing failed.
}
}
}
}