Skip to content

Commit

Permalink
JETAnalyzer: fix #669, allow concrete evaluation for typejoin (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk authored Oct 19, 2024
1 parent c4f6b19 commit d0f71ee
Show file tree
Hide file tree
Showing 2 changed files with 13 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
11 changes: 11 additions & 0 deletions test/analyzers/test_jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,17 @@ end |> only === Val{1}
end |> only === Val{3}
@test_call sort([1,2,3])
@test_call sort!([1,2,3])
# aviatesk/JET.jl#669
@static if VERSION v"1.11-"
struct Point669{dim,T}
coord::NTuple{dim,T}
end
getcoordinate669(n) = n.coord
f669(p) = getcoordinate669.(p)
let pts = Point669.(rand(NTuple{2,Float64}, 10))
@test_call f669(pts)
end
end # @static if VERSION ≥ v"1.11-"

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

Expand Down

0 comments on commit d0f71ee

Please sign in to comment.