
Avoids using mzlib/pconvert in favor of a few big match clauses. This lets us cut out a package dependency and makes the code easier to understand. This commit also removes the use of mzlib/pconvert in the debug printer in favor of just using the type serialization performed in init-envs.rkt. In addition, a few optimizations for type serialization were implemented that cut a few percent off of zo sizes. Note that this commit regresses for zo sizes for modules that heavily use GUI classes, but that is fixed in a future commit.
32 lines
833 B
Racket
32 lines
833 B
Racket
#lang racket/base
|
|
|
|
(require "test-utils.rkt"
|
|
rackunit
|
|
(env init-envs)
|
|
(types abbrev union))
|
|
|
|
(provide tests)
|
|
(gen-test-main)
|
|
|
|
(define (convert v)
|
|
(syntax->datum (datum->syntax #f (type->sexp v))))
|
|
|
|
|
|
(define tests
|
|
(test-suite "Init Env"
|
|
(test-suite "Convert"
|
|
(check-equal?
|
|
(convert (-> -String -Symbol))
|
|
'(simple-> (list -String) -Symbol))
|
|
(check-equal?
|
|
(convert (make-pred-ty -String))
|
|
'(make-pred-ty (list Univ) -Boolean -String (-arg-path 0)))
|
|
(check-equal?
|
|
(convert (->acc (list (-lst -String)) -String (list -car)))
|
|
'(->acc (list (-lst -String)) -String (list -car)))
|
|
(check-equal?
|
|
(convert (-mu x (-lst* Univ (-box x))))
|
|
'(make-Mu 'x (make-Pair Univ (make-Pair (make-Box (make-F 'x)) -Null))))
|
|
)
|
|
))
|