From 57e30c1eae9a25ac396b2d4b44034274b6fb0c41 Mon Sep 17 00:00:00 2001 From: Swapnil <78632212+swapnilpaliwal-sd@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:23:01 -0800 Subject: [PATCH 1/2] release 0.2.4: every package and plugin manifest at 0.2.4 (the parser keeps its own version) 0.2.3 is released, so what merges into this branch ships in 0.2.4. package.json (version and the five @axiomcode/engine-* pins) and the four editor plugin and extension manifests move from 0.2.3 to 0.2.4. The parser keeps its own version. --- gemini-extension.json | 2 +- package.json | 12 ++++++------ plugins/axiomcode/.claude-plugin/plugin.json | 2 +- plugins/axiomcode/.codex-plugin/plugin.json | 2 +- plugins/axiomcode/.cursor-plugin/plugin.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gemini-extension.json b/gemini-extension.json index 61a14197f..9cfece080 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "axiomcode", - "version": "0.2.3", + "version": "0.2.4", "description": "Ask your repository how its code connects: who calls this, what breaks if I change it, which tests an edit reaches, how A reaches B. Answers come from a resolved call graph and are verified against it; nothing is guessed.", "contextFileName": "plugins/axiomcode/AGENTS.md", "mcpServers": { diff --git a/package.json b/package.json index c1fd43e95..144dabe85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@axiomcode/code-graph", - "version": "0.2.3", + "version": "0.2.4", "description": "AxiomCode Graph: a resolved call graph of your codebase grounded in formal methods, so you and your coding agents can see who calls what, what a change breaks, and which tests it reaches.", "repository": { "type": "git", @@ -31,11 +31,11 @@ ], "license": "FSL-1.1-Apache-2.0", "optionalDependencies": { - "@axiomcode/engine-darwin-arm64": "0.2.3", - "@axiomcode/engine-darwin-x64": "0.2.3", - "@axiomcode/engine-linux-x64": "0.2.3", - "@axiomcode/engine-linux-arm64": "0.2.3", - "@axiomcode/engine-win32-x64": "0.2.3" + "@axiomcode/engine-darwin-arm64": "0.2.4", + "@axiomcode/engine-darwin-x64": "0.2.4", + "@axiomcode/engine-linux-x64": "0.2.4", + "@axiomcode/engine-linux-arm64": "0.2.4", + "@axiomcode/engine-win32-x64": "0.2.4" }, "bin": { "axiomcode": "bin/axiomcode.js" diff --git a/plugins/axiomcode/.claude-plugin/plugin.json b/plugins/axiomcode/.claude-plugin/plugin.json index a45810eee..55c135b5e 100644 --- a/plugins/axiomcode/.claude-plugin/plugin.json +++ b/plugins/axiomcode/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "axiomcode", "description": "Ask your repository how its code connects: who calls this, what breaks if I change it, which tests an edit reaches, how A reaches B. Answers come from a resolved call graph and are verified against it; nothing is guessed.", - "version": "0.2.3", + "version": "0.2.4", "author": { "name": "AxiomCode" } diff --git a/plugins/axiomcode/.codex-plugin/plugin.json b/plugins/axiomcode/.codex-plugin/plugin.json index 29c2ba521..c5a0c074c 100644 --- a/plugins/axiomcode/.codex-plugin/plugin.json +++ b/plugins/axiomcode/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "axiomcode", - "version": "0.2.3", + "version": "0.2.4", "description": "Ask your repository how its code connects: who calls this, what breaks if I change it, which tests an edit reaches, how A reaches B. Answers come from a resolved call graph and are verified against it; nothing is guessed.", "author": { "name": "AxiomCode", "url": "https://github.com/AxiomCodeAI/axiomcodegraph" }, "homepage": "https://github.com/AxiomCodeAI/axiomcodegraph", diff --git a/plugins/axiomcode/.cursor-plugin/plugin.json b/plugins/axiomcode/.cursor-plugin/plugin.json index fadd636d0..a797bda89 100644 --- a/plugins/axiomcode/.cursor-plugin/plugin.json +++ b/plugins/axiomcode/.cursor-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "axiomcode", - "version": "0.2.3", + "version": "0.2.4", "description": "Ask your repository how its code connects: who calls this, what breaks if I change it, which tests an edit reaches, how A reaches B. Answers come from a resolved call graph and are verified against it; nothing is guessed. Java, TypeScript, Python, JavaScript.", "author": { "name": "AxiomCode" }, "homepage": "https://github.com/AxiomCodeAI/axiomcodegraph", From 272f1af57e0812fc98634b84444976e1fdfdb524 Mon Sep 17 00:00:00 2001 From: Swapnil <78632212+swapnilpaliwal-sd@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:36:23 -0800 Subject: [PATCH 2/2] typescript: a call to a function-literal const no longer also names its annotation's signature (#2005) A call to a const annotated with a callable type and holding a function literal resolved two ways: the literal's body and the annotation's bodiless call signature. Rule (3) in callee-resolution.dl added the signature of the callee's expr_type or expr_shape with no check that the callee already holds a literal, which the method lookup answers with its body. The namespace var_shape clause in expr-type.dl carried that guard; rule (3) did not. Rule (3) now skips a callee that holds a function literal (callee_holds_function): a local, a named import, or a namespace member read. The relation is built from relations below the expression fixpoint, so the negation stays stratifiable. A const holding a factory's result, and a parameter, keep the signature as the target. Case 101 pins the interface and function-type-alias forms through a local, a named import and a namespace read, with factory and parameter controls. On the base each literal site is multi_inferred to body and signature; here each is one known_edge to the body. Goldens: the same two-way hedge collapses to the body in 08 (lib), 63, 65, 74 and 77. The compiler names the annotation's signature, so 08, 63 and 65 record it in known-missing, the shape 92 and 98 already accept; 77 loses an extra. The comment in case 65 describes what a revert now looks like. --- .../src/formats.ts | 10 ++++++++ .../src/globals.d.ts | 11 +++++++++ .../src/tsconfig.json | 1 + .../101-annotated-function-const/src/x.ts | 17 ++++++++++++++ .../src/fewer.ts | 6 ++--- ...08-function-values-and-callbacks.lib.edges | 1 - ...ion-values-and-callbacks.lib.known-missing | 7 ++++++ ...8-function-values-and-callbacks.lib.oracle | 3 ++- .../101-annotated-function-const.edges | 10 ++++++++ .../101-annotated-function-const.entries | 12 ++++++++++ .../101-annotated-function-const.envelope | 4 ++++ .../101-annotated-function-const.fields | 1 + ...101-annotated-function-const.fields-oracle | 7 ++++++ ...101-annotated-function-const.known-missing | 13 +++++++++++ ...annotated-function-const.lib.known-missing | 13 +++++++++++ .../101-annotated-function-const.oracle | 13 +++++++++++ .../101-annotated-function-const.type-use | 8 +++++++ .../101-annotated-function-const.types-oracle | 7 ++++++ .../63-annotated-callable-member.edges | 6 ++--- ...63-annotated-callable-member.known-missing | 7 ++++++ .../63-annotated-callable-member.oracle | 4 ++-- ...-annotated-callable-fewer-parameters.edges | 6 ++--- ...ed-callable-fewer-parameters.known-missing | 8 +++++++ ...annotated-callable-fewer-parameters.oracle | 4 +++- .../expected/74-jsx-component-forms.edges | 3 +-- .../77-package-published-entries.edges | 3 +-- .../77-package-published-entries.oracle | 3 +-- .../callee-resolution.dl | 23 +++++++++++++++++++ graph/typescript/souffle/decls_all.dl | 1 + 29 files changed, 190 insertions(+), 22 deletions(-) create mode 100644 graph/test/typescript/cases/101-annotated-function-const/src/formats.ts create mode 100644 graph/test/typescript/cases/101-annotated-function-const/src/globals.d.ts create mode 100644 graph/test/typescript/cases/101-annotated-function-const/src/tsconfig.json create mode 100644 graph/test/typescript/cases/101-annotated-function-const/src/x.ts create mode 100644 graph/test/typescript/expected/08-function-values-and-callbacks.lib.known-missing create mode 100644 graph/test/typescript/expected/101-annotated-function-const.edges create mode 100644 graph/test/typescript/expected/101-annotated-function-const.entries create mode 100644 graph/test/typescript/expected/101-annotated-function-const.envelope create mode 100644 graph/test/typescript/expected/101-annotated-function-const.fields create mode 100644 graph/test/typescript/expected/101-annotated-function-const.fields-oracle create mode 100644 graph/test/typescript/expected/101-annotated-function-const.known-missing create mode 100644 graph/test/typescript/expected/101-annotated-function-const.lib.known-missing create mode 100644 graph/test/typescript/expected/101-annotated-function-const.oracle create mode 100644 graph/test/typescript/expected/101-annotated-function-const.type-use create mode 100644 graph/test/typescript/expected/101-annotated-function-const.types-oracle create mode 100644 graph/test/typescript/expected/63-annotated-callable-member.known-missing create mode 100644 graph/test/typescript/expected/65-annotated-callable-fewer-parameters.known-missing diff --git a/graph/test/typescript/cases/101-annotated-function-const/src/formats.ts b/graph/test/typescript/cases/101-annotated-function-const/src/formats.ts new file mode 100644 index 000000000..475913447 --- /dev/null +++ b/graph/test/typescript/cases/101-annotated-function-const/src/formats.ts @@ -0,0 +1,10 @@ +// A const annotated with a callable type and holding a function literal: the call's +// target is the literal's body, not the annotation's bodiless signature beside it. +export interface Format { (input: string): string } +export type Fn = (input: string) => string; +export const fromArrow: Format = (input) => input; +export const fromAlias: Fn = (input) => input; + +// controls: the value is a factory's result, so the signature is the only answer. +declare function makeFormat(): Format; +export const made: Format = makeFormat(); diff --git a/graph/test/typescript/cases/101-annotated-function-const/src/globals.d.ts b/graph/test/typescript/cases/101-annotated-function-const/src/globals.d.ts new file mode 100644 index 000000000..dd5843cc1 --- /dev/null +++ b/graph/test/typescript/cases/101-annotated-function-const/src/globals.d.ts @@ -0,0 +1,11 @@ +// The case's own standard library under `noLib`. +interface Object {} +interface Boolean {} +interface Number {} +interface String {} +interface Array { length: number; } +interface Function {} +interface CallableFunction extends Function {} +interface NewableFunction extends Function {} +interface IArguments {} +interface RegExp {} diff --git a/graph/test/typescript/cases/101-annotated-function-const/src/tsconfig.json b/graph/test/typescript/cases/101-annotated-function-const/src/tsconfig.json new file mode 100644 index 000000000..dcbfb4f8d --- /dev/null +++ b/graph/test/typescript/cases/101-annotated-function-const/src/tsconfig.json @@ -0,0 +1 @@ +{ "compilerOptions": { "strict": true, "noLib": true, "target": "es2022" } } diff --git a/graph/test/typescript/cases/101-annotated-function-const/src/x.ts b/graph/test/typescript/cases/101-annotated-function-const/src/x.ts new file mode 100644 index 000000000..2db50cf04 --- /dev/null +++ b/graph/test/typescript/cases/101-annotated-function-const/src/x.ts @@ -0,0 +1,17 @@ +import * as formats from "./formats"; +import { fromArrow, fromAlias, made, Format, Fn } from "./formats"; + +export function viaNamespace(s: string): string { return formats.fromArrow(s); } +export function viaNamed(s: string): string { return fromArrow(s); } +const local: Format = (i) => i; +export function viaLocal(s: string): string { return local(s); } + +export function aliasNamespace(s: string): string { return formats.fromAlias(s); } +export function aliasNamed(s: string): string { return fromAlias(s); } +const localAlias: Fn = (i) => i; +export function aliasLocal(s: string): string { return localAlias(s); } + +// controls: no literal to find, so the annotation's signature stays the target. +export function factoryNamed(s: string): string { return made(s); } +export function factoryNamespace(s: string): string { return formats.made(s); } +export function viaParam(f: Format, s: string): string { return f(s); } diff --git a/graph/test/typescript/cases/65-annotated-callable-fewer-parameters/src/fewer.ts b/graph/test/typescript/cases/65-annotated-callable-fewer-parameters/src/fewer.ts index dd2d59d8e..93cd4660e 100644 --- a/graph/test/typescript/cases/65-annotated-callable-fewer-parameters/src/fewer.ts +++ b/graph/test/typescript/cases/65-annotated-callable-fewer-parameters/src/fewer.ts @@ -19,9 +19,9 @@ // WHAT THE DISCRIMINATOR IS. Read the `.edges` golden, not the `.oracle` one. `tsc` // answers with the DECLARED TYPE -- the two-parameter call signature -- and is right to; // the implementation surviving beside it is a claim about what RUNS, which the compiler -// oracle does not make and cannot score. Reverting the relaxation removes the arrow edge -// from every mismatch cell below and drops the tier back to `known_edge`, so the `.edges` -// golden is where it shows up. +// oracle does not make and cannot score. Reverting the relaxation removes the arrow edge, +// each cell's only one since the signature is no longer added beside a literal (#2005), +// so a revert leaves the call with no edge, and the `.edges` golden is where it shows up. // // THE ANNOTATION IS A NAMED INTERFACE, not an inline function type, so that the target // both sides name is the interface's call signature and the comparison is about which diff --git a/graph/test/typescript/expected/08-function-values-and-callbacks.lib.edges b/graph/test/typescript/expected/08-function-values-and-callbacks.lib.edges index 7a2b1a274..8b3fc29e1 100644 --- a/graph/test/typescript/expected/08-function-values-and-callbacks.lib.edges +++ b/graph/test/typescript/expected/08-function-values-and-callbacks.lib.edges @@ -1,5 +1,4 @@ ambiguous_unknown METHOD_CALL values#drive() @L29 -> - -boundary_lib FUNCTION_CALL values#useLibrary() @L40 -> hooks#(string) boundary_lib FUNCTION_CALL values#useLibrary() @L40 -> hooks#identity(?) boundary_lib FUNCTION_CALL values#useLibrary() @L40 -> hooks#withHook(Hook,string) callback_handed FUNCTION_CALL values#drive() @L30 -> values#lower(?) diff --git a/graph/test/typescript/expected/08-function-values-and-callbacks.lib.known-missing b/graph/test/typescript/expected/08-function-values-and-callbacks.lib.known-missing new file mode 100644 index 000000000..973949176 --- /dev/null +++ b/graph/test/typescript/expected/08-function-values-and-callbacks.lib.known-missing @@ -0,0 +1,7 @@ +# Accepted client->library gaps for 08-function-values-and-callbacks: +# each line is an edge the TypeScript compiler resolves and this engine does not. A NEW missing +# edge fails the suite; a line here that STARTS working also fails, so the debt cannot rot. +# A const that HOLDS a function literal and is annotated with a callable type: the compiler names +# the annotation's signature, the engine names the literal's body, the accepted shape of +# 92-namespace-typed-const and 101-annotated-function-const (#2005). +values#useLibrary() -> hooks#(string) diff --git a/graph/test/typescript/expected/08-function-values-and-callbacks.lib.oracle b/graph/test/typescript/expected/08-function-values-and-callbacks.lib.oracle index 068febee7..037ec4349 100644 --- a/graph/test/typescript/expected/08-function-values-and-callbacks.lib.oracle +++ b/graph/test/typescript/expected/08-function-values-and-callbacks.lib.oracle @@ -1,3 +1,4 @@ -oracle=8 engine=10 agree=8 missing=0 (known 0, NEW 0) extra=2 +oracle=8 engine=9 agree=7 missing=1 (known 1, NEW 0) extra=2 + known values#useLibrary() -> hooks#(string) extra values#drive() -> Pipeline#tag(string) extra values#useLibrary() -> hooks#identity(?) diff --git a/graph/test/typescript/expected/101-annotated-function-const.edges b/graph/test/typescript/expected/101-annotated-function-const.edges new file mode 100644 index 000000000..08ba85427 --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.edges @@ -0,0 +1,10 @@ +ambient_terminal FUNCTION_CALL formats#() @L10 -> formats#makeFormat() +known_edge FUNCTION_CALL x#aliasLocal(string) @L12 -> x#localAlias(?) +known_edge FUNCTION_CALL x#aliasNamed(string) @L10 -> formats#fromAlias(?) +known_edge FUNCTION_CALL x#factoryNamed(string) @L15 -> Format#(string) +known_edge FUNCTION_CALL x#viaLocal(string) @L7 -> x#local(?) +known_edge FUNCTION_CALL x#viaNamed(string) @L5 -> formats#fromArrow(?) +known_edge FUNCTION_CALL x#viaParam(Format,string) @L17 -> Format#(string) +known_edge METHOD_CALL x#aliasNamespace(string) @L9 -> formats#fromAlias(?) +known_edge METHOD_CALL x#factoryNamespace(string) @L16 -> Format#(string) +known_edge METHOD_CALL x#viaNamespace(string) @L4 -> formats#fromArrow(?) diff --git a/graph/test/typescript/expected/101-annotated-function-const.entries b/graph/test/typescript/expected/101-annotated-function-const.entries new file mode 100644 index 000000000..bc7967437 --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.entries @@ -0,0 +1,12 @@ +── entry_point (11) ── + exported_from_entry_module x#aliasLocal x.ts:12 + exported_from_entry_module x#aliasNamed x.ts:10 + exported_from_entry_module x#aliasNamespace x.ts:9 + exported_from_entry_module x#factoryNamed x.ts:15 + exported_from_entry_module x#factoryNamespace x.ts:16 + exported_from_entry_module x#viaLocal x.ts:7 + exported_from_entry_module x#viaNamed x.ts:5 + exported_from_entry_module x#viaNamespace x.ts:4 + exported_from_entry_module x#viaParam x.ts:17 + unimported_module globals# globals.d.ts:1 + unimported_module x# x.ts:1 diff --git a/graph/test/typescript/expected/101-annotated-function-const.envelope b/graph/test/typescript/expected/101-annotated-function-const.envelope new file mode 100644 index 000000000..9cd02f860 --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.envelope @@ -0,0 +1,4 @@ +value formats#@4:18 -> formats#@6 +value formats#@4:18 -> x#@11 +value formats#Format. -> formats#@5 +value formats#Format. -> x#@6 diff --git a/graph/test/typescript/expected/101-annotated-function-const.fields b/graph/test/typescript/expected/101-annotated-function-const.fields new file mode 100644 index 000000000..4d23b91a4 --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.fields @@ -0,0 +1 @@ +known_edge read x#factoryNamed(string) -> formats#made diff --git a/graph/test/typescript/expected/101-annotated-function-const.fields-oracle b/graph/test/typescript/expected/101-annotated-function-const.fields-oracle new file mode 100644 index 000000000..a2ffbadd5 --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.fields-oracle @@ -0,0 +1,7 @@ +101-annotated-function-const [fields] + precision 0.0000 (0 correct, 0 wrong) + recall 0.0000 (0 of 0 the compiler resolved) + sites 1 resolved 1 (100.0%) + tiers known_edge=1 + access read=1 + not scored: 1 rows whose target is not a client declaration diff --git a/graph/test/typescript/expected/101-annotated-function-const.known-missing b/graph/test/typescript/expected/101-annotated-function-const.known-missing new file mode 100644 index 000000000..cf05307c4 --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.known-missing @@ -0,0 +1,13 @@ +# Accepted gaps for 101-annotated-function-const: each line is an edge the TypeScript compiler +# resolves and this engine does not. A NEW missing edge fails the suite; +# a line here that STARTS working also fails, so the debt cannot rot. +# A const that HOLDS a function literal and is annotated with a callable type: the compiler names +# the annotation's signature, the engine names the literal's body, the same accepted shape as +# 92-namespace-typed-const and 98-namespace-const-callable (#2005). Kept on purpose: the signature +# must not be added beside the body as a second target. +x#aliasLocal(string) -> formats#(string) +x#aliasNamed(string) -> formats#(string) +x#aliasNamespace(string) -> formats#(string) +x#viaLocal(string) -> Format#(string) +x#viaNamed(string) -> Format#(string) +x#viaNamespace(string) -> Format#(string) diff --git a/graph/test/typescript/expected/101-annotated-function-const.lib.known-missing b/graph/test/typescript/expected/101-annotated-function-const.lib.known-missing new file mode 100644 index 000000000..cf05307c4 --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.lib.known-missing @@ -0,0 +1,13 @@ +# Accepted gaps for 101-annotated-function-const: each line is an edge the TypeScript compiler +# resolves and this engine does not. A NEW missing edge fails the suite; +# a line here that STARTS working also fails, so the debt cannot rot. +# A const that HOLDS a function literal and is annotated with a callable type: the compiler names +# the annotation's signature, the engine names the literal's body, the same accepted shape as +# 92-namespace-typed-const and 98-namespace-const-callable (#2005). Kept on purpose: the signature +# must not be added beside the body as a second target. +x#aliasLocal(string) -> formats#(string) +x#aliasNamed(string) -> formats#(string) +x#aliasNamespace(string) -> formats#(string) +x#viaLocal(string) -> Format#(string) +x#viaNamed(string) -> Format#(string) +x#viaNamespace(string) -> Format#(string) diff --git a/graph/test/typescript/expected/101-annotated-function-const.oracle b/graph/test/typescript/expected/101-annotated-function-const.oracle new file mode 100644 index 000000000..ce7d7cd1c --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.oracle @@ -0,0 +1,13 @@ +oracle=10 engine=10 agree=4 missing=6 (known 6, NEW 0) extra=6 + known x#aliasLocal(string) -> formats#(string) + known x#aliasNamed(string) -> formats#(string) + known x#aliasNamespace(string) -> formats#(string) + known x#viaLocal(string) -> Format#(string) + known x#viaNamed(string) -> Format#(string) + known x#viaNamespace(string) -> Format#(string) + extra x#aliasLocal(string) -> x#localAlias(?) + extra x#aliasNamed(string) -> formats#fromAlias(?) + extra x#aliasNamespace(string) -> formats#fromAlias(?) + extra x#viaLocal(string) -> x#local(?) + extra x#viaNamed(string) -> formats#fromArrow(?) + extra x#viaNamespace(string) -> formats#fromArrow(?) diff --git a/graph/test/typescript/expected/101-annotated-function-const.type-use b/graph/test/typescript/expected/101-annotated-function-const.type-use new file mode 100644 index 000000000..5856712ac --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.type-use @@ -0,0 +1,8 @@ +known_edge METHOD_PARAM 0 x [METHOD_PARAM] -> Format +known_edge METHOD_RETURN 0 formats [METHOD] -> Format +known_edge SUPER_TYPE 0 CallableFunction [HERITAGE] -> Function +known_edge SUPER_TYPE 0 NewableFunction [HERITAGE] -> Function +known_edge VARIABLE_TYPE 0 formats [VARIABLE] -> Fn +known_edge VARIABLE_TYPE 0 formats [VARIABLE] -> Format +known_edge VARIABLE_TYPE 0 x [VARIABLE] -> Fn +known_edge VARIABLE_TYPE 0 x [VARIABLE] -> Format diff --git a/graph/test/typescript/expected/101-annotated-function-const.types-oracle b/graph/test/typescript/expected/101-annotated-function-const.types-oracle new file mode 100644 index 000000000..54aa3f4ba --- /dev/null +++ b/graph/test/typescript/expected/101-annotated-function-const.types-oracle @@ -0,0 +1,7 @@ +101-annotated-function-const [types] + precision 1.0000 (6 correct, 0 wrong) + recall 1.0000 (6 of 6 the compiler resolved) + sites 9 resolved 9 (100.0%) + tiers known_edge=9 + contexts METHOD_PARAM=1 METHOD_RETURN=1 SUPER_TYPE=2 VARIABLE_TYPE=5 + not scored: 0 rows whose target is not a client declaration diff --git a/graph/test/typescript/expected/63-annotated-callable-member.edges b/graph/test/typescript/expected/63-annotated-callable-member.edges index bf5a18be9..e34aeed8a 100644 --- a/graph/test/typescript/expected/63-annotated-callable-member.edges +++ b/graph/test/typescript/expected/63-annotated-callable-member.edges @@ -1,8 +1,6 @@ known_edge FUNCTION_CALL members#callVarAmbient() @L66 -> NamedCallable#(number) +known_edge FUNCTION_CALL members#callVarInline() @L51 -> members#varInline(number) +known_edge FUNCTION_CALL members#callVarNamed() @L52 -> members#varNamed(number) known_edge METHOD_CALL members#callPlainMethod(PlainMethod) @L61 -> PlainMethod#run(number) known_edge METHOD_CALL members#callPropInline(PropInline) @L53 -> PropInline#(number) known_edge METHOD_CALL members#callPropNamed(PropNamed) @L54 -> NamedCallable#(number) -multi_inferred FUNCTION_CALL members#callVarInline() @L51 -> members#(number) -multi_inferred FUNCTION_CALL members#callVarInline() @L51 -> members#varInline(number) -multi_inferred FUNCTION_CALL members#callVarNamed() @L52 -> NamedCallable#(number) -multi_inferred FUNCTION_CALL members#callVarNamed() @L52 -> members#varNamed(number) diff --git a/graph/test/typescript/expected/63-annotated-callable-member.known-missing b/graph/test/typescript/expected/63-annotated-callable-member.known-missing new file mode 100644 index 000000000..75c39aab5 --- /dev/null +++ b/graph/test/typescript/expected/63-annotated-callable-member.known-missing @@ -0,0 +1,7 @@ +# Accepted gaps for 63-annotated-callable-member: +# each line is an edge the TypeScript compiler resolves and this engine does not. A NEW missing +# edge fails the suite; a line here that STARTS working also fails, so the debt cannot rot. +# A const that HOLDS a function literal and is annotated with a callable type: the compiler names +# the annotation's signature, the engine names the literal's body, the accepted shape of +# 92-namespace-typed-const and 101-annotated-function-const (#2005). +members#callVarNamed() -> NamedCallable#(number) diff --git a/graph/test/typescript/expected/63-annotated-callable-member.oracle b/graph/test/typescript/expected/63-annotated-callable-member.oracle index baee96d98..35b22bda3 100644 --- a/graph/test/typescript/expected/63-annotated-callable-member.oracle +++ b/graph/test/typescript/expected/63-annotated-callable-member.oracle @@ -1,3 +1,3 @@ -oracle=6 engine=8 agree=6 missing=0 (known 0, NEW 0) extra=2 - extra members#callVarInline() -> members#(number) +oracle=6 engine=6 agree=5 missing=1 (known 1, NEW 0) extra=1 + known members#callVarNamed() -> NamedCallable#(number) extra members#callVarNamed() -> members#varNamed(number) diff --git a/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.edges b/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.edges index 808bb1ab2..aeb0afea4 100644 --- a/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.edges +++ b/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.edges @@ -1,8 +1,6 @@ known_edge FUNCTION_CALL fewer#callAmbient() @L73 -> TwoArgs#(number,number) +known_edge FUNCTION_CALL fewer#callDeclaresFewer() @L47 -> fewer#declaresFewer(number) +known_edge FUNCTION_CALL fewer#callDeclaresSame() @L54 -> fewer#declaresSame(number,number) known_edge FUNCTION_CALL fewer#callSiblingsOne() @L90 -> Siblings#(number) known_edge FUNCTION_CALL fewer#callSiblingsTwo() @L91 -> Siblings#(number,number) known_edge METHOD_CALL fewer#callHolderRun(Holder) @L68 -> TwoArgs#(number,number) -multi_inferred FUNCTION_CALL fewer#callDeclaresFewer() @L47 -> TwoArgs#(number,number) -multi_inferred FUNCTION_CALL fewer#callDeclaresFewer() @L47 -> fewer#declaresFewer(number) -multi_inferred FUNCTION_CALL fewer#callDeclaresSame() @L54 -> TwoArgs#(number,number) -multi_inferred FUNCTION_CALL fewer#callDeclaresSame() @L54 -> fewer#declaresSame(number,number) diff --git a/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.known-missing b/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.known-missing new file mode 100644 index 000000000..fffdb6b96 --- /dev/null +++ b/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.known-missing @@ -0,0 +1,8 @@ +# Accepted gaps for 65-annotated-callable-fewer-parameters: +# each line is an edge the TypeScript compiler resolves and this engine does not. A NEW missing +# edge fails the suite; a line here that STARTS working also fails, so the debt cannot rot. +# A const that HOLDS a function literal and is annotated with a callable type: the compiler names +# the annotation's signature, the engine names the literal's body, the accepted shape of +# 92-namespace-typed-const and 101-annotated-function-const (#2005). +fewer#callDeclaresFewer() -> TwoArgs#(number,number) +fewer#callDeclaresSame() -> TwoArgs#(number,number) diff --git a/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.oracle b/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.oracle index 2cbe7995d..e8bc0ff03 100644 --- a/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.oracle +++ b/graph/test/typescript/expected/65-annotated-callable-fewer-parameters.oracle @@ -1,3 +1,5 @@ -oracle=6 engine=8 agree=6 missing=0 (known 0, NEW 0) extra=2 +oracle=6 engine=6 agree=4 missing=2 (known 2, NEW 0) extra=2 + known fewer#callDeclaresFewer() -> TwoArgs#(number,number) + known fewer#callDeclaresSame() -> TwoArgs#(number,number) extra fewer#callDeclaresFewer() -> fewer#declaresFewer(number) extra fewer#callDeclaresSame() -> fewer#declaresSame(number,number) diff --git a/graph/test/typescript/expected/74-jsx-component-forms.edges b/graph/test/typescript/expected/74-jsx-component-forms.edges index 1215ed2b5..f82b66d6f 100644 --- a/graph/test/typescript/expected/74-jsx-component-forms.edges +++ b/graph/test/typescript/expected/74-jsx-component-forms.edges @@ -16,13 +16,12 @@ known_edge FUNCTION_CALL app#useFactory() @L23 -> parts#()@L22 known_edge FUNCTION_CALL parts#FieldImpl({ label: string },unknown) @L39 -> parts#trackClick(string) known_edge FUNCTION_CALL parts#UserCard({ id: string }) @L34 -> parts#formatName(string) known_edge FUNCTION_CALL settings#Settings() @L6 -> settings#saveSettings() +known_edge JSX_COMPONENT_CALL app#App() @L11 -> parts#Badge(?) known_edge JSX_COMPONENT_CALL app#App() @L12 -> parts#Avatar({ src: string }) known_edge JSX_COMPONENT_CALL app#App() @L13 -> Panel#({ title: string }) known_edge JSX_COMPONENT_CALL app#App() @L14 -> settings#Settings() known_edge METHOD_CALL app#App() @L15 -> parts#Chip({ text: string }) multi_inferred JSX_COMPONENT_CALL app#App() @L10 -> parts#(T) multi_inferred JSX_COMPONENT_CALL app#App() @L10 -> parts#FieldImpl({ label: string },unknown) -multi_inferred JSX_COMPONENT_CALL app#App() @L11 -> parts#(T) -multi_inferred JSX_COMPONENT_CALL app#App() @L11 -> parts#Badge(?) multi_inferred JSX_COMPONENT_CALL app#App() @L9 -> parts#(T) multi_inferred JSX_COMPONENT_CALL app#App() @L9 -> parts#UserCard({ id: string }) diff --git a/graph/test/typescript/expected/77-package-published-entries.edges b/graph/test/typescript/expected/77-package-published-entries.edges index 313a7e054..3a5496beb 100644 --- a/graph/test/typescript/expected/77-package-published-entries.edges +++ b/graph/test/typescript/expected/77-package-published-entries.edges @@ -1,8 +1,7 @@ +known_edge FUNCTION_CALL index#useStore(number) @L10 -> vanilla#createCastStore(number) known_edge FUNCTION_CALL index#useStore(number) @L11 -> internal#describeState(number) known_edge FUNCTION_CALL index#useStore(number) @L9 -> vanilla#createStore(number) known_edge FUNCTION_CALL plugins/logger#logger(string) @L9 -> plugins/logger#format(string) known_edge FUNCTION_CALL vanilla#createBoundStore(number) @L12 -> vanilla#seal(number) known_edge FUNCTION_CALL vanilla#createCastStore(number) @L18 -> vanilla#seal(number) known_edge FUNCTION_CALL vanilla#createStore(number) @L4 -> vanilla#seal(number) -multi_inferred FUNCTION_CALL index#useStore(number) @L10 -> vanilla#(number) -multi_inferred FUNCTION_CALL index#useStore(number) @L10 -> vanilla#createCastStore(number) diff --git a/graph/test/typescript/expected/77-package-published-entries.oracle b/graph/test/typescript/expected/77-package-published-entries.oracle index 68001a69c..fa4000b6a 100644 --- a/graph/test/typescript/expected/77-package-published-entries.oracle +++ b/graph/test/typescript/expected/77-package-published-entries.oracle @@ -1,2 +1 @@ -oracle=7 engine=8 agree=7 missing=0 (known 0, NEW 0) extra=1 - extra index#useStore(number) -> vanilla#(number) +oracle=7 engine=7 agree=7 missing=0 (known 0, NEW 0) extra=0 diff --git a/graph/typescript/engine/expression-resolution/callee-resolution.dl b/graph/typescript/engine/expression-resolution/callee-resolution.dl index d05fc58a1..d692f096b 100644 --- a/graph/typescript/engine/expression-resolution/callee-resolution.dl +++ b/graph/typescript/engine/expression-resolution/callee-resolution.dl @@ -152,13 +152,36 @@ call_kind_is_plain_call("DECORATOR_CALL"). // value's type carries a call signature, which IS the target. Java's nearest // analogue is a functional interface, and there the single abstract method has to be // found by counting; here the call signature is a member with its own row. +// +// Not where the callee already holds a function LITERAL — `const f: Format = (i) => i; +// f(s)`. The literal's body is the target (rule (2), rule (8), expr_callable), and the +// annotation's bodiless signature beside it turned a right answer into a two-way hedge +// (#2005). The same guard the namespace var_shape clause in expr-type.dl carries. Where +// the value is a factory's result, or the callee is a parameter, there is no literal and +// the signature stays the answer. expr_call_candidate(ce, m) :- call_callee_expr(_, ce, ne), expr_type(ne, _, t), + !callee_holds_function(ne), call_signature_in_scope(t, m). expr_call_candidate(ce, m) :- call_callee_expr(_, ce, ne), expr_shape(ne, s), + !callee_holds_function(ne), call_signature_in_scope(s, m). +// A local, a named import, or a namespace member read whose value is a function literal. +// Built only from relations below the expression fixpoint (expr_callable is negated by +// callee_expr_bound already; expr_namespace and var_is_function feed expr_callable), so +// the negation above stays stratifiable. +callee_holds_function(e) :- expr_referenced("client", "VARIABLE", v, e), + var_is_function(v, _). +callee_holds_function(e) :- expr_referenced("client", "IMPORT_BINDING", ih, e), + import_binds(ih, _, "VARIABLE", v), + var_is_function(v, _). +callee_holds_function(e) :- property_access_recv(e, n, q), + expr_namespace(q, _, mod), + module_export(_, mod, n, "VARIABLE", v), + var_is_function(v, _). + // ============================================================================ // METHOD CALLS — `recv.name(...)` // ============================================================================ diff --git a/graph/typescript/souffle/decls_all.dl b/graph/typescript/souffle/decls_all.dl index 68e0681d8..cc2967dec 100644 --- a/graph/typescript/souffle/decls_all.dl +++ b/graph/typescript/souffle/decls_all.dl @@ -83,6 +83,7 @@ .decl call_target_is_signature(c0:symbol) .decl call_type_only_target(c0:symbol,c1:symbol) .decl callee_expr_bound(c0:symbol) +.decl callee_holds_function(c0:symbol) .decl callee_names_local(c0:symbol) .decl category_is_class(c0:symbol) .decl category_is_instantiable(c0:symbol)