Skip to content

Commit

Permalink
TypedSyntax: fix some failures on Julia 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Jul 15, 2024
1 parent 679a54c commit d047067
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit d047067

Please sign in to comment.