JuliaSyntax.jl icon indicating copy to clipboard operation
JuliaSyntax.jl copied to clipboard

Interpolated `getproperty` syntax error

Open dennisYatunin opened this issue 11 months ago • 1 comments

I am seeing the following unexpected behavior with Julia version 1.10.2:

julia> foo(x) = x.:($(1 + 2)) + 0
ERROR: syntax: invalid syntax "x.((1 + 2))" around REPL[1]:1
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1

julia> foo(x) = x.:($(1 + 2)) += 0
ERROR: syntax: invalid syntax "x.(SSAValue(9))" around REPL[2]:1
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

julia> foo(x) = x.:($(1 + 2)) .+= 0
ERROR: syntax: invalid syntax "x.(SSAValue(16))" around REPL[3]:1
Stacktrace:
 [1] top-level scope
   @ REPL[3]:1

julia> foo(x) = x.:($(1 + 2)) .= 0
foo (generic function with 1 method)

All of these definitions work when they are written out as calls to getproperty, so it looks like this is hitting some uncaught edge case for expression interpolation.

dennisYatunin avatar Mar 18 '24 20:03 dennisYatunin