mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-11 12:37:32 +03:00
14 lines
424 B
Plaintext
14 lines
424 B
Plaintext
;; This is a regression test, the code should be rejected by the compiler.
|
|
|
|
(definterface some-interface (Fn [a] Bool))
|
|
|
|
;; A module implements it, accepting Int:s
|
|
(defmodule A (defn some-interface [x] (Int.= x 1)))
|
|
|
|
;; The function 'f' uses the interface, should still have a generic type though.
|
|
(defn f [x] (some-interface x))
|
|
(type f)
|
|
|
|
;; Calling f with some type except Int shouldn't be possible.
|
|
(defn g [] (f 10.0f))
|