Open
Description
What version of Racket are you using?
Welcome to Racket v8.6.0.9 [cs].
What program did you run?
This program is ok with normal TR and not okay for shallow, optional, and no-check
server.rkt
#lang typed/racket/shallow ;optional ;no-check
(provide mynum check-array-shape)
(define mynum 42)
(define-type (MVec T) (Mutable-Vectorof T))
(define-type Indexes (MVec Index))
(define-type In-Indexes (U (MVec Integer) Indexes))
(: check-array-shape (In-Indexes (-> Nothing) -> Indexes))
(define (check-array-shape ds fail)
(define dims (vector-length ds))
(define: new-ds : Indexes (make-vector dims 0))
(let loop ([#{i : Nonnegative-Fixnum} 0])
(cond [(i . < . dims)
(define di (vector-ref ds i))
(cond [(index? di) (vector-set! new-ds i di)
(loop (+ i 1))]
[else (fail)])]
[else new-ds])))
main.rkt
#lang racket/base
(require typed/untyped-utils
typed/racket/no-check
(except-in "server.rkt"
check-array-shape))
(require/untyped-contract
"server.rkt"
[check-array-shape ((Vectorof Integer) (-> Nothing) -> (Vectorof Index))])
(check-array-shape (vector 1 2 3) (lambda () (error 'die)))
What should have happened?
No error
If you got an error message, please include it here.
Shallow
/home/ben/code/racket/fork/extra-pkgs/typed-racket/typed-racket-lib/typed/untyped-utils.rkt:64:13:
Type Checker: type mismatch
expected: (-> (Vectorof Integer) (-> Nothing) (Vectorof Index))
given: (-> In-Indexes (-> Nothing) Indexes)
in: (define check-array-shape check-array-shape2)
no-check
/home/ben/code/racket/fork/extra-pkgs/typed-racket/typed-racket-lib/typed/untyped-utils.rkt:64:13:
Type Checker: missing type for identifier;
consider using `require/typed' to import it
identifier: check-array-shape2
from module: test-ruc-server.rkt
in: (define check-array-shape check-array-shape2)
PS thanks to @Rscho314 for the report in racket/math#75
Metadata
Metadata
Assignees
Labels
No labels