Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JET report_call issue #1225

Closed
mestinso opened this issue Dec 11, 2023 · 1 comment · Fixed by JuliaLang/julia#53015
Closed

JET report_call issue #1225

mestinso opened this issue Dec 11, 2023 · 1 comment · Fixed by JuliaLang/julia#53015

Comments

@mestinso
Copy link

I ran into an issue found by JET.jl in some of my personal code when using StaticArrays. I asked about it on discourse (https://discourse.julialang.org/t/help-on-reported-jet-issue-when-using-staticarrays/107444) and the main feedback given was to report here.

Here is a minimum working example:

using JET
using StaticArrays

a=MVector(1,2,3,4,5)
b=MVector(6,7,8,9,10)
@report_call b[a.==2]

Gives the following:
image

Note that there are no issues with equivalent non static array code:

using JET

a=[1,2,3,4,5]
b=[6,7,8,9,10]
@report_call b[a.==2]
N5N3 pushed a commit to JuliaLang/julia that referenced this issue Jan 23, 2024
The type-assertion helps convey the information that
`iterate(tail(s)...)` would never return `nothing`, which makes JET
happy.
On master
```julia
julia> L = Base.LogicalIndex([true])
1-element Base.LogicalIndex{Int64, Vector{Bool}}:
 1

julia> @report_call iterate(L)
═════ 2 possible errors found ═════
┌ iterate(L::Base.LogicalIndex{Int64, Vector{Bool}}) @ Base ./multidimensional.jl:778
│┌ iterate(L::Base.LogicalIndex{Int64, Vector{Bool}}, s::Tuple{Int64, LinearIndices{1, Tuple{Base.OneTo{Int64}}}}) @ Base ./multidimensional.jl:789
││┌ indexed_iterate(I::Nothing, i::Int64) @ Base ./tuple.jl:94
│││ no matching method found `iterate(::Nothing)`: x = iterate(I::Nothing)
││└────────────────────
││┌ indexed_iterate(I::Nothing, i::Int64, state::Int64) @ Base ./tuple.jl:99
│││ no matching method found `iterate(::Nothing, ::Int64)`: x = iterate(I::Nothing, state::Int64)
```
This PR
```julia
julia> @report_call iterate(L)
No errors detected
```

Close JuliaArrays/StaticArrays.jl#1225
@jishnub
Copy link
Member

jishnub commented Jan 23, 2024

Fixed by JuliaLang/julia#53015

@jishnub jishnub closed this as completed Jan 23, 2024
KristofferC pushed a commit to JuliaLang/julia that referenced this issue Jan 24, 2024
The type-assertion helps convey the information that
`iterate(tail(s)...)` would never return `nothing`, which makes JET
happy.
On master
```julia
julia> L = Base.LogicalIndex([true])
1-element Base.LogicalIndex{Int64, Vector{Bool}}:
 1

julia> @report_call iterate(L)
═════ 2 possible errors found ═════
┌ iterate(L::Base.LogicalIndex{Int64, Vector{Bool}}) @ Base ./multidimensional.jl:778
│┌ iterate(L::Base.LogicalIndex{Int64, Vector{Bool}}, s::Tuple{Int64, LinearIndices{1, Tuple{Base.OneTo{Int64}}}}) @ Base ./multidimensional.jl:789
││┌ indexed_iterate(I::Nothing, i::Int64) @ Base ./tuple.jl:94
│││ no matching method found `iterate(::Nothing)`: x = iterate(I::Nothing)
││└────────────────────
││┌ indexed_iterate(I::Nothing, i::Int64, state::Int64) @ Base ./tuple.jl:99
│││ no matching method found `iterate(::Nothing, ::Int64)`: x = iterate(I::Nothing, state::Int64)
```
This PR
```julia
julia> @report_call iterate(L)
No errors detected
```

Close JuliaArrays/StaticArrays.jl#1225

(cherry picked from commit 32ad80b)
Drvi pushed a commit to RelationalAI/julia that referenced this issue Jun 7, 2024
The type-assertion helps convey the information that
`iterate(tail(s)...)` would never return `nothing`, which makes JET
happy.
On master
```julia
julia> L = Base.LogicalIndex([true])
1-element Base.LogicalIndex{Int64, Vector{Bool}}:
 1

julia> @report_call iterate(L)
═════ 2 possible errors found ═════
┌ iterate(L::Base.LogicalIndex{Int64, Vector{Bool}}) @ Base ./multidimensional.jl:778
│┌ iterate(L::Base.LogicalIndex{Int64, Vector{Bool}}, s::Tuple{Int64, LinearIndices{1, Tuple{Base.OneTo{Int64}}}}) @ Base ./multidimensional.jl:789
││┌ indexed_iterate(I::Nothing, i::Int64) @ Base ./tuple.jl:94
│││ no matching method found `iterate(::Nothing)`: x = iterate(I::Nothing)
││└────────────────────
││┌ indexed_iterate(I::Nothing, i::Int64, state::Int64) @ Base ./tuple.jl:99
│││ no matching method found `iterate(::Nothing, ::Int64)`: x = iterate(I::Nothing, state::Int64)
```
This PR
```julia
julia> @report_call iterate(L)
No errors detected
```

Close JuliaArrays/StaticArrays.jl#1225

(cherry picked from commit 32ad80b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants