Repository navigation
Fix empty 2-d math args with whitespace/trivia - #3786
Conversation
|
I realized that my initial commit failed to preserve empty content in arguments, so I reverted it and added new tests to expose the behavior change, and made a proper fix by still wrapping empty expressions in math mode, but after any trivia nodes, not before (by calling See the test update in the most recent commit for how this change affects math args. The biggest effect is converting 2-d arrays with whitespace/trivia from parsing with the whitespace at the top level, i.e. |
|
Note: I'm going to rebase and redo all the commits. I think #3584 is going to change the test outputs. |
bbced28 to
a74ed08
Compare
|
Updated. I did a force push and took the opportunity to remove the reverted commit from the branch so it doesn't show up on main (ofc it's still visible in the PR history). Again, note that the most relevant change to review is the diff between 95c6095 and 2a8673a. I also combined the wrap calls to just be |
|
I decided to merge #3922 first because the whole spirit of that PR is to not merge any further large reference images, so you'll unfortunately have to merge/rebase again. Sorry about that!
No need to worry about the history. I'll squash and merge anyway.
👍
In principle yes, but let's best first discuss it a bit, so that we're on the same page about what changes would be desirable. If you're on the Discord, doing it there in #contributors would be simplest. |
a74ed08 to
59ef625
Compare
|
Ok, new update:
Finally, I'll call out the |
|
Not 100% sure, but I think |
laurmaedje
left a comment
There was a problem hiding this comment.
I refactored the tests a bit to replace reference images for repr checks with in-code assertions against strings. While doing that I stumbled upon math-call-2d-semicolon-priority which is a bit weird. I would expect both to render the same way. Do you know what's going on here?
|
Thanks! |
Co-authored-by: Laurenz <[email protected]>
Co-authored-by: Laurenz <[email protected]>
Co-authored-by: Laurenz <[email protected]>
Fixes #3774
The issue was that
maybe_wrap_in_mathwould generate an AST with an empty "Math" element in-between the arrays, which the AST kindly parsed as an expression as empty content.The fix is to change
exprs != 1toexprs > 1so that we don't wrap math elements around nothing.Also added a new test to
math/matrix/typwith some examples.