Skip to content

Conversation

@mhasel
Copy link
Member

@mhasel mhasel commented Nov 20, 2025

This PR enhances subrange type handling by storing range bounds as resolved constant expressions (TypeSize) instead of raw AST nodes, enabling proper debug info generation with computed range values.

Key Changes

  1. Store subrange bounds as resolved constant expressions
  • Changed SubRange storage from Box<Range<AstNode>> to Range<TypeSize>
    -> Range bounds are now stored as either literal integers or const expression references
  • Enables debug info generation to access resolved constant values
  • Added TypeSize::to_ast_node() to convert back to AST nodes when needed for range check calls
  1. Enhanced debug info generation for subranges
  • Subranges now generate unique DWARF typedefs based on resolved range bounds and backing type
    -> format: __SUBRANGE_{start}_{end}__{backing_type} (e.g., __SUBRANGE_0_100__DINT)
  • Typedef names are canonicalized and reused for identical subrange definitions
  • Subrange bounds which reference constant expressions (e.g., DINT(ZERO..(100+3)))
    are now properly resolved to their propagated values in debug info

@mhasel mhasel marked this pull request as ready for review November 24, 2025 15:46
@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 98.98990% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.01%. Comparing base (aca5a52) to head (d11216c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/typesystem.rs 90.90% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1551   +/-   ##
=======================================
  Coverage   95.00%   95.01%           
=======================================
  Files         175      175           
  Lines       56038    56127   +89     
=======================================
+ Hits        53239    53327   +88     
- Misses       2799     2800    +1     

☔ 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.

@mhasel mhasel requested review from ghaith and volsa November 24, 2025 15:54
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.

2 participants