feature - support generic decorator factories (#640)#643
Merged
dannymeijer merged 4 commits intoMay 23, 2026
Conversation
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.
Summary
This PR extends the v0.3 user-defined decorator surface so decorator factories can be generic over the decorated function type. Libraries can now write one registration-style helper such as
registered[F](...) -> ((F) -> F), rely on inference from the decorated function, or provide an explicit decorator factory type argument like@registered[(str) -> ColumnExpr](...). The change also preserves concrete decorated source signatures through checked API metadata and imports, which unblocks catalog/decorator authoring without signature-specific factory helpers.Type of change
docs/RFCs/*)Area(s)
Select the primary areas touched (used for review routing; labels are managed separately):
Key details
((F) -> F). Checked API metadata continues to expose the concrete decorated function signature.Callable[[A, B], R]to(A, B) -> R.(func: _) => func.Testing / verification
make test/cargo testmake examples(if relevant)incan fmt --check .(if relevant)Manual verification notes:
cargo test -p incan_syntax test_parse_decorator_factory_with_explicit_type_argscargo test test_format_source_preserves_untyped_closure_paramscargo test test_user_defined_decorator_rejects_non_callable_and_factory_resultcargo test decorator_factorycargo test -p incan_corecargo run -p incan_core --bin generate_lang_referencetarget/debug/incan fmt /private/tmp/incan640debug/src/registry.incntarget/debug/incan tools metadata api /private/tmp/incan640debug/src/registry.incn --format jsonmake fmtmake pre-commitpassed, including fmt-check, rustdoc, 2449 nextest tests, clippy, cargo-deny, andsmoke-test-fastgit diff --check origin/release/v0.3..HEADDocs impact
If docs updated:
workspaces/docs-site/docs/language/reference/language.md,workspaces/docs-site/docs/language/reference/feature_inventory.md,workspaces/docs-site/docs/release_notes/0_3.md,workspaces/docs-site/docs/RFCs/closed/implemented/036_user_defined_decorators.mdChecklist
Closes #640