Skip to content

Fix: let Revise.jl parse functions and docstrings correctly - #528

Open
borisdevos wants to merge 2 commits into
mainfrom
bd/revise
Open

Fix: let Revise.jl parse functions and docstrings correctly #528
borisdevos wants to merge 2 commits into
mainfrom
bd/revise

Conversation

@borisdevos

Copy link
Copy Markdown
Member

Revise.jl doesn't handle the tuple of functions with different arguments very well. I won't pretend to understand Revise internals well, but here what my robot friend told me:
"When Revise re-parses the file, it tries to evaluate that comma-tuple of signatures as a standalone expression to figure out what it documents — but a bare tuple of bodiless, where-qualified call signatures isn't valid to evaluate on its own, so it throws invalid "::" syntax and Revise gives up on the whole file (and stalls the REPL while doing so)."

This is solved by just splitting them in separate @doc blocks. Every block has 1 function with some arguments, which Revise can revise. The before and after behavior can be tested with Revise.revise(throw=true).

For obvious reasons, I want Revise to keep on revising when I'm busy in the internals. If I get a dime for every time I had to restart my REPL because of this, I'd have at least a dollar.

How the error looks like for the curious:

┌ Error: Failed to revise ...\TensorKit.jl\src\tensors\abstracttensor.jl
│   exception =
│    lowering returned an exception:$(Expr(:error, "invalid \"::\" syntax"))
└ @ Revise ...\.julia\packages\Revise\yd3HH\src\packagedef.jl:1491

@lkdvos

lkdvos commented Sep 7, 2026

Copy link
Copy Markdown
Member

Thanks for this, this had also bothered me quite a bit but never quite enough to actually try looking for a solution 😆. Am I understanding this right that you are now duplicating docstrings? I think there is some way of doing this without needing to copy the text, don't quote me on the exact syntax but @doc can be used both to document and retrieve docstrings, so something like @doc (@doc method1(...)) method2(...) could also do the trick

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/tensors/abstracttensor.jl 54.85% <ø> (+17.16%) ⬆️

... and 55 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@borisdevos

borisdevos commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

Docstrings were actually already duplicated, but now the signatures are split up, so it's somehow less duplicated 🫠 I'll look into your suggestion
Edit: I think I misunderstood what you meant, I thought you were referring to docstrings duplicating when calling ?help, but maybe you just meant code-wise?

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

Successfully merging this pull request may close these issues.

2 participants