Open Tortar opened 1 month ago
I got an MWE:
julia> macro repro()
e = :(const B = F{X}
where {X})
return esc(quote
struct F{X} end
$e
end)
end
@repro (macro with 1 method)
julia> @repro
ERROR: syntax: unsupported `const` declaration on local variable around REPL[1]:6
Stacktrace:
[1] top-level scope
@ REPL[2]:1
julia> macro repro()
e = :(const B = F{X} where {X})
return esc(quote
struct F{X} end
$e
end)
end
@repro (macro with 1 method)
julia> @repro
F
Seems like the newline character breaks the expression when in a macro somehow
On nightly this works but it constructs an invalid name
julia> macro repro()
e = :(const B = F{X}
where {X})
return esc(quote
struct F{X} end
$e
end)
end
@repro (macro with 1 method)
julia> @repro
F
julia> B
F{X}
I'm updating one package and something strange is happening, I think it should be a bug in Julia. this is the PR in question https://github.com/Tortar/HybridStructs.jl/pull/3, the test code is valid and can be executed, but it actually throws in Julia 1.10 and Julia 1.11
and on nightly it constructs an invalid name
B = Union{B_Immut{X}, B_Mut{X}}
. See https://github.com/Tortar/HybridStructs.jl/actions/runs/11061551686/job/30734388810.For a reproducer you can dev that branch and execute
while you can see that this is valid code
Also, this instead works