Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
2b6a00d
fix: scope codegraph batch complexity targets to file paths
carlos-alm Jul 5, 2026
b28051a
fix: exclude parameters and interface/type members from dead-role cla…
carlos-alm Jul 5, 2026
17fbcba
fix: credit import-type usages as exports consumers
carlos-alm Jul 5, 2026
26918bb
fix: prevent fn-impact/query crash when -f/--file is passed
carlos-alm Jul 5, 2026
be6432c
fix: correct exported-symbol detection for literal and object-literal…
carlos-alm Jul 5, 2026
4ead840
fix: exclude primitive type keywords from ast --kind string matching
carlos-alm Jul 5, 2026
f6326bf
fix: resolve call edges through renamed import specifiers
carlos-alm Jul 5, 2026
590f560
fix: couple file_hashes updates with edge regeneration in incremental…
carlos-alm Jul 5, 2026
d3ea4a4
fix: compare signature-change diffs using new-file line ranges
carlos-alm Jul 5, 2026
c306812
feat: add environment doctor check for stale native binary and missin…
carlos-alm Jul 5, 2026
8bb5893
fix: eliminate non-deterministic ordering in community detection
carlos-alm Jul 6, 2026
46037b1
fix: sync update-graph.sh hook extension allowlist with EXTENSIONS
carlos-alm Jul 6, 2026
6a84cf9
fix: recompute directory structure metrics for affected directories o…
carlos-alm Jul 6, 2026
8d936d1
refactor: register hardcoded execFileSync/execSync maxBuffer values i…
carlos-alm Jul 6, 2026
11c84be
fix: gate blast-radius check on newly introduced risk, not pre-existi…
carlos-alm Jul 6, 2026
963301a
fix: gate identifier-argument dynamic call edges on callback-acceptin…
carlos-alm Jul 6, 2026
3e8035d
fix: gate Array.from's callback arg by position, not just callee name
carlos-alm Jul 6, 2026
879635e
fix: scope reexportedSymbols to actually-named re-export specifiers
carlos-alm Jul 6, 2026
0fe9fc3
fix: stop CFG block/edge count from overriding AST-derived cyclomatic…
carlos-alm Jul 6, 2026
ccf3c19
fix: backfill edges.technique for incrementally-inserted calls edges
carlos-alm Jul 6, 2026
d5b1162
fix: wrap remote embedding JSON parse failure in EngineError
carlos-alm Jul 6, 2026
8971017
refactor: extract shared platform-default-path helper in config.ts
carlos-alm Jul 6, 2026
056c5e4
refactor: decompose loadConfig and related high-effort functions in c…
carlos-alm Jul 6, 2026
0738171
refactor: decompose findDbPath and openRepo in db/connection.ts (docs…
carlos-alm Jul 6, 2026
6f2423c
refactor: dedupe busy/locked error detection into isBusyOrLockedError
carlos-alm Jul 6, 2026
4c02378
fix: log statSync failures in findDbPath instead of silently swallowi…
carlos-alm Jul 6, 2026
0698e16
test: add direct unit coverage for closeDbPair/closeDbPairDeferred/cl…
carlos-alm Jul 6, 2026
4ac3b99
fix: correct blast-radius/fn-impact computation for line-shifted decl…
carlos-alm Jul 6, 2026
6767f09
feat: wire points-to solver max-iterations cap through DEFAULTS.analy…
carlos-alm Jul 6, 2026
5f6f30a
refactor: route console.log calls in domain/search through logger
carlos-alm Jul 6, 2026
b479318
refactor: reduce cyclomatic complexity of computeDeltaModularityDirected
carlos-alm Jul 6, 2026
c39ac40
refactor: unify impact-level rendering format between audit and fn-im…
carlos-alm Jul 6, 2026
067674f
refactor: dedupe computeSavings via pct helper and persist partial to…
carlos-alm Jul 6, 2026
f6807b4
fix: add main.rs driver to rust dynamic tracer fixture
carlos-alm Jul 6, 2026
1c07a54
fix: scope diff file-header detection to between-hunk positions
carlos-alm Jul 6, 2026
bf82aa2
fix: update titan-grind's dead-symbol script for current roles --json…
carlos-alm Jul 6, 2026
cd02d27
fix: thread configured busyTimeoutMs through remaining read-only quer…
carlos-alm Jul 6, 2026
980b5dc
fix: resolve computed string-literal keys in object-literal extractio…
carlos-alm Jul 6, 2026
4a873a3
fix: add same-class bare-call fallback to incremental rebuild path (d…
carlos-alm Jul 6, 2026
8f3348a
fix: unify Object.defineProperty accessor fallback kind-filtering bet…
carlos-alm Jul 6, 2026
acf804c
refactor: share chunked statement-cache primitive between builder and…
carlos-alm Jul 6, 2026
986c851
refactor: cache prepared statements in applyEdgeTechniquesAfterNative…
carlos-alm Jul 6, 2026
71e9174
fix: replace fixed-depth directory-proximity check with symmetric dis…
carlos-alm Jul 6, 2026
d2935cc
refactor: remove unreachable Partition delta-computation interface me…
carlos-alm Jul 6, 2026
6515186
fix: emit reference edges for function identifiers used as object-lit…
carlos-alm Jul 6, 2026
30c491a
refactor: unify call-ref and tests rendering format between audit and…
carlos-alm Jul 6, 2026
9db911b
fix: classify destructured bindings as constant, not function (docs c…
carlos-alm Jul 6, 2026
70559fc
refactor: adopt timeMedian in remaining benchmark timing loops
carlos-alm Jul 6, 2026
822e0eb
refactor: decompose runPerfBenchmarks in token-benchmark.ts
carlos-alm Jul 6, 2026
fcdfe7d
fix: attribute liveness to Lua functions assigned to global/builtin i…
carlos-alm Jul 6, 2026
ee6362c
refactor: extract shared sedi() helper for tracer scripts
carlos-alm Jul 6, 2026
d4e6212
fix: restore reflection dynamicKind for .call/.apply/.bind (docs chec…
carlos-alm Jul 6, 2026
aec5d2b
fix: restrict entry-role classification to function/method-kind symbo…
carlos-alm Jul 6, 2026
d250f8d
fix: credit destructured dynamic import() bindings as exports consumers
carlos-alm Jul 6, 2026
75978e2
fix: recognize Lua function nodes in complexity metrics computation (…
carlos-alm Jul 6, 2026
af17b6d
fix: scope global call-resolution fallback to same-language candidate…
carlos-alm Jul 6, 2026
dd447bc
fix: credit instanceof ClassName checks as exports consumers
carlos-alm Jul 6, 2026
a79a8a1
fix: update automated-review workflow to use current claude-code-acti…
carlos-alm Jul 6, 2026
d84f6b5
refactor: widen outputResult signature, remove redundant casts at cal…
carlos-alm Jul 6, 2026
e7a2255
fix: port Leiden algorithm to native Rust for cross-engine community-…
carlos-alm Jul 7, 2026
b54972a
feat: detect exported-symbol loss from full file deletion in checkNoS…
carlos-alm Jul 7, 2026
1821a8b
fix(complexity): scope summary stats to file/target/kind filters
carlos-alm Jul 7, 2026
d45aba7
fix(extractors): label property_signature interface/type members as k…
carlos-alm Jul 7, 2026
69d8a6f
fix(roles): exclude genuine class/struct properties from dead-role cl…
carlos-alm Jul 7, 2026
db08219
fix(resolver): scope extends/implements edges to same-file/import/lan…
carlos-alm Jul 7, 2026
79cd761
fix: track inline per-specifier type-only import modifier
carlos-alm Jul 7, 2026
cbfa954
fix(native): widen NativeRepository file filters to accept string[]
carlos-alm Jul 7, 2026
c0e7eae
fix(native): remove unused source param from get_first_call_arg
carlos-alm Jul 7, 2026
2dabe21
fix(extractors): align native/WASM definitions order for object-liter…
carlos-alm Jul 7, 2026
b1eb9af
fix(extractors): capture top-level const definitions regardless of in…
carlos-alm Jul 7, 2026
4a1e279
fix: exclude PHP scalar type-hint/cast keywords from ast --kind string
carlos-alm Jul 7, 2026
4df57b6
fix: resolve merge conflicts with main (docs check acknowledged)
carlos-alm Jul 9, 2026
95193ec
fix: correct vacuous PHP cast-test line assertion in ast-nodes.test.t…
carlos-alm Jul 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions crates/codegraph-core/src/extractors/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ pub struct LangAstConfig {
/// Single-char prefixes that can appear before string quotes (e.g. `r`, `b`, `f`, `u` for Python).
/// Multi-char combos like `rb`, `fr` are handled by stripping each char in sequence.
pub string_prefixes: &'static [char],
/// When true, a node is only classified if `node.is_named()` — guards against
/// anonymous grammar tokens whose `kind()` string collides with a named node
/// type mapped above (e.g. PHP's `primitive_type`/`cast_type` productions lex
/// the `string` scalar type-hint keyword as an unnamed token identical to the
/// named `string` literal node type). Mirrors the WASM-side
/// `astRequiresNamedNode()` guard in `ast-analysis/rules/index.ts`.
pub requires_named_node: bool,
}

// ── Per-language configs ─────────────────────────────────────────────────────
Expand All @@ -223,6 +230,7 @@ pub const PYTHON_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['\'', '"'],
string_prefixes: &['r', 'b', 'f', 'u', 'R', 'B', 'F', 'U'],
requires_named_node: false,
};

pub const GO_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -233,6 +241,7 @@ pub const GO_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"', '`'],
string_prefixes: &[],
requires_named_node: false,
};

pub const RUST_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -243,6 +252,7 @@ pub const RUST_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const JAVA_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -253,6 +263,7 @@ pub const JAVA_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const CSHARP_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -263,6 +274,7 @@ pub const CSHARP_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const RUBY_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -273,6 +285,7 @@ pub const RUBY_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &["regex"],
quote_chars: &['\'', '"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const PHP_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -283,6 +296,7 @@ pub const PHP_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['\'', '"'],
string_prefixes: &[],
requires_named_node: true,
};

pub const C_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -293,6 +307,7 @@ pub const C_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const CPP_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -303,6 +318,7 @@ pub const CPP_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &['L', 'u', 'U', 'R'],
requires_named_node: false,
};

/// CUDA is a C++ superset; the tree-sitter-cuda grammar extends C++ with
Expand All @@ -317,6 +333,7 @@ pub const CUDA_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &['L', 'u', 'U', 'R'],
requires_named_node: false,
};

