Skip to content

Commit

Permalink
Help the compiler by asserting the children type.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed May 25, 2024
1 parent 0d32664 commit e813883
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Runic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ function format_node_with_children!(ctx::Context, node::JuliaSyntax.GreenNode)
span_sum = 0

# The new node parts. `children′` aliases `children` and only copied below if any of the
# nodes change ("copy-on-write").
# nodes change ("copy-on-write"). Since we return directly if the node don't have
# children we can assert that `JuliaSyntax.children` returns a vector (and not the
# empty tuple) to help the compiler.
head′ = JuliaSyntax.head(node)
children = JuliaSyntax.children(node)
children = JuliaSyntax.children(node)::AbstractVector
children′ = children
any_child_changed = false

Expand Down

0 comments on commit e813883

Please sign in to comment.