Add testcases for many already fixed bugs.

Closes PR11901.
Closes PR11972.
Closes PR12022.
Closes PR12224.
Closes PR12506.
Closes PR12533.
Closes PR12596.
Closes PR13198.
Closes PR13418.

Already fixed bugs, with existing testcases.
Closes PR12529.
Closes PR12631.
Closes PR13127.
Closes PR13128.
Closes PR12970.

original commit: 7e88895bd03fed78028fc79c34856f162c7ba06b
This commit is contained in:
Eric Dobson 2013-02-16 14:31:01 -08:00 committed by Vincent St-Amour
parent a51f55d04e
commit e457b15977
5 changed files with 50 additions and 0 deletions

View File

@ -213,6 +213,20 @@
(for: ([x 10] #:unless (> x 3)) (display x))))
"0123")
(check equal?
(for/hasheq: : (HashTable Integer String) ([k (list 2 3 4)]) (values k "val"))
#hasheq((2 . "val") (3 . "val") (4 . "val")))
(check equal?
(for/vector: ([i : Natural (in-range 3)]) 5)
(vector 5 5 5))
(check equal?
(for/vector: : (Vectorof Number) ([i : Natural (in-range 3)]) 5)
(vector 5 5 5))
;; break and final clauses
;; TODO typechecker can't handle these
;; (check string=?

View File

@ -0,0 +1,3 @@
#lang typed/racket/base
(define-type (adder lhs rhs) (lhs rhs -> Number))
(define-struct: (lhs rhs) adder-box ((a : adder)))

View File

@ -0,0 +1,11 @@
#lang racket/load
(module t1 typed/racket/base
(provide (all-defined-out))
(define-struct: f ([n : ((Promise Number) -> Number)])))
(module t2 typed/racket/base
(require racket/promise 't1)
(: g (f (Promise Number) -> Number))
(define (g fx k)
((f-n fx) k)))

View File

@ -0,0 +1,10 @@
#lang racket
(module test typed/racket
(provide v-ref)
(: v-ref ((Vectorof Symbol) Index -> Symbol))
(define (v-ref v i) (vector-ref v i)))
(require (submod "." test))
(v-ref (vector 'foo) 0)

View File

@ -1546,6 +1546,18 @@
[tc-e ((inst list Any) 1 2 3)
(-lst Univ)]
[tc-e (let ()
(define f
(lambda: ((x : Boolean) (y : String))
(if x y "false")))
(apply f (list #f "2")))
-String]
[tc-err (let ()
(: f (All (i ...) Any -> (values Any ... i)))
(define (f x) (values 1 2)))]
[tc-err (let ()
(: g (All (i ...) Any -> (values Any ... i)))
(define (g x) 2))]
)
(test-suite
"check-type tests"