beacon-biosignals / Legolas.jl

Tables.jl-friendly mechanisms for constructing, reading, writing, and validating Arrow tables against extensible, versioned, user-specified schemas.
Other
24 stars 2 forks source link

Use `gensym` for generated type parameters #81

Closed omus closed 1 year ago

omus commented 1 year ago

Fixes an extremely unlikely case where a user would define a field with the same name we generate for the type parameters:

julia> using Legolas: Legolas, @schema, @version

julia> @schema "demo" Demo

julia> @version DemoV1 begin
           x::(<:String)
           _x_T::String
       end
ERROR: syntax: function argument and static parameter names must be distinct around /Users/cvogt/.julia/dev/Legolas/src/schemas.jl:569
Stacktrace:
 [1] top-level scope
   @ none:1
 [2] eval
   @ ./boot.jl:368 [inlined]
 [3] eval(x::Expr)
   @ Base.MainInclude ./client.jl:478
 [4] top-level scope
   @ ~/.julia/dev/Legolas/src/schemas.jl:737