Skip to content

Commit

Permalink
accept var".." as valid identifier (#601)
Browse files Browse the repository at this point in the history
Co-authored-by: Shuhei Kadowaki <[email protected]>
  • Loading branch information
simeonschaub and aviatesk authored Sep 26, 2024
1 parent 2b71d47 commit 9a6d1f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions TypedSyntax/src/node.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ function map_signature!(sig::TypedSyntaxNode, slotnames::Vector{Symbol}, slottyp
if kind(arg) == K"curly"
arg = first(children(arg))
end
if kind(arg) == K"var"
arg = child(arg, 1)
end
kind(arg) == K"tuple" && return nothing, defaultval # FIXME? see extrema2 test
@assert kind(arg) == K"Identifier" || is_operator(arg)
return arg, defaultval
Expand Down
6 changes: 6 additions & 0 deletions TypedSyntax/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,12 @@ include("test_module.jl")
@test_nowarn str = sprint(tsn; context=:color=>false) do io, obj
printstyled(io, obj; hide_type_stable=false)
end

# issue 597
tsn = TypedSyntaxNode(TSN.f597, (Int,))
@test_nowarn str = sprint(tsn; context=:color=>false) do io, obj
printstyled(io, obj; hide_type_stable=false)
end
end

if parse(Bool, get(ENV, "CI", "false"))
Expand Down
2 changes: 2 additions & 0 deletions TypedSyntax/test/test_module.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ function obfuscated(x)
return f(x)
end

f597(var"#"::Int) = 1

module Internal
export helper
helper(x) = x+1
Expand Down

0 comments on commit 9a6d1f1

Please sign in to comment.