Comments (3)
Of course, presumably an even more ergonomic approach would be VScode integration. Now that we have TypedSyntax, do you see other major barriers to implementing this? (In addition to the fact that TypedSyntax is a hack, albeit a useful one, that sometimes makes mistakes.)
Yes, I think JET should use TypedSyntax to display reported problems, since the current situation is also hacky and not very accurate (it tries to "infer" the original textual representation from the lowered form).
I have three concerns about integrating TypedSyntax into JET:
- JET actually has two different analyzers: the one for
report_call
inspects the unoptimized type-inferred lowered form, and the other forreport_opt
does so on the optimized type-inferred lowered form. Since, as far as I understand, TypedSyntax can work with unoptimized type-inferred lowered forms, I think we can integrate it with report_call only. Although this would be a significant improvement itself, to make it work with the optimized form, we would need to tweak base Julia so that the compiler maintains the original textual representation throughout the compilation pipeline. - Performance issues: I am mostly concerned about the performance cost. Under the current design, JET constructs an internal data structure during abstract interpretation that contains certain information (like the error location, the call signature, etc.) which is necessary for displaying JET's stacktrace-like view to users. The integration of TypedSyntax replaces this information with the new one that is required for TypedSyntax, so as long as the integration tries to show the stacktrace-like view to users, it needs to perform some computations during abstract interpretation. I am willing to accept some computational costs as the TypedSyntax-based view would be much nicer (and I don't think the current implementation is very optimized anyway), but I would like to make JET as fast as possible. If necessary, I am even fine with creating a new mode of JET where we forgo showing the stacktrace-like view and just show the error location to users. In this case, the performance cost would be negligible.
Additionally, we may need to make some changes to TypedSyntax: as far as I remember, TypedSyntax works on the unoptimized form where inference has been completed. However, if we maintain the current design of JET, we need to make it work on the unoptimized lowered form where inference is still in progress but when the type information about the statement in question is available.
from jet.jl.
Of course, presumably an even more ergonomic approach would be VScode integration. Now that we have TypedSyntax, do you see other major barriers to implementing this? (In addition to the fact that TypedSyntax is a hack, albeit a useful one, that sometimes makes mistakes.)
from jet.jl.
How do you feel about this idea?
I had never considered that, but it might be worth trying.
If you like it, one thing I'm not yet very familiar with is the API for manipulating the result of
report_call
. Any brief pointers on where to start reading?
You can get InferenceErrorReport
objects from result::JETCallResult
returned from report_call
with JET.get_reports(result)
. Each InferenceErrorReport
has the vst
field, that is a vector of Base.StackFrame
-like object, and you can find the errorneous MethodInstance
there.
julia> result = @report_call sum("julia");
julia> ascend(report.vst[end].linfo)
Choose a call for analysis (q to quit):
> add_sum(::Char, ::Char)
(::Base.BottomRF{typeof(Base.add_sum)})(::Char, ::Char)
_foldl_impl(::Base.BottomRF{typeof(Base.add_sum)}, ::Base._InitialValue, ::String)
foldl_impl(::Base.BottomRF{typeof(Base.add_sum)}, ::Base._InitialValue, ::String)
mapfoldl_impl(::typeof(identity), ::typeof(Base.add_sum), ::Base._InitialValue, ::String)
#mapfoldl#294(::Base._InitialValue, ::typeof(mapfoldl), ::typeof(identity), ::typeof(Base.add_sum), ::String)
mapfoldl(::typeof(identity), ::typeof(Base.add_sum), ::String)
#mapreduce#298(::Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, ::typeof(mapreduce), ::typeof(identity), ::typeof(Base.add_sum), ::String)
mapreduce(::typeof(identity), ::typeof(Base.add_sum), ::String)
v #sum#301(::Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, ::typeof(sum), ::typeof(identity), ::String)
from jet.jl.
Related Issues (20)
- JET doesn't analyze expression given to `@btime` HOT 5
- false positive MethodErrorReport Base.@kwdef with non used parameter HOT 1
- Use depth-limited type printing, from Julia 1.10 HOT 1
- @test_opt without the printing HOT 2
- Ignore given function name in `JET.test_package`
- Incomplete types break JET on Julia 1.10 HOT 1
- More readable "no method was found" messages with !Matched indication HOT 1
- Stack overflow in inference HOT 1
- Include submodules in `target_modules`?
- UI feature request: better (or at least larger) callstack browser HOT 1
- JET error `invalid lookup expr` with new `public` keyword HOT 7
- Julia nightly (1.12) failures HOT 1
- errors on 1.11.0-rc1 HOT 2
- Interaction with `ChainRulesCore.@non_differentiable` HOT 2
- Possible regression in Julia 1.11 for throw block HOT 3
- `AnyFrameModule` error HOT 3
- JET doesn't find errors when run in the tests HOT 2
- `skip_unoptimized_throw_blocks` does not ignore error exceptions
- Significant regression in TTFX, Julia 1.11
- `JET.@report_trim` or similar to find issues that would prevent trimming HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jet.jl.