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

TypedSyntax: fix some failures on Julia 1.11 #578

Merged
merged 1 commit into from
Jul 17, 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
5 changes: 4 additions & 1 deletion TypedSyntax/src/node.jl
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,10 @@ function map_ssas_to_source(src::CodeInfo, mi::MethodInstance, rootnode::SyntaxN
elseif isa(stmt, Core.ReturnNode)
append_targets_for_line!(mapped, i, append_targets_for_arg!(argmapping, i, stmt.val))
elseif isa(stmt, Expr)
if stmt.head == :(=) && is_slot(stmt.args[1])
targets = get_targets(stmt)
if targets !== nothing
append_targets_for_line!(mapped, i, targets)
elseif stmt.head == :(=) && is_slot(stmt.args[1])
# We defer setting up `symtyps` for the LHS because processing the RHS first might eliminate ambiguities
# # Update `symtyps` for this assignment
lhs = stmt.args[1]
Expand Down
3 changes: 2 additions & 1 deletion TypedSyntax/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ include("test_module.jl")
@test has_name_typ(child(body, 2, 1, 1), :x, Float64)
node = child(body, 2, 2, 1)
@test kind(node) == K"+="
@test has_name_typ(child(node, 1), :s, Float64) # if this line runs, the LHS now has type `Float64`
@test has_name_typ(child(node, 1), :s, Float64) || # if this line runs, the LHS now has type `Float64`
has_name_typ(child(node, 1), :s, Union{Float64, Int}) # but Julia 1.11 infers this still as the Union
@test has_name_typ(child(node, 2), :x, Float64)
@test has_name_typ(child(body, 3, 1), :s, Union{Float64, Int})
tsn = TypedSyntaxNode(TSN.summer_iterate, (Vector{Float64},))
Expand Down
Loading