feat(types): add an optional invalid value hook - #1361
Merged
MilesCranmer merged 4 commits intoSep 10, 2026
Merged
Conversation
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
MilesCranmerBot
force-pushed
the
invalid-value-hook-bot
branch
from
September 10, 2026 17:32
31a072b to
46d3157
Compare
MilesCranmerBot
marked this pull request as ready for review
September 10, 2026 17:33
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
MilesCranmer
approved these changes
Sep 10, 2026
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.
Add optional
TypeSpec(init_invalid="() -> value")to defineDynamicExpressions.invalid_value(T). The result must have the generated type and failis_valid. Types without invalid states can omit the hook.Require SymbolicRegression
~2.4.1, which requires DynamicExpressions~2.11and supplies this API transitively. Existing positional TypeSpec arguments retain their positions.Verification
init_invalid; the oldinvalidkeyword was rejected.