Skip to content

Commit

Permalink
Fix a bug with \case \elim
Browse files Browse the repository at this point in the history
  • Loading branch information
valis committed Nov 11, 2024
1 parent 86aaf0d commit fc01f9e
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static String subst(String substVar, String paramVar, String freeVar) {
}

public static String noParameter() {
return "One of the sides in the expected type should be a variable";
return "One of the sides in the expected type should be a parameter";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4016,11 +4016,8 @@ public TypecheckingResult visitCase(Concrete.CaseExpression expr, Expression exp
list.append(link);
if (caseArg.isElim) {
if (argTypeExpr != null) {
Expression actualArgType = exprResult.type.subst(substitution);
if (!CompareVisitor.compare(myEquations, CMP.EQ, actualArgType, argTypeExpr, Type.OMEGA, caseArg.type)) {
errorReporter.report(new TypeMismatchError(actualArgType, argTypeExpr, caseArg.expression));
return null;
}
errorReporter.report(new TypecheckingError("Explicit type annotation is not allowed with \\elim", caseArg.expression));
return null;
}
Binding origBinding = ((ReferenceExpression) exprResult.expression).getBinding();
origElimBindings.put(asRef, origBinding);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public void casePatternMatchingTest5() {
public void casePatternMatchingTest6() {
typeCheckModule("""
\\func test {A : \\Set} {n : Nat} (l : Array A n) : Nat
=> \\case \\elim n, \\elim l : Array A n \\with {
=> \\case \\elim n, l : Array A n \\with {
| 0, nil => 0
| suc n, a :: l => 1
}
Expand Down
Loading

0 comments on commit fc01f9e

Please sign in to comment.