Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions typed-racket-lib/typed-racket/base-env/base-special-env.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@
;; unsafe-normalise-inputs
[(make-template-identifier 'unsafe-normalise-inputs 'racket/private/for)
(-poly (a)
(-> (-> a -Nat) a -Nat (Un (-val #f) -Nat) -Nat (-values (list a -Index -Index -Index))))]
(-> (-> a -Nat) a -Nat (Un (-val #f) -Int) -Int (-values (list a -Index -Index -Index))))]
;; normalise-inputs
[(make-template-identifier 'normalise-inputs 'racket/private/for)
(-poly (a)
(-> -Symbol -String (-> a -Boolean) (-> a -Nat) a -Nat (Un (-val #f) -Nat) -Nat (-values (list a -Index -Index -Index))))]
(-> -Symbol -String (-> a -Boolean) (-> a -Nat) a -Nat (Un (-val #f) -Int) -Int (-values (list a -Index -Index -Index))))]
;; make-sequence
[(make-template-identifier 'make-sequence 'racket/private/for)
(-polydots (a b)
Expand Down Expand Up @@ -366,11 +366,11 @@
(-> -Variable-Reference -Module-Path -Resolved-Module-Path)]
;; in-fxvector, in-flvector, in-extflvector
[(make-template-identifier 'in-fxvector* 'racket/fixnum)
(-> -FxVector (-seq -Fixnum))]
(->opt -FxVector [-Int (-opt -Int) -Int] (-seq -Fixnum))]
[(make-template-identifier 'in-flvector* 'racket/flonum)
(-> -FlVector (-seq -Flonum))]
(->opt -FlVector [-Int (-opt -Int) -Int] (-seq -Flonum))]
[(make-template-identifier 'in-extflvector* 'racket/extflonum)
(-> -ExtFlVector (-seq -ExtFlonum))]
(->opt -ExtFlVector [-Int (-opt -Int) -Int] (-seq -ExtFlonum))]
[(make-template-identifier 'make-namespace-anchor 'racket/private/namespace)
(-> -Variable-Reference -Namespace-Anchor)]
[(make-template-identifier 'check-logger-or-false 'racket/private/logger)
Expand Down
25 changes: 25 additions & 0 deletions typed-racket-test/succeed/pr953-in-xvector.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#lang typed/racket/base

(require racket/sequence
racket/flonum
racket/fixnum
racket/extflonum
typed/rackunit)

(check-equal? (sequence->list (in-flvector (flvector 1.0 2.0 3.0 4.0))) (list 1.0 2.0 3.0 4.0))
(check-equal? (sequence->list (in-flvector (flvector 1.0 2.0 3.0 4.0) 1)) (list 2.0 3.0 4.0))
(check-equal? (sequence->list (in-flvector (flvector 1.0 2.0 3.0 4.0) 1 2)) (list 2.0))
(check-equal? (sequence->list (in-flvector (flvector 1.0 2.0 3.0 4.0) 0 #f 2)) (list 1.0 3.0))
(check-equal? (for/list : (Listof Flonum) ([i (in-flvector (flvector 1.0 2.0 3.0 4.0) 3 -1 -2)]) i)
(list 4.0 2.0))

(check-equal? (sequence->list (in-fxvector (fxvector 1 2 3 4) 0 #f 2)) (list 1 3))
(check-equal? (for/list : (Listof Fixnum) ([i : Fixnum (ann (in-fxvector (fxvector 1 2 3 4) 3 -1 -2) (Sequenceof Fixnum))]) i)
(list 4 2))
;; I don't understand why this fails...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you say more about this failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to be able to do:
(for/list : (Listof Fixnum) ([i (in-fxvector (fxvector 1 2 3 4) 3 -1 -2)]) i)
but without the annotation of (Sequenceof Fixnum) and Fixnum for i (both are necessary) The resulting list is seen as (Listof Integer)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a quick look at this failure. Seems it has something to do with unsafe-normalise-inputs and normalise-inputs. I might get back to some point later next week

#;(check-equal? (for/list : (Listof Fixnum) ([i (in-fxvector (fxvector 1 2 3 4) 3 -1 -2)]) i)
(list 4 2))

(when (extflonum-available?)
(check-equal? (for/list : (Listof ExtFlonum) ([i (in-extflvector (extflvector 1.0t0 2.0t0 3.0t0 4.0t0) 3 -1 -2)]) i)
(list 4.0t0 2.0t0)))