You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a fun yarn script that will break the compilation:
title: MyExample
---
one <<s/> y
===
It's invalid Yarn Spinner code to begin with but it's interesting to see how it bricks it.
It's kinda odd because the amount of characters decides whether it breaks or not. By that, I mean play around with adding/removing characters from the text on the left, center and right and it'll "sometimes" compiled but just with error diagnostics.
Here's the error:
thread 'main' panicked at /Users/katzen/.cargo/git/checkouts/yarnspinner-rust-907c57602d311b5a/e1aead0/crates/compiler/src/listeners/error_listener/diagnostic.rs:165:63:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Okay so I opened up the debugger and it turns out it's not the compiler that crashes but the printing of the Diagnostic:
let compilation = match compiler.compile(){Ok(compilation) => compilation,Err(compiler_err) => {println!("Failed to compile:");for diagnostic in&compiler_err.0{println!("{}", diagnostic);}continue;}};
Dunno why I didn't notice but the error is a coming from a util that Diagnostic's Display fmt uses.
Anyways, I think the compiler is generating some off ranges but given that it's broken yarn code anyways no need to fix, just wanted to show and tell :)
Huh, good catch! I wonder how the reference implementation in C# handles this 👀
I'll leave this issue open because at the very least, we should crash a bit more gracefully
Here's a fun yarn script that will break the compilation:
It's invalid Yarn Spinner code to begin with but it's interesting to see how it bricks it.
It's kinda odd because the amount of characters decides whether it breaks or not. By that, I mean play around with adding/removing characters from the text on the left, center and right and it'll "sometimes" compiled but just with error diagnostics.
Here's the error:
The offending code is here on the unwrap:
YarnSpinner-Rust/crates/compiler/src/listeners/error_listener/diagnostic.rs
Line 165 in 3e33157
I think it might also break the c# compiler because with their extension (that uses the C# code i think) it turns all text after this red :O
The text was updated successfully, but these errors were encountered: