Skip to content

Commit

Permalink
JETAnalyzer: fix #669, allow concrete evaluation for typejoin
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Oct 18, 2024
1 parent 8014cba commit fcd1893
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/analyzers/jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ function CC.concrete_eval_eligible(analyzer::JETAnalyzer,
if res === :concrete_eval
return :concrete_eval
end
elseif istopfunction(f, :fieldindex)
elseif (istopfunction(f, :fieldindex) || istopfunction(f, :typejoin) ||
istopfunction(f, :typejoin_union_tuple))
if concrete_eval_eligible_ignoring_overlay(result, arginfo)
return :concrete_eval
end
Expand Down
9 changes: 9 additions & 0 deletions test/analyzers/test_jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,15 @@ end |> only === Val{1}
end |> only === Val{3}
@test_call sort([1,2,3])
@test_call sort!([1,2,3])
# aviatesk/JET.jl#669
struct Point669{dim,T}
coord::NTuple{dim,T}
end
getcoordinate669(n) = n.coord
f669(p) = getcoordinate.(p)
let pts = Point.(rand(NTuple{2,Float64}, 10))
@test_call f669(pts)
end

@test isconcretetype(only(Base.return_types(pairs, (@NamedTuple{kw1::Int,kw2::String},); interp=JET.JETAnalyzer())))

Expand Down

0 comments on commit fcd1893

Please sign in to comment.