Skip to content

Commit

Permalink
Add signature instantiation check
Browse files Browse the repository at this point in the history
  • Loading branch information
antvaset committed Oct 17, 2024
1 parent 7202398 commit 7988c3a
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,21 @@ public boolean isSubTypeOf(Signature other) {
}

public Signature instantiate(Signature callSignature, InstantiationContext context) {
DataType[] result = new DataType[operandTypes.size()];
for (int i = 0; i < operandTypes.size(); i++) {
var operandTypeInstantiated = operandTypes.get(i).instantiate(callSignature.operandTypes.get(i), context);
if (operandTypeInstantiated == null) {
return null;
if (operandTypes.size() == callSignature.operandTypes.size()) {
DataType[] result = new DataType[operandTypes.size()];
for (int i = 0; i < operandTypes.size(); i++) {
var operandTypeInstantiated =
operandTypes.get(i).instantiate(callSignature.operandTypes.get(i), context);
if (operandTypeInstantiated == null) {
return null;
}
result[i] = operandTypeInstantiated;
}
result[i] = operandTypeInstantiated;

return new Signature(result);
}

return new Signature(result);
return null;
}

public boolean isConvertibleTo(
Expand Down

0 comments on commit 7988c3a

Please sign in to comment.