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

JETAnalyzer: fix #669, allow concrete evaluation for typejoin #670

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading