Skip to content

Commit

Permalink
Add reportkey
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Aug 17, 2024
1 parent 95e20bd commit 86e673e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/src/optanalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ report = @report_opt sumup(sin);
rpts = JET.get_reports(report)
```

!!! tip
If `rpts` is a long list, consider using `urpts = unique(reportkey, rpts)` to trim it.
See [`reportkey`](@ref).

Now you can `ascend` individual reports:

```
Expand Down
2 changes: 1 addition & 1 deletion src/JET.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module JET
export
# jetanalyzer
@report_call, report_call, @test_call, test_call,
report_file, test_file, report_package, test_package, report_text, test_text,
report_file, test_file, report_package, test_package, report_text, reportkey, test_text,
watch_file,
# optanalyzer
@report_opt, report_opt, @test_opt, test_opt,
Expand Down
10 changes: 10 additions & 0 deletions src/abstractinterpret/inferenceerrorreport.jl
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,16 @@ end
# utility
# -------

"""
reportkey(report::InferenceErrorReport)
Returns an identifier for the runtime-dispatched call site of `report`.
If you have a long list of reports to analyze, `urpts = unique(reportkey, rpts)` may remove "duplicates"
that arrive at the same runtime dispatch from different entry points.
"""
reportkey(report::InferenceErrorReport) = (report.sig.tt, report.vst[end].linfo)

# TODO parametric definition?

"""
Expand Down

0 comments on commit 86e673e

Please sign in to comment.