samrushing/irken-compiler

report error on invalid INFINTE type constructions

jeske opened this issue · 0 comments

jeske commented

Invalid infinite type constructions should be a compiler error.

In order for a recursive type construction to be finite, the recursion needs to be optional... that is, there needs to be a variant where there is no recursion.

(datatype container (:t 'a))

;; this is an invalid infinite type
(datatype foo (:t foo))

;; these are invalid infinite type constructions

(typealias bar { a=(container bar) } )

(define (f x) : ((container foo) -> int)
   1)

1 ;; this is the required begin block