[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; resolved = null;
} }
if (resolved != null) { if (resolved != null) {
try { if (resolved.getClass().getSimpleName().startsWith("IntersectionTypeBinding")) {
replacement = makeType(resolved, local.type, false); // We intentionally deconstruct these into simply 'Object', because picking an arbitrary type amongst the intersection feels worse.
if (!decomponent) init.resolvedType = replacement.resolveType(scope); } else {
} catch (Exception e) { try {
// Some type thing failed. replacement = makeType(resolved, local.type, false);
if (!decomponent) init.resolvedType = replacement.resolveType(scope);
} catch (Exception e) {
// Some type thing failed.
}
} }
} }
} }