Commit 41353d2
authored
As of the latest release, trying to `view` into an `SArray` with an
eltype of `Any` such that the view also returns an `SArray` would wrap
the returned array in a scalar. `_maybewrapscalar` assumes that if the
`eltype` of the array matches the type of the view, it must be a scalar
view. This assumption breaks down when the `eltype` is `Any`. MWE:
```julia
julia> A = SVector{4, Any}(1,2,3,4)
julia> I = SVector{2}(3, 1)
julia> view(A, I)
Scalar{Any}((Any[3, 1],))
julia> view(A, [3, 1])
2-element view(::SVector{4, Any}, [3, 1]) with eltype Any:
3
1
```
I've verified that all the added tests fail on the latest release and
pass with this PR.
1 parent 563adeb commit 41353d2
2 files changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
289 | | - | |
| 288 | + | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
| 292 | + | |
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
256 | 268 | | |
0 commit comments