Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

equals does not work properly in chez Backends #500

Open
marzipankaiser opened this issue Jun 13, 2024 · 0 comments
Open

equals does not work properly in chez Backends #500

marzipankaiser opened this issue Jun 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@marzipankaiser
Copy link
Contributor

marzipankaiser commented Jun 13, 2024

In the chez Backends, we use scheme-equal? to implement equals.
This does not properly recurse, so the test examples/pos/issue429.effekt (added in #499) fails on Chez.
It seems that equal? uses reference equality for records in Chez Scheme (by default?):

(define-record-type point (fields x y))
(equal? (make-point 2 3) (make-point 2 3)) ; ~> #f

Current behavior on Effekt in the Chez-Backends:

type MyType {
  MySingleCase()
}

record EmptyRecord()

def main() = {
  println(MySingleCase().equals(MySingleCase()))   // ~> true
  println(EmptyRecord().equals(EmptyRecord()))    // ~> true

  println(Some(MySingleCase()).equals(Some(MySingleCase()))) // ~> false
  println(Some(EmptyRecord()).equals(Some(EmptyRecord())))   // ~> false

  println([Some(EmptyRecord()), Some(EmptyRecord()), None()].equals([Some(EmptyRecord()), Some(EmptyRecord()), None()])) // ~> false
}
@marzipankaiser marzipankaiser added the bug Something isn't working label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant