MilesCranmer / DispatchDoctor.jl

The dispatch doctor prescribes type stability
Apache License 2.0
128 stars 6 forks source link

Choking on `f(::Int...)` #16

Closed thofma closed 1 month ago

thofma commented 1 month ago

Trying it out with a large package I found

julia> @stable f(::Int...) = 2
ERROR: syntax: invalid "::" syntax around /bla/DispatchDoctor/uWnHi/src/DispatchDoctor.jl:306
MilesCranmer commented 1 month ago

Thanks, looks like another edge case I need to add. In the meantime you can do f(::Vararg{Int}) and it should hopefully work.

MilesCranmer commented 1 month ago

Looks like this line: https://github.com/MilesCranmer/DispatchDoctor.jl/blob/532ebcb39d509d859e784357c1dc13ac95e7fe1a/src/DispatchDoctor.jl#L247 is not injecting the symbol here for this case. It normally should do a gensym if any arg does not have a symbol.

MilesCranmer commented 1 month ago

Fixed:

julia> @stable f(::Int...) = 2
f (generic function with 1 method)

julia> f(1, 2)
2

Send more if you find 'em!