Repository navigation
Let a root with entries rebind prelude constructors - #223
Merged
Merged
Conversation
The entry check re-reported clashes between the composed library's own constructors and the prelude's, which the library check had already accepted, so a root project that runs an entry could not declare its own opaque Bool or Result. The entry check now judges only the entry's own constructors. E1731 names the root's constructors as 'of this project'. Small test prose corrections.
Review follow-ups: the design names the same-type-name exception to the constructor collision rule, the interface lists entry constructors under E1731, and the test and slice prose no longer credit builtins with values the dependency's own code builds or claim a native run without a dependency.
jbwinters
enabled auto-merge (squash)
November 9, 2026 03:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Abstract-types hardening, seventh part: let a root project with entries rebind prelude constructor names.
A root project's library may declare its own type with a prelude type's name and constructors (for example
opaque type Bool = | False | True); the library check already accepted this, and the abstract-types decision record says roots may rebind prelude names. But once the project had an entry, the entry check re-counted the library'sTrueand the prelude'sTrueas two visible owners and refused the whole project with E1731, even when the entry declared nothing.Change:
src/project_frontend.ml: the entry check no longer re-reports clashes among the composed library, its direct dependencies and the prelude. The library check has already judged those, and the root is composed only after it passes. An entry's own constructors are still judged against everything visible, including the library's, so an entry declaringtype Flag = | Truebeside a reboundBoolis still E1731.of this projectinstead ofof the library.Tests:
test/cli/opaque-matrix.t: a root rebindingBoolandResultruns against its dependency on the interpreter and natively with identical output. The dependency's code and the builtins it calls return prelude values beside the root's<opaque bool>and<opaque result>. An entry's colliding constructor is refused. A root with no dependency runs on the interpreter. Relational-comparison prose now says exactly what the Int control shows.test/cli/project-local.t: updated wording.Docs and prose:
docs/designs/project-structure.mdstates the same-type-name exception and how entries are judged;src/project_frontend.mlilists entry constructors under E1731; a host-session test comment, the g54 gauntlet header and its MAPPING row are corrected;docs/release/0.3/SLICES.mdgains the seventh-part entry. The source inventory is unchanged at 1246 tests, 85 cram files, 57 doctest examples.Verification: full local gate (build,
dune runtest, formatting) exit 0 on the head.