Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser Failed with @(var"which") #441

Open
FeatherPurple opened this issue Jun 19, 2024 · 2 comments
Open

Parser Failed with @(var"which") #441

FeatherPurple opened this issue Jun 19, 2024 · 2 comments

Comments

@FeatherPurple
Copy link

Parser failed with some (admittedly weird) input. Installed Julia with curl -fsSL https://install.julialang.org | sh.

julia> macro var"@hi"() :(println("hi")) end
@@hi (macro with 1 method)

julia> @var"@hi"
hi

julia> @(var"@hi")
┌ Error: JuliaSyntax parser failed — falling back to flisp!
│ This is not your fault. Please submit a bug report to https://github.com/JuliaLang/JuliaSyntax.jl/issues
│   exception =
│    TypeError: in typeassert, expected String, got a value of type Nothing
│    [...]
│   offset = 0
│   code = "@(var\"@hi\")"
└ @ Base.JuliaSyntax /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-honeycrisp-XG3Q6T6R70.0/build/default-honeycrisp-XG3Q6T6R70-0/julialang/julia-release-1-dot-10/base/JuliaSyntax/src/hooks.jl:260
hi

julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 10 default, 0 interactive, 5 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_THREADS = 10
@pfitzseb
Copy link
Member

Hm, I feel like that's a bug in the flisp parser and should be a syntax error...

@LilithHafner
Copy link
Member

LilithHafner commented Jun 20, 2024

Slightly simpler example:

julia> var"@which" 1+1
ERROR: ParseError:
# Error @ REPL[6]:1:12
var"@which" 1+1
#          └──┘ ── extra tokens after end of expression
Stacktrace:
 [1] top-level scope
   @ none:1

julia> @var"which" 1+1
+(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}
     @ Base int.jl:87

julia> @(var"which") 1+1 # This line is the bug in question
┌ Error: JuliaSyntax parser failed — falling back to flisp!
│ This is not your fault. Please submit a bug report to https://github.com/JuliaLang/JuliaSyntax.jl/issues
│   exception =
│    TypeError: in typeassert, expected String, got a value of type Nothing
│    Stacktrace:
│      [1] untokenize(head::Base.JuliaSyntax.SyntaxHead; unique::Bool, include_flag_suff::Bool)
│        @ Base.JuliaSyntax /cache/build/tester-armageddon-11/julialang/julia-release-1-dot-11/base/JuliaSyntax/src/parse_stream.jl:103
[...]
│     [28] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
│        @ REPL ~/.julia/juliaup/julia-1.11.0-beta2+0.aarch64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:457
│   offset = 0
│   code = "@(var\"which\") 1+1"
└ @ Base.JuliaSyntax /cache/build/tester-armageddon-11/julialang/julia-release-1-dot-11/base/JuliaSyntax/src/hooks.jl:260
+(x::T, y::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}
     @ Base int.jl:87

@LilithHafner LilithHafner changed the title Parser Failed with @(var"@hi") Parser Failed with @(var"less") Jun 20, 2024
@LilithHafner LilithHafner changed the title Parser Failed with @(var"less") Parser Failed with @(var"which") Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants