File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
typed-racket-lib/typed-racket/private
typed-racket-test/succeed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1010 (env type-name-env row-constraint-env)
1111 (rep core-rep rep-utils free-ids type-mask values-rep
1212 base-types numeric-base-types)
13- (types resolve utils printer match-expanders union)
13+ (types resolve utils printer match-expanders union subtype )
1414 (prefix-in t: (types abbrev numeric-tower subtype))
1515 (private parse-type syntax-properties)
1616 racket/match racket/syntax racket/list
526526 [(? Fun? t) (t->sc/fun t)]
527527 [(? DepFun? t) (t->sc/fun t)]
528528 [(Set: t) (set/sc (t->sc t))]
529+ [(Sequence: (list t))
530+ #:when (subtype t:-Nat t)
531+ ;; sequence/c is always a wrapper, so avoid it when we just have a number
532+ (or/sc (flat/sc #'exact-nonnegative-integer? )
533+ (sequence/sc (t->sc t)))]
529534 [(Sequence: ts) (apply sequence/sc (map t->sc ts))]
530535 [(Vector: t) (vectorof/sc (t->sc/both t))]
531536 [(HeterogeneousVector: ts) (apply vector/sc (map t->sc/both ts))]
Original file line number Diff line number Diff line change 1+ #lang racket/base
2+
3+ (module typed typed/racket/base
4+ (provide foo)
5+ (: foo (-> (U Integer (Sequenceof Integer)) String))
6+ (define (foo x)
7+ (if (integer? x)
8+ (format "I got an integer: ~a " x)
9+ (error "I did not get an integer: ~a " x))))
10+
11+ (module other-typed typed/racket/base
12+ (provide bar)
13+ (require (submod ".. " typed))
14+ (define (bar) (foo 0 )))
15+
16+ (require 'typed
17+ 'other-typed )
18+ (foo 0 )
19+ (bar)
You can’t perform that action at this time.
0 commit comments