pub const KOTLIN_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -327,6 +344,7 @@ pub const KOTLIN_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const SWIFT_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -337,6 +355,7 @@ pub const SWIFT_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const SCALA_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -347,6 +366,7 @@ pub const SCALA_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const BASH_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -357,6 +377,7 @@ pub const BASH_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"', '\''],
string_prefixes: &[],
requires_named_node: false,
};

pub const ELIXIR_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -367,6 +388,7 @@ pub const ELIXIR_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &["sigil"],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const LUA_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -377,6 +399,7 @@ pub const LUA_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['\'', '"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const DART_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -387,6 +410,7 @@ pub const DART_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['\'', '"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const ZIG_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -397,6 +421,7 @@ pub const ZIG_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const HASKELL_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -407,6 +432,7 @@ pub const HASKELL_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"', '\''],
string_prefixes: &[],
requires_named_node: false,
};

pub const OCAML_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -417,6 +443,7 @@ pub const OCAML_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

// F# string nodes in tree-sitter-fsharp surface under the `string` kind inside
Expand All @@ -429,6 +456,7 @@ pub const FSHARP_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

/// Objective-C string literals use the `@"..."` prefix. The shared
Expand All @@ -442,6 +470,7 @@ pub const OBJC_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const GLEAM_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -452,6 +481,7 @@ pub const GLEAM_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const JULIA_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -462,6 +492,7 @@ pub const JULIA_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const CLOJURE_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -472,6 +503,7 @@ pub const CLOJURE_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &["regex_lit"],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const ERLANG_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -482,6 +514,7 @@ pub const ERLANG_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const GROOVY_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -495,6 +528,7 @@ pub const GROOVY_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['\'', '"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const R_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -506,6 +540,7 @@ pub const R_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['\'', '"'],
string_prefixes: &[],
requires_named_node: false,
};

