Skip to content

Commit

Permalink
added test for fundep superclass resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Yarin Heffes committed Oct 18, 2024
1 parent f88d05d commit fb87e95
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/fundep-tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,19 @@
(let ((filled?
(fn (i) (coalton-library/optional:some? (moo-find moo i)))))
(coalton-library/iterator:filter! filled? (coalton-library/iterator:up-to (moo-size moo)))))"))

(deftest fundep-superclass-resolution ()
;; See https://github.com/coalton-lang/coalton/issues/1050
(check-coalton-types
"(define-class (RandomAccessBase :f :t (:f -> :t))
(make (UFix -> :t -> :f))
(rab-length (:f -> UFix)))
(define-class (RandomAccessBase :f :t => RandomAccessReadable :f :t (:f -> :t))
(unsafe-set! (:f -> UFix -> :t)))
(declare aref (RandomAccessReadable :f :t => :f -> UFix -> (Optional :t)))
(define (aref storage index)
(if (and (<= 0 index) (< index (rab-length storage)))
(Some (unsafe-set! storage index))
None)))"))

0 comments on commit fb87e95

Please sign in to comment.