From d6b097e5b67b44651dd726a597c504d10be9d2b0 Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Tue, 6 May 2008 20:40:10 +0000 Subject: [PATCH] New tests from Richard's bug reports. svn: r9700 original commit: a3d192bc51eb9a6af22492ee2a0db20131c07179 --- .../tests/typed-scheme/fail/pr9053-fail.ss | 19 +++++++++++++++++++ .../tests/typed-scheme/succeed/box-num.ss | 2 +- collects/tests/typed-scheme/succeed/pr9043.ss | 10 ++++++++++ collects/tests/typed-scheme/succeed/pr9046.ss | 11 +++++++++++ collects/tests/typed-scheme/succeed/pr9048.ss | 14 ++++++++++++++ collects/tests/typed-scheme/succeed/pr9053.ss | 17 +++++++++++++++++ collects/tests/typed-scheme/succeed/pr9054.ss | 16 ++++++++++++++++ .../typed-scheme/succeed/richard-bugs.ss | 8 ++++++++ 8 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 collects/tests/typed-scheme/fail/pr9053-fail.ss create mode 100644 collects/tests/typed-scheme/succeed/pr9043.ss create mode 100644 collects/tests/typed-scheme/succeed/pr9046.ss create mode 100644 collects/tests/typed-scheme/succeed/pr9048.ss create mode 100644 collects/tests/typed-scheme/succeed/pr9053.ss create mode 100644 collects/tests/typed-scheme/succeed/pr9054.ss create mode 100644 collects/tests/typed-scheme/succeed/richard-bugs.ss diff --git a/collects/tests/typed-scheme/fail/pr9053-fail.ss b/collects/tests/typed-scheme/fail/pr9053-fail.ss new file mode 100644 index 00000000..76863505 --- /dev/null +++ b/collects/tests/typed-scheme/fail/pr9053-fail.ss @@ -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)) \ No newline at end of file diff --git a/collects/tests/typed-scheme/succeed/box-num.ss b/collects/tests/typed-scheme/succeed/box-num.ss index 1a0a423e..5cf003e4 100644 --- a/collects/tests/typed-scheme/succeed/box-num.ss +++ b/collects/tests/typed-scheme/succeed/box-num.ss @@ -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)) diff --git a/collects/tests/typed-scheme/succeed/pr9043.ss b/collects/tests/typed-scheme/succeed/pr9043.ss new file mode 100644 index 00000000..83199504 --- /dev/null +++ b/collects/tests/typed-scheme/succeed/pr9043.ss @@ -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)) + diff --git a/collects/tests/typed-scheme/succeed/pr9046.ss b/collects/tests/typed-scheme/succeed/pr9046.ss new file mode 100644 index 00000000..13857699 --- /dev/null +++ b/collects/tests/typed-scheme/succeed/pr9046.ss @@ -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)) \ No newline at end of file diff --git a/collects/tests/typed-scheme/succeed/pr9048.ss b/collects/tests/typed-scheme/succeed/pr9048.ss new file mode 100644 index 00000000..412121e7 --- /dev/null +++ b/collects/tests/typed-scheme/succeed/pr9048.ss @@ -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)) \ No newline at end of file diff --git a/collects/tests/typed-scheme/succeed/pr9053.ss b/collects/tests/typed-scheme/succeed/pr9053.ss new file mode 100644 index 00000000..f66df690 --- /dev/null +++ b/collects/tests/typed-scheme/succeed/pr9053.ss @@ -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)) \ No newline at end of file diff --git a/collects/tests/typed-scheme/succeed/pr9054.ss b/collects/tests/typed-scheme/succeed/pr9054.ss new file mode 100644 index 00000000..cee0aa29 --- /dev/null +++ b/collects/tests/typed-scheme/succeed/pr9054.ss @@ -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)) \ No newline at end of file diff --git a/collects/tests/typed-scheme/succeed/richard-bugs.ss b/collects/tests/typed-scheme/succeed/richard-bugs.ss new file mode 100644 index 00000000..16a889e7 --- /dev/null +++ b/collects/tests/typed-scheme/succeed/richard-bugs.ss @@ -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)]))