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

Runic.AssertionError: nb != span(node) #15

Open
DanielVandH opened this issue Jul 12, 2024 · 6 comments
Open

Runic.AssertionError: nb != span(node) #15

DanielVandH opened this issue Jul 12, 2024 · 6 comments

Comments

@DanielVandH
Copy link

DanielVandH commented Jul 12, 2024

Great tool! I tried it out on DelaunayTriangulation.jl but I get an assertion error:

PS C:\Users\danjv\.julia\dev\DelaunayTriangulation.jl> julia -e 'using Runic; exit(Runic.main(ARGS))' -- --diff --inplace 'src/DelaunayTriangulation.jl'
Formatting `src/DelaunayTriangulation.jl` .................................... ✖
ERROR: Runic.AssertionError: `nb != span(node)`. This is unexpected, please file an issue with a reproducible example at https://github.com/fredrikekre/Runic.jl/issues/new.
Stacktrace:
 [1] trim_trailing_whitespace(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\runestone.jl:22
 [2] format_node!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:301
 [3] format_node_with_kids!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:233
 [4] format_node!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:325
 [5] format_node_with_kids!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:233
PS C:\Users\danjv\.julia\dev\DelaunayTriangulation.jl> 

I'm not sure I quite understand it. The contents of src/DelaunayTriangulation.jl is simply

module DelaunayTriangulation

include("setup.jl")

@static if USE_EXACTPREDICATES
    using ExactPredicates
end
using EnumX
using Random

include("data_structures.jl")
include("geometric_primitives.jl")
include("predicates.jl")
include("utils.jl")
include("algorithms.jl")
include("validation.jl")
include("exports.jl")


end

but when I put this into a new file, say test5.jl (as I was trying to do when making a smaller MWE for this issue..), everything works:

PS C:\Users\danjv\.julia\dev\DelaunayTriangulation.jl> julia -e 'using Runic; exit(Runic.main(ARGS))' -- --diff --inplace 'src/test5.jl'       
Formatting `src/test5.jl` .................................................... ✔
warning: in the working copy of 'a\test5.jl', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'b\test5.jl', LF will be replaced by CRLF the next time Git touches it
PS C:\Users\danjv\.julia\dev\DelaunayTriangulation.jl> gc src/test5.jl
module DelaunayTriangulation

include("setup.jl")

@static if USE_EXACTPREDICATES
    using ExactPredicates
end
using EnumX
using Random

include("data_structures.jl")
include("geometric_primitives.jl")
include("predicates.jl")
include("utils.jl")
include("algorithms.jl")
include("validation.jl")
include("exports.jl")


end
PS C:\Users\danjv\.julia\dev\DelaunayTriangulation.jl> 

Any ideas what's going wrong here? The tool works on other files in the repo like src/setup.jl, although the same error shows for src/exports.jl.

@fredrikekre
Copy link
Owner

Thanks for the report. Are you on windows? I think this might be fixed by JuliaLang/JuliaSyntax.jl#455 in that case. I asked for a new release earlier (JuliaLang/JuliaSyntax.jl#455 (comment)).

@DanielVandH
Copy link
Author

Yeah, on Windows. I'll try it again once that's released and see.

@fredrikekre
Copy link
Owner

Could also be related to:

warning: in the working copy of 'a\test5.jl', LF will be replaced by CRLF the next time Git touches it

I haven't really understood how line endings are handled by git on Windows.

@DanielVandH
Copy link
Author

That was just me running the test again for making the issue sorry, I should've cleared it. That shouldn't be related.

@DanielVandH
Copy link
Author

DanielVandH commented Jul 12, 2024

Or I'm wrong and it is related sorry. Just tried it again

PS C:\Users\danjv\.julia\dev\DelaunayTriangulation.jl> julia -e 'using Runic; exit(Runic.main(ARGS))' -- --inplace 'src/DelaunayTriangulation.jl'
Formatting `src/DelaunayTriangulation.jl` .................................... ✖
ERROR: Runic.AssertionError: `nb != span(node)`. This is unexpected, please file an issue with a reproducible example at https://github.com/fredrikekre/Runic.jl/issues/new.
Stacktrace:
 [1] trim_trailing_whitespace(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\runestone.jl:22
 [2] format_node!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:301
 [3] format_node_with_kids!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:233
 [4] format_node!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:325
 [5] format_node_with_kids!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:233
PS C:\Users\danjv\.julia\dev\DelaunayTriangulation.jl> julia -e 'using Runic; exit(Runic.main(ARGS))' -- --inplace 'src/test12.jl'             
Formatting `src/test12.jl` ................................................... ✖
ERROR: Runic.AssertionError: `nb != span(node)`. This is unexpected, please file an issue with a reproducible example at https://github.com/fredrikekre/Runic.jl/issues/new.
Stacktrace:
 [1] trim_trailing_whitespace(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\runestone.jl:22
 [2] format_node!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:301
 [3] format_node_with_kids!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:233
 [4] format_node!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:325
 [5] format_node_with_kids!(ctx::Runic.Context, node::Runic.Node)
   @ Runic C:\Users\danjv\.julia\packages\Runic\pOBbp\src\Runic.jl:233

Wouldn't be the complete issue I think since it breaks on a bunch of other files in my repo that I hadn't touched with Git first (unless Git is doing weird things that I'm unaware of, which is possible).

@fredrikekre
Copy link
Owner

I can't reproduce this even if I change all \n to \r\n. If you still have a file where this happens can you attach the file directly so that I get the exakt file and so that not bytes are lost in the copy-pasting.

fredrikekre added a commit to JuliaLang/JuliaSyntax.jl that referenced this issue Jul 13, 2024
Without this patch `\r\n\r\n` would be tokenized as `\r\n\r` and `\n`
instead of `\r\n` and `\r\n`. Fixes
fredrikekre/Runic.jl#15.
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

2 participants