Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

khepri_tree: Make tree_v*() and keep_while_conds_revidx_v*() opaque types #299

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

dumbbell
Copy link
Member

@dumbbell dumbbell commented Oct 1, 2024

Why

They should only be known by khepri_tree.

How

The definition of #tree{} is moved to the khepri_tree module and accessor functions are added and exported.

The types tree() and keep_while_conds_revidx() are kept as regular types because the opaque subtypes they group together are used directly. Moreover, if the generic types were marked as opaque too, Dialyzer would enter some infinite loop and never return.

At the same time, we rename khepri_tree.hrl to khepri_node.hrl. It no longer defines #tree{} and is now dedicated to the definition of #node{}.

@dumbbell dumbbell added the enhancement New feature or request label Oct 1, 2024
@dumbbell dumbbell added this to the v0.17.0 milestone Oct 1, 2024
@dumbbell dumbbell requested a review from the-mikedavis October 1, 2024 17:00
@dumbbell dumbbell self-assigned this Oct 1, 2024
@dumbbell dumbbell changed the title khepri_tree: Make tree_v*() and `keep_while_conds_revidx_v*() opaque types khepri_tree: Make tree_v*() and keep_while_conds_revidx_v*() opaque types Oct 1, 2024
…ue types

[Why]
They should only be known by `khepri_tree`.

[How]
The definition of `#tree{}` is moved to the `khepri_tree` module and
accessor functions are added and exported.

The types `tree()` and `keep_while_conds_revidx()` are kept as regular
types because the opaque subtypes they group together are used directly.
Moreover, if the generic types were marked as opaque too, Dialyzer would
enter some infinite loop and never return.
[Why]
It no longer defines `#tree{}` and is now dedicated to the definition of
`#node{}`.
@dumbbell dumbbell force-pushed the make-tree-type-opaque branch from 7067602 to e4b9f4a Compare October 1, 2024 17:01
Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.70%. Comparing base (caf1ae3) to head (e4b9f4a).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #299      +/-   ##
==========================================
+ Coverage   89.69%   89.70%   +0.01%     
==========================================
  Files          22       22              
  Lines        3259     3263       +4     
==========================================
+ Hits         2923     2927       +4     
  Misses        336      336              
Flag Coverage Δ
erlang-25 88.69% <100.00%> (+0.01%) ⬆️
erlang-26 89.45% <100.00%> (+0.16%) ⬆️
erlang-27 89.54% <100.00%> (+0.01%) ⬆️
os-ubuntu-latest 89.70% <100.00%> (+0.01%) ⬆️
os-windows-latest 89.61% <100.00%> (+0.19%) ⬆️

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.

@dumbbell dumbbell marked this pull request as ready for review October 1, 2024 17:16
@dumbbell dumbbell merged commit 81114c0 into main Oct 1, 2024
12 checks passed
@dumbbell dumbbell deleted the make-tree-type-opaque branch October 1, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants