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

Failing to parse broadcasted sum with square in indexing #833

Open
blegat opened this issue May 6, 2024 · 0 comments
Open

Failing to parse broadcasted sum with square in indexing #833

blegat opened this issue May 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@blegat
Copy link

blegat commented May 6, 2024

julia> x = [1, 2]; n = 1; I = 1:1;

julia> x[n^2 .+ I]
1-element Vector{Int64}:
 2

julia> JuliaFormatter.format_text("x[n^2 .+ I]")
ERROR: Error while PARSING formatted text:

1 x[n^2.+I]

...

Error occurred on line 1, offset 8 of formatted text.

The error might not be precisely on this line but it should be in the region of the code block. Try commenting the region out and see if that removes the error.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] format_text(cst::CSTParser.EXPR, style::DefaultStyle, s::JuliaFormatter.State)
   @ JuliaFormatter ~/.julia/packages/JuliaFormatter/7y9aN/src/JuliaFormatter.jl:314
 [3] format_text(text::String, style::DefaultStyle, opts::JuliaFormatter.Options)
   @ JuliaFormatter ~/.julia/packages/JuliaFormatter/7y9aN/src/JuliaFormatter.jl:243
 [4] #format_text#280
   @ ~/.julia/packages/JuliaFormatter/7y9aN/src/JuliaFormatter.jl:215 [inlined]
 [5] format_text
   @ ~/.julia/packages/JuliaFormatter/7y9aN/src/JuliaFormatter.jl:212 [inlined]
 [6] #format_text#279
   @ ~/.julia/packages/JuliaFormatter/7y9aN/src/JuliaFormatter.jl:209 [inlined]
 [7] format_text(text::String)
   @ JuliaFormatter ~/.julia/packages/JuliaFormatter/7y9aN/src/JuliaFormatter.jl:208
 [8] top-level scope
   @ REPL[8]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants