Skip to content

Commit

Permalink
fix issue #74
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiek committed Jan 28, 2025
1 parent 2f34a57 commit 990fcaf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions proof_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,9 @@ def type_synth_term(term, env, recfun, subterms):
lhs = type_synth_term(args[0], env, recfun, subterms)
rhs = type_check_term(args[1], lhs.typeof, env, recfun, subterms)
ty = BoolType(loc)
if lhs.typeof != rhs.typeof:
error(loc, 'expected arguments of equality to have the same type, but\n' \
+ '\t' + str(lhs.typeof) + ' ≠ ' + str(rhs.typeof))
ret = Call(loc, ty, Var(loc2, ty2, name, rs), [lhs, rhs])

case Call(loc, _, Var(loc2, ty2, name, rs), args) if name == recfun:
Expand Down
2 changes: 1 addition & 1 deletion test-deduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_deduce_errors(deduce_call, path):
if os.path.isfile(path + file):
if file[-3:] == '.pf':
if not os.path.isfile(path + file + '.err'):
print("Couldn't find an expected error for", path)
print("Couldn't find an expected error for", path + file)
print("Did you mean to generate it? If so, use generate_deduce_errors")
exit(1)

Expand Down
9 changes: 9 additions & 0 deletions test/should-error/equality.pf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
union List<T> {
empty
node(T, List<T>)
}

union A { a }
union B { b }

assert not (@[]<A> = @[]<B>)
2 changes: 2 additions & 0 deletions test/should-error/equality.pf.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./test/should-error/equality.pf:9.13-9.28: expected arguments of equality to have the same type, but
List<A> ≠ List<B>

0 comments on commit 990fcaf

Please sign in to comment.