Skip to content

refactor: represent virtual libraries via Lib_kind.t - #12276

Merged
shonfeder merged 11 commits into
ocaml:mainfrom
shonfeder:12253/virtual-lib-refactor
Aug 25, 2025
Merged

shonfeder merged 11 commits into
ocaml:mainfrom
shonfeder:12253/virtual-lib-refactor

Conversation

@shonfeder

@shonfeder shonfeder commented Aug 24, 2025 •

Copy link
Copy Markdown
Member

Closes #12253

The refactor here is quite straightforward, with the exception of maintaining backwards compat with current syntax of library stanzas. To achieve this, we infer kind virtual whenever virtual_modules are specified alongside a compatible kind (normal or virtual).

Two incidental improvements are also suggested here: small fixes to the docs and cleaning up a case analysis handling ppx_* kinds.

TODO

To wrap this up, I need

  • input on how to signal the right error for incompatible library specifications
  • add a test case to check the error handling of invalid cases

Reviewing

Initial review by commit is probably helpful, since the commits are broken into a few tiny, distinct phases.

@shonfeder
shonfeder force-pushed the 12253/virtual-lib-refactor branch 3 times, most recently from 0364151 to 7072da7 Compare August 24, 2025 15:10
Comment thread src/dune_lang/lib_kind.ml Resolved
Comment thread src/dune_rules/stanzas/library.ml Resolved
Comment thread src/dune_lang/lib_kind.ml Resolved
@shonfeder
shonfeder requested a review from rgrinberg August 24, 2025 17:09
Comment thread src/dune_rules/gen_meta.ml Resolved
Comment thread src/dune_rules/stanzas/library.ml Resolved
Comment thread src/dune_rules/dune_package.ml Resolved
@shonfeder
shonfeder force-pushed the 12253/virtual-lib-refactor branch 2 times, most recently from cadae32 to f320a5f Compare August 25, 2025 04:35
@shonfeder
shonfeder force-pushed the 12253/virtual-lib-refactor branch 2 times, most recently from a1ead07 to 0e163cb Compare August 25, 2025 16:29
@shonfeder
shonfeder marked this pull request as ready for review August 25, 2025 16:45
@shonfeder
shonfeder force-pushed the 12253/virtual-lib-refactor branch from f6d359c to 7f27f4e Compare August 25, 2025 16:48
@shonfeder

Copy link
Copy Markdown
Member Author

This should be ready for a final review pass. Thank you for the input @Alizter and @rgrinberg! It was very helpful :)

@shonfeder
shonfeder force-pushed the 12253/virtual-lib-refactor branch from 167e29b to 92058cf Compare August 25, 2025 20:37
@shonfeder

Copy link
Copy Markdown
Member Author

This is ready for review again :)

Comment thread src/dune_lang/lib_kind.mli Resolved
Signed-off-by: Shon Feder <[email protected]>
@shonfeder

Copy link
Copy Markdown
Member Author

Thanks for the review and patient guidance!

Signed-off-by: Shon Feder <[email protected]>
@shonfeder
shonfeder force-pushed the 12253/virtual-lib-refactor branch from 441f143 to 4aea40e Compare August 25, 2025 22:17
Signed-off-by: Shon Feder <[email protected]>
@shonfeder
shonfeder merged commit a88ec65 into ocaml:main Aug 25, 2025
@shonfeder
shonfeder deleted the 12253/virtual-lib-refactor branch August 25, 2025 23:02
@Alizter Alizter added this to the 3.21.0 milestone Jul 9, 2026
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.

Refactor representation of library virtuality to represent disjoint logic in the type system

3 participants