Skip to content

diagnostic: Report abstract field type information#418

Merged
aviatesk merged 1 commit intomasterfrom
avi/diagnostic-report-abstract-field
Dec 30, 2025
Merged

diagnostic: Report abstract field type information#418
aviatesk merged 1 commit intomasterfrom
avi/diagnostic-report-abstract-field

Conversation

@aviatesk
Copy link
Owner

Add a new Information level diagnostic (toplevel/abstract-field) that reports when a struct field has an abstract type. This helps catch potential performance issues caused by type instability.

The detection works by hooking into JuliaInterpreter.step_expr! and checking for Core._typebody! calls. When a struct is being defined, the field types are inspected using the new is_abstract_fieldtype helper function.

Currently detects cases like Vector{Integer} and AbstractVector{Int} but does not yet handle UnionAll types like Vector{<:Integer}.

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 90.27778% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.54%. Comparing base (63f1e31) to head (962f810).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/diagnostics.jl 87.17% 5 Missing ⚠️
src/analysis/full-analysis.jl 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #418      +/-   ##
==========================================
+ Coverage   64.31%   64.54%   +0.22%     
==========================================
  Files          44       44              
  Lines        5338     5378      +40     
==========================================
+ Hits         3433     3471      +38     
- Misses       1905     1907       +2     
Flag Coverage Δ
JETLS.jl 64.54% <90.27%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Add a new `Information` level diagnostic (`toplevel/abstract-field`)
that reports when a struct field has an abstract type. This helps catch
potential performance issues caused by type instability.

The detection works by hooking into `JuliaInterpreter.step_expr!` and
checking for `Core._typebody!` calls. When a struct is being defined,
the field types are inspected using the new `is_abstract_fieldtype`
helper function.

Currently detects cases like `Vector{Integer}` and `AbstractVector{Int}`
but does not yet handle `UnionAll` types like `Vector{<:Integer}`.
@aviatesk aviatesk force-pushed the avi/diagnostic-report-abstract-field branch from 3a016f6 to 962f810 Compare December 30, 2025 14:19
@aviatesk aviatesk changed the title diagnostic: Add abstract field type warning diagnostic: Add abstract field type information Dec 30, 2025
@aviatesk aviatesk changed the title diagnostic: Add abstract field type information diagnostic: Report abstract field type information Dec 30, 2025
@aviatesk aviatesk merged commit 0326720 into master Dec 30, 2025
12 of 13 checks passed
@aviatesk aviatesk deleted the avi/diagnostic-report-abstract-field branch December 30, 2025 14:46
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.

1 participant