carrick 0.3.157 → 0.3.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +7 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +8 -1
- package/dist/contract.js.map +1 -1
- package/dist/engine-ask.d.ts +21 -0
- package/dist/engine-ask.js +50 -0
- package/dist/engine-ask.js.map +1 -0
- package/dist/facts/diff.d.ts +14 -1
- package/dist/facts/diff.js +21 -8
- package/dist/facts/diff.js.map +1 -1
- package/dist/facts/fetch.d.ts +7 -0
- package/dist/facts/fetch.js +22 -1
- package/dist/facts/fetch.js.map +1 -1
- package/dist/facts/lines.d.ts +24 -4
- package/dist/facts/lines.js +55 -19
- package/dist/facts/lines.js.map +1 -1
- package/dist/facts/peers.d.ts +13 -4
- package/dist/facts/peers.js +17 -15
- package/dist/facts/peers.js.map +1 -1
- package/dist/facts/rules/packages.js +3 -1
- package/dist/facts/rules/packages.js.map +1 -1
- package/dist/facts/rules/same-name.js +1 -1
- package/dist/facts/rules/same-name.js.map +1 -1
- package/dist/facts/store.d.ts +15 -0
- package/dist/facts/store.js +30 -0
- package/dist/facts/store.js.map +1 -1
- package/dist/held/backoff.d.ts +8 -0
- package/dist/held/backoff.js +43 -0
- package/dist/held/backoff.js.map +1 -0
- package/dist/held/build.d.ts +17 -0
- package/dist/held/build.js +62 -0
- package/dist/held/build.js.map +1 -0
- package/dist/held/client.d.ts +12 -3
- package/dist/held/client.js +123 -8
- package/dist/held/client.js.map +1 -1
- package/dist/held/daemon.d.ts +47 -2
- package/dist/held/daemon.js +115 -23
- package/dist/held/daemon.js.map +1 -1
- package/dist/held/early.d.ts +28 -0
- package/dist/held/early.js +115 -0
- package/dist/held/early.js.map +1 -0
- package/dist/held/paths.d.ts +6 -0
- package/dist/held/paths.js +17 -0
- package/dist/held/paths.js.map +1 -1
- package/dist/held/place.d.ts +78 -30
- package/dist/held/place.js +123 -83
- package/dist/held/place.js.map +1 -1
- package/dist/held/run.js +24 -6
- package/dist/held/run.js.map +1 -1
- package/dist/held/runtime.d.ts +22 -0
- package/dist/held/runtime.js +620 -0
- package/dist/held/runtime.js.map +1 -0
- package/dist/held/shadow.d.ts +44 -0
- package/dist/held/shadow.js +68 -0
- package/dist/held/shadow.js.map +1 -0
- package/dist/held/steps.d.ts +11 -0
- package/dist/held/steps.js +29 -0
- package/dist/held/steps.js.map +1 -0
- package/dist/hook/confirm.d.ts +79 -0
- package/dist/hook/confirm.js +220 -0
- package/dist/hook/confirm.js.map +1 -0
- package/dist/hook/edit-flow.d.ts +14 -3
- package/dist/hook/edit-flow.js +113 -33
- package/dist/hook/edit-flow.js.map +1 -1
- package/dist/hook/generation.d.ts +19 -0
- package/dist/hook/generation.js +75 -0
- package/dist/hook/generation.js.map +1 -0
- package/dist/hook/late.d.ts +50 -9
- package/dist/hook/late.js +104 -24
- package/dist/hook/late.js.map +1 -1
- package/dist/hook/post-bash.js +3 -3
- package/dist/hook/post-bash.js.map +1 -1
- package/dist/hook/post-edit.js +2 -2
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/hook/post-read.js +25 -3
- package/dist/hook/post-read.js.map +1 -1
- package/dist/hook/post-search.js +1 -1
- package/dist/hook/post-search.js.map +1 -1
- package/dist/hook/probe.js +1 -0
- package/dist/hook/probe.js.map +1 -1
- package/dist/hook/read-answer.d.ts +5 -0
- package/dist/hook/read-answer.js +8 -4
- package/dist/hook/read-answer.js.map +1 -1
- package/dist/hook/rechecks.d.ts +58 -2
- package/dist/hook/rechecks.js +132 -9
- package/dist/hook/rechecks.js.map +1 -1
- package/dist/hook/session-start.d.ts +1 -1
- package/dist/hook/session-start.js +19 -5
- package/dist/hook/session-start.js.map +1 -1
- package/dist/hook/similar.d.ts +1 -1
- package/dist/hook/similar.js +21 -8
- package/dist/hook/similar.js.map +1 -1
- package/dist/hook/stop-wait.js +35 -16
- package/dist/hook/stop-wait.js.map +1 -1
- package/dist/hook/timings.d.ts +29 -1
- package/dist/hook/timings.js +7 -1
- package/dist/hook/timings.js.map +1 -1
- package/dist/hook/user-prompt.js +2 -2
- package/dist/hook/user-prompt.js.map +1 -1
- package/dist/hosted-snapshot.d.ts +27 -0
- package/dist/hosted-snapshot.js +32 -0
- package/dist/hosted-snapshot.js.map +1 -1
- package/dist/init/hosted.js +2 -9
- package/dist/init/hosted.js.map +1 -1
- package/dist/render.d.ts +15 -1
- package/dist/render.js +50 -4
- package/dist/render.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +6 -6
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/sidecar/dist/src/capture/anchors.d.ts +8 -0
- package/sidecar/dist/src/capture/anchors.js +3 -2
- package/sidecar/dist/src/capture/api.d.ts +70 -3
- package/sidecar/dist/src/capture/check-classify.d.ts +7 -0
- package/sidecar/dist/src/capture/check-classify.js +24 -0
- package/sidecar/dist/src/capture/check-probe.d.ts +76 -7
- package/sidecar/dist/src/capture/check-probe.js +147 -19
- package/sidecar/dist/src/capture/check-workspace.d.ts +21 -0
- package/sidecar/dist/src/capture/check-workspace.js +13 -0
- package/sidecar/dist/src/capture/check.js +13 -1
- package/sidecar/dist/src/capture/graphql-leaves.d.ts +46 -0
- package/sidecar/dist/src/capture/graphql-leaves.js +142 -0
- package/sidecar/dist/src/capture/index.d.ts +5 -1
- package/sidecar/dist/src/capture/index.js +4 -1
- package/sidecar/dist/src/definition-resolver.d.ts +2 -1
- package/sidecar/dist/src/definition-resolver.js +15 -9
- package/sidecar/dist/src/engine-stamp.json +1 -1
- package/sidecar/dist/src/held-shadow.d.ts +17 -2
- package/sidecar/dist/src/held-shadow.js +11 -10
- package/sidecar/dist/src/index.js +18 -1
- package/sidecar/dist/src/library-claims.js +26 -3
- package/sidecar/dist/src/retype.d.ts +47 -0
- package/sidecar/dist/src/retype.js +274 -18
- package/sidecar/dist/src/site-find.d.ts +27 -0
- package/sidecar/dist/src/site-find.js +109 -0
- package/sidecar/dist/src/type-inferrer.d.ts +5 -0
- package/sidecar/dist/src/type-inferrer.js +8 -4
- package/sidecar/dist/src/type-structural-expander.d.ts +10 -0
- package/sidecar/dist/src/type-structural-expander.js +73 -4
- package/sidecar/dist/src/types.d.ts +50 -2
- package/sidecar/dist/src/validators.d.ts +424 -104
- package/sidecar/dist/src/validators.js +29 -0
|
@@ -79,7 +79,10 @@ export { callNamedBy, callResultNamesNoCall, isFrameworkMachinery, nodeByLocator
|
|
|
79
79
|
// v2 check core ("tsc as the judge"). Same bundle, same seam: the sidecar
|
|
80
80
|
// reaches it only through this door (index.js).
|
|
81
81
|
export { runCheck, judgeTscPath } from './check.js';
|
|
82
|
-
export { jsonWireDeclarations, wireFormFor } from './check-probe.js';
|
|
82
|
+
export { jsonWireDeclarations, jsonWireRule, judgeTolerances, wireFormFor } from './check-probe.js';
|
|
83
|
+
export { fitOptionsOf, judgeFitOptions } from './check-workspace.js';
|
|
84
|
+
export { nodeByExpressionText, isPreferredTarget } from './anchors.js';
|
|
85
|
+
export { graphqlDeclaresType, graphqlFieldLeaf, graphqlRootLeaf, graphqlScalarSent, withoutNonNull, } from './graphql-leaves.js';
|
|
83
86
|
export { findDisqualifyingTopTypes } from './deep-walk.js';
|
|
84
87
|
const SURFACE_ENTRY_BASENAME = '__carrick_surface__';
|
|
85
88
|
/** Captures made by this process, so each one's entry file has a name of its
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
* (carrick#3995 T5).
|
|
42
42
|
*/
|
|
43
43
|
import type { DefinitionAlias } from './types.js';
|
|
44
|
+
import type { GraphqlTypes } from './capture/index.js';
|
|
44
45
|
export interface ResolvedDefinition {
|
|
45
46
|
type_alias: string;
|
|
46
47
|
/** Original declaration text as written (preserves named types) */
|
|
@@ -60,7 +61,7 @@ export declare class DefinitionResolver {
|
|
|
60
61
|
* both extensionless and `.js`-suffixed specifiers — the same policy the
|
|
61
62
|
* check-phase workspace uses.
|
|
62
63
|
*/
|
|
63
|
-
resolveFromStub(stubDir: string, aliases: DefinitionAlias[]): ResolvedDefinition[];
|
|
64
|
+
resolveFromStub(stubDir: string, aliases: DefinitionAlias[], graphqlTypes?: GraphqlTypes): ResolvedDefinition[];
|
|
64
65
|
/**
|
|
65
66
|
* Resolve a single alias: the original text and the structural form.
|
|
66
67
|
*/
|
|
@@ -58,7 +58,7 @@ export class DefinitionResolver {
|
|
|
58
58
|
* both extensionless and `.js`-suffixed specifiers — the same policy the
|
|
59
59
|
* check-phase workspace uses.
|
|
60
60
|
*/
|
|
61
|
-
resolveFromStub(stubDir, aliases) {
|
|
61
|
+
resolveFromStub(stubDir, aliases, graphqlTypes) {
|
|
62
62
|
const typesDir = path.join(stubDir, 'types');
|
|
63
63
|
const surfacePath = path.join(typesDir, 'surface.d.ts');
|
|
64
64
|
if (!fs.existsSync(surfacePath)) {
|
|
@@ -98,7 +98,7 @@ export class DefinitionResolver {
|
|
|
98
98
|
const result = this.resolveAlias(surface, alias, {
|
|
99
99
|
program: stubProject.getProgram().compilerObject,
|
|
100
100
|
repoRoot: stubDir,
|
|
101
|
-
});
|
|
101
|
+
}, graphqlTypes);
|
|
102
102
|
if (result) {
|
|
103
103
|
results.push(result);
|
|
104
104
|
}
|
|
@@ -117,7 +117,7 @@ export class DefinitionResolver {
|
|
|
117
117
|
/**
|
|
118
118
|
* Resolve a single alias: the original text and the structural form.
|
|
119
119
|
*/
|
|
120
|
-
resolveAlias(sourceFile, payload, origin) {
|
|
120
|
+
resolveAlias(sourceFile, payload, origin, graphqlTypes) {
|
|
121
121
|
const alias = payload.alias;
|
|
122
122
|
const decl = sourceFile.getTypeAlias(alias) ??
|
|
123
123
|
sourceFile.getInterface(alias) ??
|
|
@@ -154,12 +154,18 @@ export class DefinitionResolver {
|
|
|
154
154
|
}
|
|
155
155
|
// Structural form — every named member inlined to its shape, in the
|
|
156
156
|
// form the payload travels in where the judge compares that form. An
|
|
157
|
-
// RPC procedure
|
|
158
|
-
//
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
157
|
+
// An RPC procedure's form is unknown, which prints as declared
|
|
158
|
+
// (carrick#4402). A GraphQL producer response prints each built-in
|
|
159
|
+
// scalar leaf in the type its scalar sends, read from the service's
|
|
160
|
+
// SDL types (carrick#4403).
|
|
161
|
+
const graphql = graphqlTypes !== undefined && payload.graphql_root !== undefined
|
|
162
|
+
? { types: graphqlTypes, root: payload.graphql_root }
|
|
163
|
+
: undefined;
|
|
164
|
+
const wire = wireFormFor(payload.protocol, payload.type_kind, payload.side, {
|
|
165
|
+
procedure: payload.procedure,
|
|
166
|
+
graphql,
|
|
167
|
+
});
|
|
168
|
+
const expanded = expandTypeStructural(type, origin, { wire, graphql });
|
|
163
169
|
return { type_alias: alias, definition, expanded };
|
|
164
170
|
}
|
|
165
171
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs_sha256":"
|
|
1
|
+
{"inputs_sha256":"dd3940e274b1583bf4ae84942434a85fc114d8564bade75fe6501fd3749b2d30"}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* shadow).
|
|
25
25
|
*/
|
|
26
26
|
import type { ProjectLoader } from './project-loader.js';
|
|
27
|
+
import { type FitOptions, type JudgeTolerances } from './capture/index.js';
|
|
27
28
|
/** What `write_shadow` answers. */
|
|
28
29
|
export interface ShadowResult {
|
|
29
30
|
/** Absolute path of the generated `w/tsconfig.json`. */
|
|
@@ -45,8 +46,20 @@ export interface ShadowResult {
|
|
|
45
46
|
}>;
|
|
46
47
|
/** The bare specifiers the own files use, as written to `paths`. */
|
|
47
48
|
bare_specifiers: string[];
|
|
48
|
-
/**
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The judge's JSON wire form as declarations a caller appends to a file:
|
|
51
|
+
* `jsonWireDeclarations('__carrick_')` and `type __carrick_Wire<S, E>`, the
|
|
52
|
+
* judge's own rule (`jsonWireRule`). One writer, so a held check and the
|
|
53
|
+
* scan's judge answer "what travels" the same way.
|
|
54
|
+
*/
|
|
55
|
+
wire: string[];
|
|
56
|
+
/** The judge's three tolerances, read from its own code (`judgeTolerances('__carrick_')`): declarations to append beside `wire`. */
|
|
57
|
+
tolerances: JudgeTolerances;
|
|
58
|
+
/** The fit options this shadow program was written with, and the judge's: a held check is armed only when they agree. */
|
|
59
|
+
options: {
|
|
60
|
+
service: FitOptions;
|
|
61
|
+
judge: FitOptions;
|
|
62
|
+
};
|
|
50
63
|
/** The native TypeScript 7 executable, or null when only TypeScript 6's tsc is installed. */
|
|
51
64
|
native_tsc: string | null;
|
|
52
65
|
}
|
|
@@ -58,3 +71,5 @@ export declare function nativeTscPath(tscPath?: string): string | null;
|
|
|
58
71
|
* checkout.
|
|
59
72
|
*/
|
|
60
73
|
export declare function writeShadow(loader: ProjectLoader, outDir: string): ShadowResult;
|
|
74
|
+
/** The wire declarations and the one rule type a held check appends (prefix `__carrick_`). */
|
|
75
|
+
export declare function heldWire(): string[];
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import * as fs from 'node:fs';
|
|
27
27
|
import * as path from 'node:path';
|
|
28
28
|
import { ts } from 'ts-morph';
|
|
29
|
-
import { WriteGuard, judgeTscPath } from './capture/index.js';
|
|
29
|
+
import { WriteGuard, judgeTscPath, jsonWireDeclarations, jsonWireRule, judgeTolerances, fitOptionsOf, judgeFitOptions } from './capture/index.js';
|
|
30
30
|
/** The platform package's executable, `@typescript/typescript-<platform>-<arch>/lib/tsc`. */
|
|
31
31
|
const NATIVE_TSC = /[\\/]@typescript[\\/]typescript-[^\\/]+[\\/]lib[\\/]tsc(\.exe)?$/;
|
|
32
32
|
/** `judgeTscPath()` when it is the native executable, else null (no held compiler). */
|
|
@@ -78,7 +78,6 @@ export function writeShadow(loader, outDir) {
|
|
|
78
78
|
let vendored = 0;
|
|
79
79
|
let rewritten = 0;
|
|
80
80
|
let unresolved = 0;
|
|
81
|
-
let hono = false;
|
|
82
81
|
for (const sf of program.getSourceFiles()) {
|
|
83
82
|
const file = sf.fileName;
|
|
84
83
|
if (isLibraryFile(program, file))
|
|
@@ -97,7 +96,6 @@ export function writeShadow(loader, outDir) {
|
|
|
97
96
|
node,
|
|
98
97
|
text: node.text,
|
|
99
98
|
to: resolved?.resolvedFileName,
|
|
100
|
-
pkg: resolved?.packageId?.name,
|
|
101
99
|
augmentation,
|
|
102
100
|
synthesized: node.pos < 0 || node.end < 0 || !node.parent,
|
|
103
101
|
});
|
|
@@ -112,8 +110,6 @@ export function writeShadow(loader, outDir) {
|
|
|
112
110
|
continue;
|
|
113
111
|
if (!lit.to || !inProgram.has(lit.to))
|
|
114
112
|
continue; // unresolved stays unresolved: no `paths` entry
|
|
115
|
-
if (isHonoFile(loader, lit.to, lit.pkg))
|
|
116
|
-
hono = true;
|
|
117
113
|
const target = shadowPath(lit.to);
|
|
118
114
|
const known = paths[lit.text];
|
|
119
115
|
if (known && known[0] !== target)
|
|
@@ -178,7 +174,7 @@ export function writeShadow(loader, outDir) {
|
|
|
178
174
|
'noImplicitAny', 'strictNullChecks', 'noUnusedLocals', 'noUnusedParameters', 'exactOptionalPropertyTypes',
|
|
179
175
|
'noImplicitOverride', 'noImplicitReturns', 'noFallthroughCasesInSwitch', 'noUncheckedIndexedAccess',
|
|
180
176
|
'useUnknownInCatchVariables', 'verbatimModuleSyntax', 'isolatedModules', 'experimentalDecorators',
|
|
181
|
-
'emitDecoratorMetadata', 'useDefineForClassFields', 'noPropertyAccessFromIndexSignature',
|
|
177
|
+
'emitDecoratorMetadata', 'useDefineForClassFields', 'strictFunctionTypes', 'noPropertyAccessFromIndexSignature',
|
|
182
178
|
];
|
|
183
179
|
const compilerOptions = {
|
|
184
180
|
// Options TypeScript 7 removed (baseUrl, node10 resolution, es5, esModuleInterop: false) are never carried.
|
|
@@ -204,13 +200,18 @@ export function writeShadow(loader, outDir) {
|
|
|
204
200
|
unresolved,
|
|
205
201
|
path_conflicts: pathConflicts,
|
|
206
202
|
bare_specifiers: Object.keys(paths).sort(),
|
|
207
|
-
|
|
203
|
+
wire: heldWire(),
|
|
204
|
+
tolerances: judgeTolerances('__carrick_'),
|
|
205
|
+
options: { service: fitOptionsOf(compilerOptions), judge: judgeFitOptions() },
|
|
208
206
|
native_tsc: nativeTscPath(),
|
|
209
207
|
};
|
|
210
208
|
}
|
|
211
|
-
/** The
|
|
212
|
-
function
|
|
213
|
-
return
|
|
209
|
+
/** The wire declarations and the one rule type a held check appends (prefix `__carrick_`). */
|
|
210
|
+
export function heldWire() {
|
|
211
|
+
return [
|
|
212
|
+
...jsonWireDeclarations('__carrick_'),
|
|
213
|
+
`type __carrick_Wire<S, E> = ${jsonWireRule('S', 'E', '__carrick_')};`,
|
|
214
|
+
];
|
|
214
215
|
}
|
|
215
216
|
function safeRealpath(p) {
|
|
216
217
|
try {
|
|
@@ -32,6 +32,7 @@ import { PROGRESS_INTERVAL_MS, atMostEvery } from './progress.js';
|
|
|
32
32
|
import { mergeInferTimings } from './infer-timing.js';
|
|
33
33
|
import { addProgramFiles, listProgramFiles } from './program-files.js';
|
|
34
34
|
import { writeShadow } from './held-shadow.js';
|
|
35
|
+
import { findSite } from './site-find.js';
|
|
35
36
|
import { changedSource, inferCacheDir, keepable, programDifference, programRecord, readEntry, requestDigest, writeEntry, } from './infer-cache.js';
|
|
36
37
|
import { writePositionRows } from './position-rows.js';
|
|
37
38
|
import { findImplementations } from './implementations.js';
|
|
@@ -711,7 +712,7 @@ function handleListLibrarySurface(request) {
|
|
|
711
712
|
function handleResolveDefinitions(request) {
|
|
712
713
|
try {
|
|
713
714
|
log(`Resolving ${request.aliases.length} type alias(es) from ${request.stub_dir}`);
|
|
714
|
-
const results = definitionResolver.resolveFromStub(request.stub_dir, request.aliases);
|
|
715
|
+
const results = definitionResolver.resolveFromStub(request.stub_dir, request.aliases, request.graphql_types);
|
|
715
716
|
return {
|
|
716
717
|
request_id: request.request_id,
|
|
717
718
|
status: 'success',
|
|
@@ -774,6 +775,20 @@ function handleWriteShadow(request) {
|
|
|
774
775
|
return { request_id: request.request_id, status: 'error', errors: [error] };
|
|
775
776
|
}
|
|
776
777
|
}
|
|
778
|
+
/**
|
|
779
|
+
* Handle the 'find_site' action: the capture's own site finder over the
|
|
780
|
+
* caller's two texts (site-find.ts). Reads no program and no disk.
|
|
781
|
+
*/
|
|
782
|
+
function handleFindSite(request) {
|
|
783
|
+
try {
|
|
784
|
+
return { request_id: request.request_id, status: 'success', ...findSite(request) };
|
|
785
|
+
}
|
|
786
|
+
catch (err) {
|
|
787
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
788
|
+
logError(`Finding the site failed: ${error}`);
|
|
789
|
+
return { request_id: request.request_id, status: 'error', errors: [error] };
|
|
790
|
+
}
|
|
791
|
+
}
|
|
777
792
|
/**
|
|
778
793
|
* Handle the 'reach_graph' action - the import graph of every program the
|
|
779
794
|
* process has built, the default one and each owning project's (carrick#3100).
|
|
@@ -959,6 +974,8 @@ function handleRequest(request) {
|
|
|
959
974
|
return handleListProgramFiles(request);
|
|
960
975
|
case 'write_shadow':
|
|
961
976
|
return handleWriteShadow(request);
|
|
977
|
+
case 'find_site':
|
|
978
|
+
return handleFindSite(request);
|
|
962
979
|
case 'reach_graph':
|
|
963
980
|
return handleReachGraph(request);
|
|
964
981
|
case 'reach':
|
|
@@ -1158,13 +1158,15 @@ export function fullSurfaceSha256(surfaces) {
|
|
|
1158
1158
|
// A member's `handlers` (carrick#2674), a signature's `result_candidates`
|
|
1159
1159
|
// (carrick#2817) and a member's `scope_receiver` (carrick#2774) are out of
|
|
1160
1160
|
// the hash at every depth, and so is a member's `runtime_events`
|
|
1161
|
-
// (carrick#3032),
|
|
1162
|
-
// package's key does not change when
|
|
1161
|
+
// (carrick#3032), a receiver's `properties` (carrick#3696) and a construct
|
|
1162
|
+
// signature's `abstract` (L2, R5), so a package's key does not change when
|
|
1163
|
+
// the lister learns to list them.
|
|
1163
1164
|
const text = JSON.stringify(listed, (key, value) => key === 'handlers' ||
|
|
1164
1165
|
key === 'result_candidates' ||
|
|
1165
1166
|
key === 'scope_receiver' ||
|
|
1166
1167
|
key === 'runtime_events' ||
|
|
1167
|
-
key === 'properties'
|
|
1168
|
+
key === 'properties' ||
|
|
1169
|
+
key === 'abstract'
|
|
1168
1170
|
? undefined
|
|
1169
1171
|
: value);
|
|
1170
1172
|
return crypto.createHash('sha256').update(text).digest('hex');
|
|
@@ -5519,6 +5521,25 @@ class DeclarationReader {
|
|
|
5519
5521
|
this.handlerMembers.set(type, listed);
|
|
5520
5522
|
return listed;
|
|
5521
5523
|
}
|
|
5524
|
+
/**
|
|
5525
|
+
* A construct signature of an abstract class: `new` on it is a type error.
|
|
5526
|
+
* Read from the class declaration, which the written constructor sits in or
|
|
5527
|
+
* the instance type names when the class writes none. A call signature, or
|
|
5528
|
+
* a construct signature written in an interface, is never abstract.
|
|
5529
|
+
*/
|
|
5530
|
+
isAbstractConstruct(signature) {
|
|
5531
|
+
const declaration = signature.getDeclaration();
|
|
5532
|
+
const abstractClass = (node) => node !== undefined &&
|
|
5533
|
+
ts.isClassLike(node) &&
|
|
5534
|
+
(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Abstract) !== 0;
|
|
5535
|
+
if (declaration !== undefined && ts.isConstructorDeclaration(declaration))
|
|
5536
|
+
return abstractClass(declaration.parent);
|
|
5537
|
+
if (declaration !== undefined && ts.isClassLike(declaration))
|
|
5538
|
+
return abstractClass(declaration);
|
|
5539
|
+
if (declaration !== undefined)
|
|
5540
|
+
return false;
|
|
5541
|
+
return (this.checker.getReturnTypeOfSignature(signature).symbol?.declarations ?? []).some(abstractClass);
|
|
5542
|
+
}
|
|
5522
5543
|
listSignatures(signatures, holder, take) {
|
|
5523
5544
|
const listed = [];
|
|
5524
5545
|
for (const signature of signatures) {
|
|
@@ -5560,6 +5581,8 @@ class DeclarationReader {
|
|
|
5560
5581
|
const candidates = this.listResultCandidates ? resultCandidatesOf(this.checker, signature) : undefined;
|
|
5561
5582
|
if (candidates !== undefined)
|
|
5562
5583
|
entry.result_candidates = candidates;
|
|
5584
|
+
if (this.isAbstractConstruct(signature))
|
|
5585
|
+
entry.abstract = true;
|
|
5563
5586
|
listed.push(entry);
|
|
5564
5587
|
}
|
|
5565
5588
|
return listed;
|
|
@@ -129,6 +129,53 @@ export declare class Retyper {
|
|
|
129
129
|
* than the budget allows; the compiler's diagnostics stand.
|
|
130
130
|
*/
|
|
131
131
|
private unresolvedMembers;
|
|
132
|
+
/**
|
|
133
|
+
* The JSON wire transform's declarations and the `${WIRE}<P>` alias that
|
|
134
|
+
* states a type in its wire form, as appended to a file that names them.
|
|
135
|
+
*/
|
|
136
|
+
private wireDeclarations;
|
|
137
|
+
/**
|
|
138
|
+
* The procedure form (carrick#937): judge a procedure call by the
|
|
139
|
+
* consumer's own code against the call's own type.
|
|
140
|
+
*
|
|
141
|
+
* A procedure call's type IS the producer's router type, read by the
|
|
142
|
+
* consumer's compiler, so stating the producer's output at the call would
|
|
143
|
+
* compare one type with itself. What breaks is the consumer's use of it.
|
|
144
|
+
* The file is type-checked as it is and again with only the call's result
|
|
145
|
+
* erased (`(<call> as any)`): a diagnostic present as-is and gone when
|
|
146
|
+
* erased is a place the consumer uses what the procedure does not return.
|
|
147
|
+
*
|
|
148
|
+
* A guard runs first: the call's result (or one member of it, for a hook's
|
|
149
|
+
* envelope such as `{ data }`) must be the producer's published output, as
|
|
150
|
+
* declared or in its JSON wire form. A call whose result is something else
|
|
151
|
+
* (an options builder's `{ key }`), or a router on disk that no longer
|
|
152
|
+
* returns what the producer published, is not compared: erasing it would
|
|
153
|
+
* agree about nothing.
|
|
154
|
+
*/
|
|
155
|
+
private runProcedure;
|
|
156
|
+
/**
|
|
157
|
+
* The one call to the procedure `procedurePath` names that starts on the
|
|
158
|
+
* item's line: a call whose callee is `R.s1.….sk.m`, with `s1..sk` the key
|
|
159
|
+
* path's segments, `m` any name (the client's operation) and `R` any
|
|
160
|
+
* expression (the client). Or why there is not exactly one.
|
|
161
|
+
*/
|
|
162
|
+
private locateProcedureCall;
|
|
163
|
+
/**
|
|
164
|
+
* The `any` members of the call's awaited result, which can only hide a
|
|
165
|
+
* diagnostic and so decide only an empty diff, or why the result cannot be
|
|
166
|
+
* compared at all (`any`/`unknown` as a whole, `unknown` at a member). The
|
|
167
|
+
* walk's budget sentinel is dropped, as {@link unresolvedMembers} drops it.
|
|
168
|
+
*/
|
|
169
|
+
private procedureTopTypes;
|
|
170
|
+
/**
|
|
171
|
+
* Guard (carrick#937): what carries the producer's published output,
|
|
172
|
+
* declared or in its JSON wire form (each way assignable to the other),
|
|
173
|
+
* read in the consumer's own program: the call's awaited result as a whole
|
|
174
|
+
* (`member` unset), or for an object result the string-named member that
|
|
175
|
+
* does once `null`/`undefined` are removed. Else why the call is not
|
|
176
|
+
* compared.
|
|
177
|
+
*/
|
|
178
|
+
private carriesProducerOutput;
|
|
132
179
|
/**
|
|
133
180
|
* The stated type argument must be what the call RETURNS (or a type
|
|
134
181
|
* argument or member of it): the rewrite is only a statement about the
|