Skip to content

Commit

Permalink
Fix a bug with class field parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
valis committed Mar 3, 2024
1 parent be4b827 commit dc6586e
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,10 @@ private Expression makeNewExpression(Expression arg, Expression type) {
type = type.normalize(NormalizationMode.WHNF);
if (type instanceof ClassCallExpression classCall && getDefinition().isSubClassOf(classCall.getDefinition())) {
Map<ClassField, Expression> subImplementations = new LinkedHashMap<>(classCall.getImplementedHere());
ClassCallExpression resultClassCall = new ClassCallExpression(classCall.getDefinition(), getLevels(((ClassCallExpression) type).getDefinition()), subImplementations, Sort.PROP, UniverseKind.NO_UNIVERSES);
Expression resultRef = new ReferenceExpression(resultClassCall.myThisBinding);
for (ClassField field : classCall.getDefinition().getNotImplementedFields()) {
Expression impl = myImplementations.get(field);
Expression impl = getImplementation(field, resultRef);
if (impl != null) {
subImplementations.put(field, impl);
} else {
Expand All @@ -347,7 +349,7 @@ private Expression makeNewExpression(Expression arg, Expression type) {
}
}
}
return new NewExpression(null, new ClassCallExpression(classCall.getDefinition(), getLevels(((ClassCallExpression) type).getDefinition()), subImplementations, Sort.PROP, UniverseKind.NO_UNIVERSES));
return new NewExpression(null, resultClassCall);
}
}
return null;
Expand Down

0 comments on commit dc6586e

Please sign in to comment.