New tests from Richard's bug reports.

svn: r9700

original commit: a3d192bc51eb9a6af22492ee2a0db20131c07179
This commit is contained in:
Sam Tobin-Hochstadt 2008-05-06 20:40:10 +00:00
parent e4c4d15921
commit d6b097e5b6
8 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,19 @@
#;
(exn-pred exn:fail:syntax?)
#lang scheme/load
(module source scheme/base
(define-struct term (posn)) ;; lambda-calc term w/ srcloc info
(define-struct (var term) (id))
(define-struct (lam term) (arg body))
(define-struct (app term) (rator rand))
(provide (all-defined-out)))
(module client typed-scheme
(require-typed-struct term ([posn : Number]) 'source)
(require-typed-struct (var term) (
[id : Symbol])
'source))

View File

@ -1,6 +1,6 @@
#lang typed-scheme
(let ([x : (Boxof Number) (box 1)]) x)
(let: ([x : (Boxof Number) (box 1)]) x)
(let ()
(: x (Boxof Number))

View File

@ -0,0 +1,10 @@
#lang scheme/load
(module foo scheme
(define-struct foo (x y))
(provide (struct-out foo)))
(module client typed-scheme
(require-typed-struct foo ([x : Number] [y : Symbol]) 'foo))

View File

@ -0,0 +1,11 @@
#lang scheme/load
;; provide another source to import srcloc? to avoid
;; collisions with the version from mzscheme.
(module srcloc scheme/base
(provide (rename-out [srcloc? s:srcloc?])))
(module foo typed-scheme
(require/opaque-type Srcloc s:srcloc? 'srcloc))

View File

@ -0,0 +1,14 @@
#lang scheme/load
(module source mzscheme
(require (lib "contract.ss"))
(define-struct ast (loc))
(provide/contract (struct ast ([loc srcloc?])))
)
(module client typed-scheme
(require-typed-struct ast ([loc : Any]) 'source))

View File

@ -0,0 +1,17 @@
#lang scheme/load
(module source scheme/base
(define-struct term (posn)) ;; lambda-calc term w/ srcloc info
(define-struct (var term) (id))
(define-struct (lam term) (arg body))
(define-struct (app term) (rator rand))
(provide (all-defined-out)))
(module client typed-scheme
(require-typed-struct term ([posn : Number]) 'source)
(require-typed-struct var (
[id : Symbol])
'source))

View File

@ -0,0 +1,16 @@
#lang scheme/load
(module source mzscheme
(define-struct term (posn)) ;; lambda-calc term w/ srcloc info
(define-struct (var term) (id))
(define-struct (lam term) (arg body))
(define-struct (app term) (rator rand))
(provide (all-defined)))
(module alias typed-scheme
(define-type-alias Srcloc Any)
(require-typed-struct term ([posn : Srcloc]) 'source))

View File

@ -0,0 +1,8 @@
#lang typed-scheme
(: x : '())
(define x '())
(define-typed-struct even-struct ([x : (U #f odd-struct)]))
(define-typed-struct odd-struct ([x : (U #f even-struct)]))