Commit 8004e44
committed
ui: use stacktrace-like view for showing reports
Since the stacktrace view shown by Julia Base upon exception is more
familiar to general users, it would be better to use the same view for
showing JET's abstract stacktrace.
Previously JET tries to "infer" the textual code representation of the
call-sites of each stack-frame, but now JET does not need to do so, and
JET can show the method signature of each abstract stack-frame from
their `MethodInstance` that is already available. Therefore, this commit
may result in some performance improvement.
Note that JET still computes the textual code representation with type
annotations for each error point. We may replace that part with
TypedSyntax.jl in the future since it would be more robust and nicer.
\## Examples: `@report_call sum([])`
> Before
```julia
═════ 1 possible error found ═════
┌ @ reducedim.jl:996 Base.:(var"#sum#821")(:, pairs(NamedTuple()), #self#, a)
│┌ @ reducedim.jl:996 Base._sum(a, dims)
││┌ @ reducedim.jl:1000 Base.:(var"#_sum#823")(pairs(NamedTuple()), #self#, a, _3)
│││┌ @ reducedim.jl:1000 Base._sum(identity, a, :)
││││┌ @ reducedim.jl:1001 Base.:(var"#_sum#824")(pairs(NamedTuple()), #self#, f, a, _4)
│││││┌ @ reducedim.jl:1001 mapreduce(f, Base.add_sum, a)
││││││┌ @ reducedim.jl:357 Base.:(var"#mapreduce#814")(:, Base._InitialValue(), #self#, f, op, A)
│││││││┌ @ reducedim.jl:357 Base._mapreduce_dim(f, op, init, A, dims)
││││││││┌ @ reducedim.jl:365 Base._mapreduce(f, op, IndexStyle(A), A)
│││││││││┌ @ reduce.jl:432 Base.mapreduce_empty_iter(f, op, A, Base.IteratorEltype(A))
││││││││││┌ @ reduce.jl:380 Base.reduce_empty_iter(Base.MappingRF(f, op), itr, ItrEltype)
│││││││││││┌ @ reduce.jl:384 Base.reduce_empty(op, eltype(itr))
││││││││││││┌ @ reduce.jl:361 Base.mapreduce_empty(op.f, op.rf, T)
│││││││││││││┌ @ reduce.jl:372 Base.reduce_empty(op, T)
││││││││││││││┌ @ reduce.jl:352 Base.reduce_empty(+, T)
│││││││││││││││┌ @ reduce.jl:343 zero(T)
││││││││││││││││┌ @ missing.jl:106 Base.throw(Base.MethodError(zero, tuple(Base.Any)))
│││││││││││││││││ MethodError: no method matching zero(::Type{Any}): Base.throw(Base.MethodError(zero, tuple(Base.Any)::Tuple{DataType})::MethodError)
││││││││││││││││└──────────────────
```
> After
```julia
═════ 1 possible error found ═════
┌ sum(a::Vector{Any}) @ Base ./reducedim.jl:996
│┌ sum(a::Vector{Any}; dims::Colon, kw::Base.@kwargs{}) @ Base ./reducedim.jl:996
││┌ _sum(a::Vector{Any}, ::Colon) @ Base ./reducedim.jl:1000
│││┌ _sum(a::Vector{Any}, ::Colon; kw::Base.@kwargs{}) @ Base ./reducedim.jl:1000
││││┌ _sum(f::typeof(identity), a::Vector{Any}, ::Colon) @ Base ./reducedim.jl:1001
│││││┌ _sum(f::typeof(identity), a::Vector{Any}, ::Colon; kw::Base.@kwargs{}) @ Base ./reducedim.jl:1001
││││││┌ mapreduce(f::typeof(identity), op::typeof(Base.add_sum), A::Vector{Any}) @ Base ./reducedim.jl:357
│││││││┌ mapreduce(f::typeof(identity), op::typeof(Base.add_sum), A::Vector{Any}; dims::Colon, init::Base._InitialValue) @ Base ./reducedim.jl:357
││││││││┌ _mapreduce_dim(f::typeof(identity), op::typeof(Base.add_sum), ::Base._InitialValue, A::Vector{Any}, ::Colon) @ Base ./reducedim.jl:365
│││││││││┌ _mapreduce(f::typeof(identity), op::typeof(Base.add_sum), ::IndexLinear, A::Vector{Any}) @ Base ./reduce.jl:432
││││││││││┌ mapreduce_empty_iter(f::typeof(identity), op::typeof(Base.add_sum), itr::Vector{Any}, ItrEltype::Base.HasEltype) @ Base ./reduce.jl:380
│││││││││││┌ reduce_empty_iter(op::Base.MappingRF{typeof(identity), typeof(Base.add_sum)}, itr::Vector{Any}, ::Base.HasEltype) @ Base ./reduce.jl:384
││││││││││││┌ reduce_empty(op::Base.MappingRF{typeof(identity), typeof(Base.add_sum)}, ::Type{Any}) @ Base ./reduce.jl:361
│││││││││││││┌ mapreduce_empty(::typeof(identity), op::typeof(Base.add_sum), T::Type{Any}) @ Base ./reduce.jl:372
││││││││││││││┌ reduce_empty(::typeof(Base.add_sum), ::Type{Any}) @ Base ./reduce.jl:352
│││││││││││││││┌ reduce_empty(::typeof(+), ::Type{Any}) @ Base ./reduce.jl:343
││││││││││││││││┌ zero(::Type{Any}) @ Base ./missing.jl:106
│││││││││││││││││ MethodError: no method matching zero(::Type{Any}): Base.throw(Base.MethodError(zero, tuple(Base.Any)::Tuple{DataType})::MethodError)
││││││││││││││││└────────────────────
```
\## Example 2
```julia
getprop(x) = x.nonexist;
report_call((Regex,)) do r
getprop(r)
end
```
> Before
```julia
═════ 1 possible error found ═════
┌ @ REPL[30]:2 getprop(r)
│┌ @ REPL[29]:1 x.nonexist
││┌ @ Base.jl:37 Base.getfield(x, f)
│││ type Regex has no field nonexist
││└──────────────
```
> After
```julia
═════ 1 possible error found ═════
┌ (::var"#3#4")(r::Regex) @ Main ./REPL[12]:2
│┌ getprop(x::Regex) @ Main ./REPL[11]:1
││┌ getproperty(x::Regex, f::Symbol) @ Base ./Base.jl:37
│││ type Regex has no field nonexist: Base.getfield(x::Regex, f::Symbol)
││└────────────────────
```1 parent 717a6d0 commit 8004e44
File tree
8 files changed
+112
-152
lines changed- examples
- src
- abstractinterpret
- analyzers
- ui
- test
- abstractinterpret
- ui
8 files changed
+112
-152
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
543 | | - | |
| 543 | + | |
544 | 544 | | |
545 | | - | |
| 545 | + | |
546 | 546 | | |
547 | 547 | | |
548 | 548 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| |||
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | 73 | | |
76 | 74 | | |
77 | | - | |
| 75 | + | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | | - | |
83 | 80 | | |
84 | | - | |
| 81 | + | |
85 | 82 | | |
86 | 83 | | |
87 | 84 | | |
| |||
97 | 94 | | |
98 | 95 | | |
99 | 96 | | |
100 | | - | |
101 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
533 | 535 | | |
534 | 536 | | |
535 | 537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
| 520 | + | |
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
523 | | - | |
524 | | - | |
| 524 | + | |
| 525 | + | |
525 | 526 | | |
| 527 | + | |
526 | 528 | | |
527 | | - | |
| 529 | + | |
528 | 530 | | |
529 | 531 | | |
530 | 532 | | |
| |||
845 | 847 | | |
846 | 848 | | |
847 | 849 | | |
848 | | - | |
849 | 850 | | |
850 | 851 | | |
851 | 852 | | |
| |||
1105 | 1106 | | |
1106 | 1107 | | |
1107 | 1108 | | |
1108 | | - | |
1109 | 1109 | | |
1110 | 1110 | | |
1111 | | - | |
1112 | 1111 | | |
1113 | 1112 | | |
1114 | 1113 | | |
| |||
1218 | 1217 | | |
1219 | 1218 | | |
1220 | 1219 | | |
1221 | | - | |
| 1220 | + | |
1222 | 1221 | | |
1223 | 1222 | | |
1224 | 1223 | | |
| |||
1388 | 1387 | | |
1389 | 1388 | | |
1390 | 1389 | | |
1391 | | - | |
| 1390 | + | |
1392 | 1391 | | |
1393 | 1392 | | |
1394 | 1393 | | |
| |||
1401 | 1400 | | |
1402 | 1401 | | |
1403 | 1402 | | |
1404 | | - | |
1405 | 1403 | | |
1406 | 1404 | | |
1407 | 1405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
259 | 267 | | |
260 | 268 | | |
261 | 269 | | |
262 | | - | |
263 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
264 | 279 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
269 | 298 | | |
270 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
271 | 329 | | |
| 330 | + | |
272 | 331 | | |
273 | 332 | | |
274 | 333 | | |
275 | | - | |
276 | 334 | | |
277 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
278 | 343 | | |
279 | 344 | | |
280 | 345 | | |
281 | 346 | | |
282 | 347 | | |
283 | 348 | | |
284 | | - | |
| 349 | + | |
285 | 350 | | |
286 | 351 | | |
287 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
| 105 | + | |
107 | 106 | | |
108 | 107 | | |
109 | 108 | | |
| |||
0 commit comments