diff --git a/TypedSyntax/src/node.jl b/TypedSyntax/src/node.jl index 5202a855..76fbe6b8 100644 --- a/TypedSyntax/src/node.jl +++ b/TypedSyntax/src/node.jl @@ -172,8 +172,8 @@ function map_signature!(sig::TypedSyntaxNode, slotnames::Vector{Symbol}, slottyp # Try to find an identifier for this arg arg, defaultval = argidentifier(arg) if arg !== nothing - name = arg.val::Symbol - idx = findfirst(==(name), slotnames) + name = arg.val + idx = name === nothing ? nothing : findfirst(==(name::Symbol), slotnames) if idx === nothing && isempty(slotarg) && slotnames[1] == Symbol("#self#") # The first argument is the function name itself, and matches `#self#` idx = 1 diff --git a/TypedSyntax/test/runtests.jl b/TypedSyntax/test/runtests.jl index eaace65b..295238f0 100644 --- a/TypedSyntax/test/runtests.jl +++ b/TypedSyntax/test/runtests.jl @@ -693,6 +693,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 504 + tsn = TypedSyntaxNode(TSN.A504{T, 1} where T, (Vector{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")) diff --git a/TypedSyntax/test/test_module.jl b/TypedSyntax/test/test_module.jl index 30493f08..d2d13bb4 100644 --- a/TypedSyntax/test/test_module.jl +++ b/TypedSyntax/test/test_module.jl @@ -249,6 +249,9 @@ end f597(var"#"::Int) = 1 +struct A504{T, N} end +(A504{T, N} where T)(x::AbstractArray{S, N}) where {S, N} = x + module Internal export helper helper(x) = x+1