Check ill body of contextual element early#4233
Closed
Myriad-Dreamin wants to merge 1 commit intotypst:mainfrom
Closed
Check ill body of contextual element early#4233Myriad-Dreamin wants to merge 1 commit intotypst:mainfrom
Myriad-Dreamin wants to merge 1 commit intotypst:mainfrom
Conversation
laurmaedje
added a commit
that referenced
this pull request
May 29, 2024
The current impl led to `Expr::default().to_untyped().cast::<Expr>()` yielding `None`, which is undesirable. Supersedes #4233. Because this crash was triggered by tooltip code, this also adds a bit of test scaffolding for tooltips and a few tooltip tests.
Member
|
Thanks for spotting this! This somewhat weird situation arises because we still evaluate malformed files for IDE stuff... I tried to fix this more generally in #4288, so that we don't run into such a problem again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When editing the code from
#{context text.font}to#{context}, thetypst_ide'sanalyze_exprpanics atsrc/eval/call.rs:286:68.typst/crates/typst/src/eval/call.rs
Lines 284 to 287 in 34f1a23
I printed the contextual element, and found that it is caused by the body of contextual expression
Eofis not an expression.It is strange that
typst-cliand webapp don't panic with this editing, but I indeed eliminate the panic by checking the legality of the body when constructing the contextual element.