You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#lang typed/racket
(: my-vector-set! (All (T) ((Vectorof T) Natural T -> Void)))
(define (my-vector-set! vec idx newval)
(vector-set! vec idx newval))
(define v (vector 1 2 3))
(vector-set! v 0 1234)
(my-vector-set! v 0 1234)
(vector-set! v (ann 0 Natural) 1234)
What should have happened?
The program should have shown complete coverage.
If you got an error message, please include it here.
Instead, the first use of vector-set! is shown as not having coverage. Running the macro expander indicates that this use of vector-set! is expanded into a conditional which calls the native vector-set! only if the vector is immutable, and an unsafe version otherwise. I conjecture that fixing this is a matter of ensuring that the application of the unsafe vector mutator is given the source location of the original application. It looks like this might be on or near line 87 of vector.rkt, but I see a conspicuous lack of similar source location annotations in this code, so perhaps this is actually a larger problem.
Either way, there are workarounds (albeit cryptic ones), as this snippet demonstrates.
The text was updated successfully, but these errors were encountered:
What version of Racket are you using?
8.8.0.8--2023-02-23(-/f) [cs].
What program did you run?
What should have happened?
The program should have shown complete coverage.
If you got an error message, please include it here.
Instead, the first use of
vector-set!
is shown as not having coverage. Running the macro expander indicates that this use ofvector-set!
is expanded into a conditional which calls the nativevector-set!
only if the vector is immutable, and an unsafe version otherwise. I conjecture that fixing this is a matter of ensuring that the application of the unsafe vector mutator is given the source location of the original application. It looks like this might be on or near line 87 of vector.rkt, but I see a conspicuous lack of similar source location annotations in this code, so perhaps this is actually a larger problem.Either way, there are workarounds (albeit cryptic ones), as this snippet demonstrates.
The text was updated successfully, but these errors were encountered: