feat(kernel): R7b Kotlin walker — kotlin module, vendored-grammar-C build, kotlin default-routed (#1382)
Sixth R7b port — the T1½ batch finale. Checklist-first recipe
(docs/design/kotlin-kernel-port-checklist.md, 1,121 lines, dist-extractor
ground truth); parity passed FIRST RUN on all three repos.
THE NOVEL MECHANISM — vendored-grammar-C (the §4 tracker's prescription,
first use): the crates.io tree-sitter-kotlin 0.3.8 pins `tree-sitter >= 0.21,
< 0.23` (the kernel links 0.25) and tree-sitter-kotlin-ng is a DIFFERENT
grammar (8 fields vs 0, renamed kinds — extractor-breaking), so no crate dep
is possible. The fwcd 0.3.8 tag's sha-matched parser.c + scanner.c are
vendored into codegraph-kernel/grammars/kotlin and compiled by build.rs (cc),
exposed via tree-sitter-language::LanguageFn. The wasm re-vendor is
behavior-NEUTRAL (0 CST/error disagreements across 1,984 gate-repo files;
old-vs-new full-init dumps byte-identical ×3) — a reproducibility re-vendor,
ABI stays 14.
Walker firsts: extension-function receivers (getReceiverType →
`WidgetK::extend` QN OVERRIDE with no package prefix, the qualified-receiver
`com::qext` first-segment bug, and the owner-contains fallback that excludes
`interface` kinds and is source-order dependent) and extractModifiers
(expect/actual platform modifiers → the node DECORATORS wire field on every
created node — the KMP synthesizer's feed, incl. `actual typealias`).
Preserved bug-for-bug: the FIELD_COUNT-0 dead cluster (no signatures, ZERO
type-annotation refs), hook-consumed property initializers emitting nothing
(incl. `by lazy {}`), the bodiless-vs-bodied class header asymmetry, enum-
entry bodies being invisible, KDoc never a docstring AND chain-breaking,
comment-gluing into import/package extents, `@Anno(args)` emitting nothing
while `@Marker` decorates, zero instantiates refs, the paren-then-lambda
`trailing()` garbage callee, text-includes visibility/suspend false
positives, and the packaged-file value-ref target drop. The fun-interface
misparse-recovery hook is DEFER-SHIELDED (every such file has_error) and
deliberately not ported. The swift-sweep lesson pre-applied: the shared
`assignment` shadow-prune case is implemented alongside the
property_declaration case.
Gates: sweeps 0-diff okio 299/322, okhttp 531/580, kotlinx.coroutines
1031/1082 (deferrals exactly the predicted 23/49/51 — both-arm grammar
reality incl. PHANTOM hasError files with complete CSTs; the kernel trusts
the flag); full-init dumps byte-identical ×3 (46.5k/108.9k/92.3k lines); KMP
expect/actual synthesis IDENTICAL across arms (412 edges on
kotlinx.coroutines — the tracker's KMP validation); kernel-kotlin-parity
suite (torture reflowed off the phantom shapes + .kts script + CRLF variants
+ fun-interface and phantom defer pins) + kotlin grammar-parity row (the
C-build ↔ wasm table identity proof); full suite 2,633 green ×2 under
CODEGRAPH_KERNEL_EXPECT=1. DEFAULT_ROUTED += kotlin (15 langs).
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
09e301bbfa
commit
45a53eb5b5
@@ -322,6 +322,14 @@ const VENDORED_WASM_LANGS: ReadonlySet<GrammarLanguage> = new Set([
|
||||
// (ABI 13 → 15). NOT graph-neutral — delta is error-set membership only;
|
||||
// classified list in the swift checklist doc.
|
||||
'swift',
|
||||
// R7b (Kotlin kernel port prep): fwcd tree-sitter-kotlin 0.3.8 (tag
|
||||
// e1a2d5a), parser.c/scanner.c sha-matched crate↔tag; behavior-IDENTICAL
|
||||
// to the tree-sitter-wasms build (0 CST/error disagreements across the
|
||||
// gate repos) — a reproducibility re-vendor, ABI stays 14. The crates.io
|
||||
// crate is UNUSABLE by the kernel (pins tree-sitter <0.23) and
|
||||
// tree-sitter-kotlin-ng is a different grammar — the kernel compiles the
|
||||
// same vendored C sources instead (codegraph-kernel/grammars/kotlin).
|
||||
'kotlin',
|
||||
]);
|
||||
|
||||
/** Absolute path of a language's grammar WASM (vendored or tree-sitter-wasms). */
|
||||
|
||||
@@ -74,6 +74,13 @@ const DEFAULT_ROUTED: ReadonlySet<Language> = new Set<Language>([
|
||||
// is structurally 9–27% on BOTH arms (heavy #if conditionalization) —
|
||||
// sweeps run --max-deferral 0.3; a deferral-rate JUMP is the bug signal.
|
||||
'swift',
|
||||
// R7b (2026-07-20): parity swept 0-diff on okio/okhttp/kotlinx.coroutines
|
||||
// (1,861 clean files byte-parity; KMP expect/actual synthesis identical —
|
||||
// 412 edges both arms on kotlinx.coroutines) + full-init dump-diffs
|
||||
// byte-identical ×3. Deferral 4.7–8.5% both-arm grammar reality
|
||||
// (fun-interface misparses + PHANTOM hasError files) — default sweep guard
|
||||
// holds; a JUMP past ~10% is the bug signal.
|
||||
'kotlin',
|
||||
]);
|
||||
|
||||
/**
|
||||
|
||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user