Develop - #34
Open
fabriceHategekimana wants to merge 22 commits into
Open
Develop#34fabriceHategekimana wants to merge 22 commits into
fabriceHategekimana wants to merge 22 commits into
Conversation
Grounds each in the current compiler (0.5.12) instead of leaving them
open: Lang::RFunction carries no default values or `...` handling
today (so arity checking is exactly parameters.len(), no fallback
needed), the untyped-call result stays Any rather than Foreign<Any>,
and R { ... } blocks are explicitly out of scope since they already
type-check as Type::Empty, not Type::Any, with different unification
rules.
Opens the RFC for the review this repo's rfcs/README.md describes —
it previously landed on develop without going through that process.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
Per rfcs/README.md: on acceptance the file is renamed to the PR's own number and the header filled in. Tracking issue #29 opened for the implementation (J0 of registry.md's plan). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
RFC 0000: resolve open questions on calling untyped R functions
`Lang::RFunction` (`function(a, b) { ... }`) now types as a real
`(Any, ..., Any) -> Any` function with n parameters, instead of the
0-ary `Type::UnknownFunction` placeholder that made any call with
arguments a type error. `Type::UnknownFunction` (used for preloaded
untyped base-R builtins like `Position`, `t`, `Reduce`) becomes
variadic for the same reason — fixing only `RFunction` would leave
the bug reachable through every untyped base-R name.
- `processes/type_checking/mod.rs`: `Lang::RFunction`'s typing rule
builds a `Type::Function` with n `Any` params -> `Any`.
- `components/type/mod.rs` and `components/type/function_type.rs`:
`Type::UnknownFunction`'s conversion to `FunctionType` is now a
single variadic `Any` parameter -> `Any`.
- `components/error_message/type_error.rs`: new `TypeError::
UntypedFunctionArity` (T044) replaces the confusing "no signature
matches () -> UnknownFunction" message with the RFC's proposed
wording when an untyped function is called with the wrong arity.
- `processes/type_checking/function_application.rs`: wires the new
error in, using `FunctionType::is_r_function()` to detect the
untyped-function shape.
- `cases/0062-0064`: regression cases for the callable case, the
arity error message, and the preloaded-builtin case.
Bumps the `guard_any_type_call_count_is_tracked` baseline 19 -> 21:
two new `any_type()` calls in the `RFunction` typing arm, which is
the RFC's whole point, not a silent degradation.
Tracking issue: #29
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
…unctions Implement RFC 0028: make untyped R functions callable
Turns registry.md §5 (definition format), §7 (resolution/locking) and §8.3 (conflict order) into a committed contract: typr-def.toml manifests, since/until on FunctionMeta, external .ty loading gated by a project-configured trust threshold that degrades to Any (never a hard error), typr.lock, and typr types add/update/list/vendor. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
Status: draft -> accepted, file renamed to its assigned PR number (0031) per rfcs/README.md's process. Tracking issue to follow in a separate commit once opened. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
First checklist item of rfcs/0031-external-type-definitions.md (J2, #32): fix the manifest's shape as a real type instead of a TOML example in prose, and enforce the format_version gate the RFC requires ("the compiler reads old manifests it recognizes or refuses the ones it doesn't — it never silently misparses one"). - crates/typr-cli/src/type_definition.rs: DefinitionManifest and its sections (package/definition/provider/capabilities), parse_manifest() checking format_version against a raw toml::Value before attempting the typed parse, so an unsupported version is reported as exactly that rather than as a confusing missing-field error. - since/until added to FunctionMeta (typr-core's stdlib_meta.rs) and StdlibMeta (spg/model.rs), parsed identically to `ret`/`coercion` via the existing #! annotation parser — the per-entry override the RFC's reference section describes, kept a lossless mapping between the two structs. Nothing here fetches a repository, resolves typr.lock, or loads a definition into the type checker yet — those remain in #32. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ETPqhgWqDMt7UaUQXdxJmN
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014brvdoSu1AUJnY3mFzSc8C
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014brvdoSu1AUJnY3mFzSc8C
registry.md §8.2 and we-data-ch/registry's definitions/README.md already documented a `definitions/<pkg>/` monorepo path for long-tail Type Definitions, indexed via `"repository": "we-data-ch/registry"` — but RepoSpec/fetch only ever read `typr-def.toml` at a cloned repository's root, so two packages sharing that one repository could never both resolve (each `typr-def.toml` has exactly one `[package] name`). This extends `github:owner/repo[/subdir][@rev]` with an optional subdir, scopes fetch/digest/cache to that subdir when present, and widens the registry JSON schema's `repository` pattern and `entry_spec` parsing to match — unblocking J5's plan to land 30 generated definitions under one registry repo instead of 30 external ones. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014brvdoSu1AUJnY3mFzSc8C
… J6) Scoped-down implementation of "Add to Registry" — a CLI command that shells out to the caller's own authenticated `gh`/`git` (fork, branch, upsert packages/<pkg>.json, push, open PR) rather than the GitHub-App web backend §12/D6 describes and defers as a separate project. Runs the same checks as `typr types validate` first and refuses both a failing definition and a no-op PR. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014brvdoSu1AUJnY3mFzSc8C
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.
Ce que fait cette PR
Vérifications
cargo test --workspacepasse en localcargo fmt --allappliquétypr case runne montre aucunREGRESSSi cette PR touche le parseur ou le typage
cases/(typr case add) pour le comportementcorrigé, ou une raison de ne pas en ajouter est donnée ci-dessous
Si cette PR est une RFC
rfcs/0000-<slug>.md(le numéro est attribué à la fusion,c'est celui de cette PR) et suit
rfcs/0000-template.mdUne RFC ne se relit pas comme du code : les fils de commentaires se posent sur
les phrases. Évite de force-pusher par-dessus une relecture en cours. Voir
rfcs/README.md.
Si cette PR change une version
Les versions ne se modifient pas à la main :
nu publish.nu bump <niveau>puisnu publish.nu sync. Le jobcoherenceéchoue sinon. VoirRELEASING.md.