Add new tests.

Fix old tests for new Struct datatype.

svn: r10161
This commit is contained in:
Sam Tobin-Hochstadt 2008-06-05 21:42:44 +00:00
parent 1da9a0c4b8
commit 5a8bc6fabb
8 changed files with 76 additions and 6 deletions

View File

@ -0,0 +1,10 @@
#lang typed-scheme
(define-type-alias Int Integer)
(: foo (Int -> Int))
(define (foo)
(: loop (Int -> Int))
(define (loop x)
(loop x))
(loop 0))

View File

@ -0,0 +1,18 @@
#lang scheme/load
(module m typed-scheme
(: f (All (a) (a -> a)))
(define (f x) x)
(provide f))
(module n typed-scheme
(require 'm))
(require typed-scheme)
(require 'n)
(current-namespace (module->namespace ''n))
(f 1)

View File

@ -0,0 +1,16 @@
#lang scheme/load
(module m typed-scheme
(define-typed-struct A ())
(define-typed-struct (x A) ([y : Number] [z : Boolean]))
(: foo (x -> Number))
(define (foo z) 1)
(provide (all-defined-out)))
(module n scheme
(require (prefix-in m: 'm))
(m:foo (m:make-x 1 #f))
m:x?)
(require 'n)

View File

@ -0,0 +1,3 @@
#lang typed-scheme
(require "simple-poly.ss")

View File

@ -0,0 +1,5 @@
(module simple-poly typed-scheme
(: f (All (a) (a -> a)))
(define (f x) x)
(define: z : Any 2)
(provide f))

View File

@ -0,0 +1,16 @@
#lang scheme/load
(module for-broken typed-scheme
(define-typed-struct type ())
(provide (all-defined-out)))
(module broken typed-scheme
(require (prefix-in t: 'for-broken))
(define-typed-struct binding ([type : t:type]))
;; Comment out the below and it works fine.
(provide (all-defined-out)))
(require 'broken)

View File

@ -110,10 +110,10 @@
(cl-> [() (-pair N (-v b))]
[(N) (-pair N (-v b))])]
[(-poly (a) ((Un (-base 'foo) (-struct 'bar #f (list N a) #f)) . -> . (-lst a)))
((Un (-base 'foo) (-struct 'bar #f (list N (-pair N (-v a))) #f)) . -> . (-lst (-pair N (-v a))))]
[(-poly (a) ((-struct 'bar #f (list N a) #f) . -> . (-lst a)))
((-struct 'bar #f (list N (-pair N (-v a))) #f) . -> . (-lst (-pair N (-v a))))]
[(-poly (a) ((Un (-base 'foo) (-struct 'bar #f (list N a) #f #f #f values)) . -> . (-lst a)))
((Un (-base 'foo) (-struct 'bar #f (list N (-pair N (-v a))) #f #f #f values)) . -> . (-lst (-pair N (-v a))))]
[(-poly (a) ((-struct 'bar #f (list N a) #f #f #f values) . -> . (-lst a)))
((-struct 'bar #f (list N (-pair N (-v a))) #f #f #f values) . -> . (-lst (-pair N (-v a))))]
[(-poly (a) (a . -> . (make-Listof a))) ((-v b) . -> . (make-Listof (-v b)))]
[(-poly (a) (a . -> . (make-Listof a))) ((-pair N (-v b)) . -> . (make-Listof (-pair N (-v b))))]

View File

@ -33,9 +33,11 @@
[(-poly (x) (-> (Un Sym N) x)) (-poly (xyz) (-> (Un N Sym) xyz))]
[(-mu x (Un N Sym x)) (-mu y (Un N Sym y))]
;; found bug
[FAIL (Un (-mu heap-node (-struct 'heap-node #f (list (-base 'comparator) N (-v a) (Un heap-node (-base 'heap-empty))) #f))
[FAIL (Un (-mu heap-node
(-struct 'heap-node #f (list (-base 'comparator) N (-v a) (Un heap-node (-base 'heap-empty))) #f #f #f values))
(-base 'heap-empty))
(Un (-mu heap-node (-struct 'heap-node #f (list (-base 'comparator) N (-pair N N) (Un heap-node (-base 'heap-empty))) #f))
(Un (-mu heap-node
(-struct 'heap-node #f (list (-base 'comparator) N (-pair N N) (Un heap-node (-base 'heap-empty))) #f #f #f values))
(-base 'heap-empty))]))