pub const SOLIDITY_AST_CONFIG: LangAstConfig = LangAstConfig {
Expand All @@ -516,6 +551,7 @@ pub const SOLIDITY_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"', '\''],
string_prefixes: &[],
requires_named_node: false,
};

/// Verilog/SystemVerilog AST config.
Expand All @@ -533,6 +569,7 @@ pub const VERILOG_AST_CONFIG: LangAstConfig = LangAstConfig {
regex_types: &[],
quote_chars: &['"'],
string_prefixes: &[],
requires_named_node: false,
};

// ── Generic AST node walker ──────────────────────────────────────────────────
Expand Down Expand Up @@ -565,7 +602,18 @@ pub fn walk_ast_nodes_with_config(

/// Classify a tree-sitter node against the language AST config.
/// Returns the AST kind string if matched, or `None` to skip.
fn classify_ast_node<'a>(kind: &str, config: &'a LangAstConfig) -> Option<&'a str> {
///
/// When `config.requires_named_node` is set, anonymous grammar tokens are
/// rejected even if their `kind()` string matches a mapped type — e.g. PHP's
/// `primitive_type`/`cast_type` productions lex the `string` scalar
/// type-hint keyword as an unnamed token whose `kind()` collides with the
/// named `string` literal node (#1821, mirrors TypeScript's `predefined_type`
/// guard from #1729).
fn classify_ast_node<'a>(node: &Node, config: &'a LangAstConfig) -> Option<&'a str> {
if config.requires_named_node && !node.is_named() {
return None;
}
let kind = node.kind();
if config.new_types.contains(&kind) {
Some("new")
} else if config.throw_types.contains(&kind) {
Expand Down Expand Up @@ -673,7 +721,7 @@ fn walk_ast_nodes_with_config_depth(
return;
}

if let Some(ast_kind) = classify_ast_node(node.kind(), config) {
if let Some(ast_kind) = classify_ast_node(node, config) {
match ast_kind {
"new" => {
ast_nodes.push(build_new_node(node, source));
Expand Down
43 changes: 30 additions & 13 deletions src/ast-analysis/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,20 +383,37 @@ export function astStopRecurseKinds(langId: string): ReadonlySet<string> {

// ─── Per-language "named-node-required" guard ────────────────────────────
//
// tree-sitter-typescript's `predefined_type` production (the `string`,
// `number`, `boolean`, `void`, ... primitive type keywords) lexes its
// keyword as an anonymous grammar token whose `type` string is identical to
// the *named* `string` node type used for real string literals — the
// grammar's own node-types.json lists both a `"string", named: true` entry
// (the literal) and a `"string", named: false` entry (the keyword token).
// Matching by `node.type` alone therefore misclassifies `name: string`
// type annotations as string-literal ast_nodes (#1729). Mirrors the native
// `is_named()` guard in `extractors/javascript.rs::walk_ast_nodes_depth`.
// Some grammars reuse the same `type` string for two different node-types
// entries: a *named* node (a real literal) and an *anonymous* token (a
// keyword). Matching by `node.type` alone misclassifies the keyword as the
// literal. Two bundled grammars currently hit this:
//
// Scoped to the JS family: no other bundled grammar currently maps an
// AST_TYPE_MAPS key that collides with an anonymous token of the same name.
const JS_REQUIRES_NAMED_NODE: ReadonlySet<string> = new Set(['javascript', 'typescript', 'tsx']);
// - tree-sitter-typescript's `predefined_type` production (the `string`,
// `number`, `boolean`, `void`, ... primitive type keywords) lexes its
// keyword as an anonymous grammar token whose `type` string is identical
// to the *named* `string` node type used for real string literals —
// node-types.json lists both a `"string", named: true` entry (the
// literal) and a `"string", named: false` entry (the keyword token).
// `name: string` type annotations were misclassified as string-literal
// ast_nodes (#1729).
// - tree-sitter-php's `primitive_type`/`cast_type` productions (scalar
// type-hints like `string $x` and casts like `(string)`) lex the `string`
// keyword the same anonymous way, colliding with PHP's *named* `string`
// literal node type (#1821).
//
// Mirrors the native `is_named()`/`requires_named_node` guards in
// `extractors/javascript.rs::walk_ast_nodes_depth` (JS bespoke walker) and
// `extractors/helpers.rs::classify_ast_node` (generic walker, PHP config).
//
// A language is added here only when a `node-types.json` sweep confirms an
// AST_TYPE_MAPS key collides with an anonymous token of the same name.
const REQUIRES_NAMED_NODE: ReadonlySet<string> = new Set([
'javascript',
'typescript',
'tsx',
'php',
]);

export function astRequiresNamedNode(langId: string): boolean {
return JS_REQUIRES_NAMED_NODE.has(langId);
return REQUIRES_NAMED_NODE.has(langId);
}
10 changes: 6 additions & 4 deletions src/ast-analysis/visitors/ast-store-visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,15 @@ function collectNode(ctx: CollectCtx, node: TreeSitterNode, kind: string): void
* grammar tokens are rejected even though their `type` string matches a
* mapped key — e.g. TypeScript's `predefined_type` keyword (`string`,
* `number`, ...) lexes as an unnamed token whose type collides with the
* named `string` literal node (#1729). Scoped to just those two node types
* (not every mapped kind) to mirror the native `is_named()` guard, which
* only appears on the `"string" | "template_string"` match arm in
* named `string` literal node (#1729), and PHP's `primitive_type`/`cast_type`
* keyword (`string`) collides the same way (#1821). Scoped to just those two
* node types (not every mapped kind) to mirror the native `is_named()` guard,
* which only appears on the `"string" | "template_string"` match arm in
* `extractors/javascript.rs::walk_ast_nodes_depth` — every other mapped kind
* (call, new, throw, await, regex) is always a named production, so gating
* them too would silently diverge from the native engine's behavior the
* moment that stops being true.
* moment that stops being true. See `astRequiresNamedNode()` in
* `../rules/index.ts` for the full requireNamedNode language list.
*/
const NAMED_NODE_REQUIRED_TYPES: ReadonlySet<string> = new Set(['string', 'template_string']);

Expand Down
3 changes: 2 additions & 1 deletion tests/engines/ast-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,11 @@ end
ext: '.php',
code: `<?php
class App {
public function run() {
public function run(string $label): string {
$s = "hello world";
$o = new \\RuntimeException("bad");
throw $o;
return (string) $label;
}
}
`,
Expand Down
9 changes: 9 additions & 0 deletions tests/parsers/ast-all-langs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,15 @@ describe.skipIf(!canTestMultiLang)('native AST nodes — multi-language', () =>
).toBe(true);
});

test('PHP: does not misclassify scalar type-hint keyword as kind:string (#1821)', () => {
// `string $name` (createUser's parameter, line 233) must never surface as a
// bare, unquoted "string" row — genuine literals are always quoted in `text`.
const strings = db
.prepare("SELECT * FROM ast_nodes WHERE kind = 'string' AND file LIKE '%fixture.php'")
.all();
expect(strings.some((n) => n.text === 'string')).toBe(false);
});

// ── Cross-language ──

test('all nodes have valid kinds', () => {
Expand Down
Loading
Loading