F1: review follow-ups from the chain - #19
Merged
Merged
Conversation
15 tasks
Fixes seven findings raised against PRs #7-#15. All are addressed here, at the tip, so no branch in the chain has to be rewritten and rebased. model.rs: * `data class` now rejects a plain constructor parameter, in both the constructor and `ctor_param`. Kotlin requires every primary-ctor parameter of a data class to be a `val`/`var`. * `value class` now rejects a `var` or a plain parameter — it wraps a single *read-only* property. * `KtCompanion::named("")` panics instead of rendering `companion object ` with a dangling space. * `KtCompanion::extends` added. A companion object may extend a class; rendering and import collection already supported it, but no builder reached it, so the field had to be assigned directly, bypassing the one-superclass invariant. Both `extends` paths now share `KtSupertypes::set_superclass`. * `KtFun::modifier` checks each whitespace-separated word rather than the exact string, so `"external "` and `"external inline"` can no longer smuggle the keyword past the check. validate.rs: * Scope paths no longer gain a leading `/` in the root package (`Outer`, not `/Outer`). * Import-collision diagnostics report against the FIRST-registered FQN, which is the one `ImportSet` actually gives the simple name to. Previously three colliding imports named whichever was seen last. render.rs: KOTLIN_BANNER's doc said an override "falls back to" the constant, which is backwards — the fallback applies when there is no override. One review comment is not acted on: that `matches!(c.kind, ...)` moves out of a shared reference and cannot compile. It does compile — the pattern binds nothing, so nothing moves.
CI runs `cargo clippy --all-targets -- --deny warnings`, which rejects `KtDecl` because `Class(KtClass)` is 512 bytes against a next-largest variant of 264 — more than the 200-byte spread the lint allows. 232 of those 512 are the companion object, held inline by every class including the ones that have none. A2 removed its `Box` and justified it with "the indirection now comes from the `Vec<KtDecl>` inside `KtCompanion`" — true for recursion, which is why it compiled, but irrelevant to size, which is what the lint is about. Restoring the box takes `KtClass` to 288 against 264. A test pins the invariant so the next field added to `KtClass` fails here with an explanation rather than in CI with a lint name. My local checks missed this twice over: `cargo clippy --quiet` without `--deny warnings` suppressed it, and plain `cargo fmt` does not apply the unstable import options CI passes. Both exact commands now verified.
milyin
force-pushed
the
step/e2-rollout-and-docs
branch
from
August 6, 2026 11:40
ce16ec3 to
f13aef6
Compare
milyin
force-pushed
the
step/f1-review-fixes
branch
from
August 6, 2026 11:40
18159e0 to
4856236
Compare
milyin
changed the base branch from
step/e2-rollout-and-docs
to
docs/validation-umbrella
August 6, 2026 11:42
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.
Follow-up step of #6. Stacked on #18, at the tip of the chain.
Addresses the review findings raised against #7–#15. They land here rather
than in the branches they were raised on, so nothing in the chain has to be
rewritten and every stacked PR below stays mergeable as-is.
Correctness
data classaccepted a plain constructor parameterdata()andctor_param()— Kotlin requires every primary-ctor parameter of a data class to be aval/varvalue classaccepted avaror plain parameterKtCompanion::named("")renderedcompanion objectwith a dangling spaceKtCompanion::new()is the anonymous form: Base()through the builderKtCompanion::extendsadded.modifier("external ")bypassed the guardThe companion fix is the most substantive: rendering and import collection
already supported a companion's superclass, but no builder reached it, so a
consumer had to assign
supertypes.superclassdirectly — bypassing theone-superclass invariant #9 exists to enforce. Both
extendspaths now shareKtSupertypes::set_superclass, so neither can drift..modifier("external inline")is also caught now — modifier strings legitimatelyhold several keywords (
"final override"appears in the downstream consumer),so an exact-string compare was never sufficient. A modifier that merely
contains the substring (
externalish) still passes; there is a test.Diagnostics quality
/in the root package (B1: check that every declared name is a legal Kotlin identifier #15) —Outer, not/Outer. Onescope_joinhelper replaces nineformat!sites.(E1: diagnostics infrastructure #14) — which is the one
ImportSetactually gives the simple name to. Withthree colliding imports the report previously named whichever was seen most
recently, so it disagreed with the behaviour it was describing.
Documentation
KOTLIN_BANNER's doc said an override "falls back to" the constant, which isbackwards — the fallback applies when there is no override (#13).
One comment not acted on
#7 flagged that
matches!(c.kind, KtClassKind::Value { .. })"attempts to movekindout of&KtClass, which does not compile". It does compile: the patternbinds nothing, so nothing is moved. The code has been building and passing tests
since that commit.
Also already resolved by the chain
#14 flagged that
check_top_level_namesignoredKtDecl::FunInterface. Correctat that commit — E1 was a deliberate verbatim move — and fixed two steps later
by B2 (#16), which replaced that function with the namespace-aware walker.
Verification
All 88 pre-existing tests pass. Thirteen added, covering every fix plus the
must-not-fire cases (
val+vardata properties accepted,externalishaccepted).101 tests, 10 doctests,
cargo clippy --all-targetsclean.