Skip to content

Commit

Permalink
Just ask only for types the value 'has been cast to'
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Dec 20, 2024
1 parent 56b24aa commit 2dcc2c4
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,14 @@ ApplicationNode findConversionNode(ExpressionNode valueNode, Type[] allTypes) {
return null;
}

Type[] findType(TypeOfNode typeOfNode, Object v) {
final Type[] findType(TypeOfNode typeOfNode, Object v) {
return findType(typeOfNode, v, null);
}

Type[] findType(TypeOfNode typeOfNode, Object v, Type[] previous) {
final Type[] findType(TypeOfNode typeOfNode, Object v, Type[] previous) {;
if (v instanceof EnsoMultiValue multi) {
var all = typeOfNode.findAllTypesOrNull(multi, isAllTypes());
assert all != null;
var to = 0;
// only consider methodDispatchTypes and not "all types" of the multi value
for (var i = 0; i < all.length; i++) {
var typeOrNull = EnsoMultiValue.CastToNode.getUncached().findTypeOrNull(all[i], multi, false, false);
if (typeOrNull != null) {
all[to++] = all[i];
}
}
return Arrays.copyOf(all, to);
var all = typeOfNode.findAllTypesOrNull(multi, false);
return all;
}
if (v instanceof UnresolvedConstructor) {
return null;
Expand Down

0 comments on commit 2dcc2c4

Please sign in to comment.