-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Depth-limited printing of types in stacktraces #49231
Conversation
Print types in stacktraces up to a depth limited by screen size, printing deeper type-parameters as `...`. Complete info can be printed with a manual `show(err[1].backtrace[idx])`.
This seems like a reasonable way to do it. |
This is a good approach. Much better than the full stacktrace for newcomers. |
Chris, does this work for ODEIntegrator? I think there are cases where the problem is too many parameters, not too-deep parameters. |
I should also comment that I'm playing with the alternative approach I outlined at the top. I'm unsure which one will seem best by the end, but it seems worth trying, and if I like it at least on par with this one I'll submit it as an alternative PR. |
Having spent a couple days trying the alternative, I think this remains the best approach. Assuming, of course, that I can fix the last bug (it shouldn't yet traverse up the tree on |
As an update, this is getting closer but will need refactoring to handle printing of calls like |
I'm trying this out and it's really nice! We should go with this approach. Two suggestions that jumped out at me:
|
Print parametric types in stacktraces up to a depth limited by screen size, printing deeper type-parameters as
...
. Complete info can be printed with a manualshow(err[1].backtrace[idx])
.I'm posting this for feedback about the general approach, before investing more time in correctness, testing, etc. There are two ways you could go about this:
Perhaps surprisingly, this takes the latter approach. We do a lot of customization when we print types, like using aliases and interacting with the
IOContext
to signal whether we're deferring printingTypeVar
constraints. Given these customizations, it seemed to make sense to use the text output to ensure uniformity. That said, I can be persuaded to go the other way.If we like this proposal, then FoldingTrees.jl can be extended with specializations to allow interactive unfolding (but this plan would require an external package).
CC @ChrisRackauckas, @storopoli
Closes #48444
Demo (exhibiting some currently-buggy missing arguments):