~ chicken-core (chicken-5) /tests/specialization-tests.scm


 1;; both arms of if branches are dropped
 2
 3(let ((a "yep")) (if (string? a) 'ok 'no))
 4(let ((a 'nope)) (if (string? a) 'ok 'no))
 5
 6;; bidirectional ports are specialized
 7
 8(let ((p (open-input-string "foo")))
 9  (when (output-port? p) ; indicates `p' is bidirectional
10     (if (input-port? p) 'ok 'no)
11     (if (output-port? p) 'ok 'no)))
Trap