Skip to content

Commit

Permalink
Call isInstantiable recursively to make sure that type parameters (if…
Browse files Browse the repository at this point in the history
… present) are bound
  • Loading branch information
antvaset committed Oct 30, 2024
1 parent 4866823 commit 3345ba1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Src/java/model/src/main/java/org/hl7/cql/model/ChoiceType.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ public boolean isGeneric() {

@Override
public boolean isInstantiable(DataType callType, InstantiationContext context) {
// Call isInstantiable recursively to make sure that type parameters (if present) are bound
if (callType.equals(DataType.ANY)) {
for (var type : types) {
if (!type.isInstantiable(callType, context)) {
return false;
}
}
return true;
}

return isSuperTypeOf(callType);
}

Expand Down
6 changes: 6 additions & 0 deletions Src/java/model/src/main/java/org/hl7/cql/model/TupleType.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ public boolean isGeneric() {

@Override
public boolean isInstantiable(DataType callType, InstantiationContext context) {
// Call isInstantiable recursively to make sure that type parameters (if present) are bound
if (callType.equals(DataType.ANY)) {
for (var element : elements) {
if (!element.getType().isInstantiable(callType, context)) {
return false;
}
}
return true;
}

Expand Down

0 comments on commit 3345ba1

Please sign in to comment.