Skip to content

Commit

Permalink
Check that the result type of an instance is a class
Browse files Browse the repository at this point in the history
  • Loading branch information
valis committed Jun 18, 2024
1 parent 762b4c8 commit fe56d9c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public Void visitFunction(Concrete.BaseFunctionDefinition def, Scope scope) {
if (body instanceof Concrete.TermFunctionBody) {
((Concrete.TermFunctionBody) body).setTerm(((Concrete.TermFunctionBody) body).getTerm().accept(exprVisitor, null));
}
if (body instanceof Concrete.CoelimFunctionBody) {
if (body instanceof Concrete.CoelimFunctionBody || def.getKind() == FunctionKind.INSTANCE) {
ClassReferable typeRef = def.getResultType() == null ? null : new TypeClassReferenceExtractVisitor().getTypeClassReference(def.getResultType());
if (typeRef != null) {
if (def.getKind() == FunctionKind.INSTANCE && typeRef.isRecord()) {
Expand Down Expand Up @@ -420,7 +420,7 @@ public Void visitFunction(Concrete.BaseFunctionDefinition def, Scope scope) {

SyntacticDesugarVisitor.desugar(def, myLocalErrorReporter);

if (def instanceof Concrete.CoClauseFunctionDefinition function && def.getKind() == FunctionKind.FUNC_COCLAUSE && ((Concrete.CoClauseFunctionDefinition) def).getNumberOfExternalParameters() > 0) {
if (def instanceof Concrete.CoClauseFunctionDefinition function && def.getKind() == FunctionKind.FUNC_COCLAUSE && function.getNumberOfExternalParameters() > 0) {
BaseConcreteExpressionVisitor<Void> visitor = new BaseConcreteExpressionVisitor<>() {
@Override
public Concrete.Expression visitReference(Concrete.ReferenceExpression expr, Void params) {
Expand Down

0 comments on commit fe56d9c

Please sign in to comment.