@velarscript/compiler 0.10.1
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/LICENSE +201 -0
- package/README.md +70 -0
- package/dist/analyzer.d.ts +1175 -0
- package/dist/analyzer.d.ts.map +1 -0
- package/dist/analyzer.js +12130 -0
- package/dist/analyzer.js.map +1 -0
- package/dist/application-package-host.d.ts +28 -0
- package/dist/application-package-host.d.ts.map +1 -0
- package/dist/application-package-host.js +2 -0
- package/dist/application-package-host.js.map +1 -0
- package/dist/ast.d.ts +853 -0
- package/dist/ast.d.ts.map +1 -0
- package/dist/ast.js +245 -0
- package/dist/ast.js.map +1 -0
- package/dist/class-runtime.d.ts +6 -0
- package/dist/class-runtime.d.ts.map +1 -0
- package/dist/class-runtime.js +45 -0
- package/dist/class-runtime.js.map +1 -0
- package/dist/collection-lowering-runtime.d.ts +7 -0
- package/dist/collection-lowering-runtime.d.ts.map +1 -0
- package/dist/collection-lowering-runtime.js +952 -0
- package/dist/collection-lowering-runtime.js.map +1 -0
- package/dist/collection-runtime.d.ts +16 -0
- package/dist/collection-runtime.d.ts.map +1 -0
- package/dist/collection-runtime.js +231 -0
- package/dist/collection-runtime.js.map +1 -0
- package/dist/core-vocabulary.d.ts +141 -0
- package/dist/core-vocabulary.d.ts.map +1 -0
- package/dist/core-vocabulary.js +88 -0
- package/dist/core-vocabulary.js.map +1 -0
- package/dist/diagnostic.d.ts +42 -0
- package/dist/diagnostic.d.ts.map +1 -0
- package/dist/diagnostic.js +66 -0
- package/dist/diagnostic.js.map +1 -0
- package/dist/embedded-javascript.d.ts +74 -0
- package/dist/embedded-javascript.d.ts.map +1 -0
- package/dist/embedded-javascript.js +341 -0
- package/dist/embedded-javascript.js.map +1 -0
- package/dist/embedded-module.d.ts +11 -0
- package/dist/embedded-module.d.ts.map +1 -0
- package/dist/embedded-module.js +67 -0
- package/dist/embedded-module.js.map +1 -0
- package/dist/embedded-source.d.ts +19 -0
- package/dist/embedded-source.d.ts.map +1 -0
- package/dist/embedded-source.js +61 -0
- package/dist/embedded-source.js.map +1 -0
- package/dist/emitter.d.ts +188 -0
- package/dist/emitter.d.ts.map +1 -0
- package/dist/emitter.js +3254 -0
- package/dist/emitter.js.map +1 -0
- package/dist/error-runtime.d.ts +17 -0
- package/dist/error-runtime.d.ts.map +1 -0
- package/dist/error-runtime.js +109 -0
- package/dist/error-runtime.js.map +1 -0
- package/dist/extension.d.ts +373 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +25 -0
- package/dist/extension.js.map +1 -0
- package/dist/formatter.d.ts +13 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +1440 -0
- package/dist/formatter.js.map +1 -0
- package/dist/framework-host.d.ts +87 -0
- package/dist/framework-host.d.ts.map +1 -0
- package/dist/framework-host.js +2 -0
- package/dist/framework-host.js.map +1 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +932 -0
- package/dist/index.js.map +1 -0
- package/dist/interpolated-string.d.ts +47 -0
- package/dist/interpolated-string.d.ts.map +1 -0
- package/dist/interpolated-string.js +344 -0
- package/dist/interpolated-string.js.map +1 -0
- package/dist/json-runtime.d.ts +2 -0
- package/dist/json-runtime.d.ts.map +1 -0
- package/dist/json-runtime.js +193 -0
- package/dist/json-runtime.js.map +1 -0
- package/dist/language-guidance.d.ts +31 -0
- package/dist/language-guidance.d.ts.map +1 -0
- package/dist/language-guidance.js +187 -0
- package/dist/language-guidance.js.map +1 -0
- package/dist/lexer.d.ts +85 -0
- package/dist/lexer.d.ts.map +1 -0
- package/dist/lexer.js +1004 -0
- package/dist/lexer.js.map +1 -0
- package/dist/limits.d.ts +2 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +2 -0
- package/dist/limits.js.map +1 -0
- package/dist/mechanical-fix.d.ts +26 -0
- package/dist/mechanical-fix.d.ts.map +1 -0
- package/dist/mechanical-fix.js +61 -0
- package/dist/mechanical-fix.js.map +1 -0
- package/dist/narrowing-runtime.d.ts +5 -0
- package/dist/narrowing-runtime.d.ts.map +1 -0
- package/dist/narrowing-runtime.js +27 -0
- package/dist/narrowing-runtime.js.map +1 -0
- package/dist/number-runtime.d.ts +3 -0
- package/dist/number-runtime.d.ts.map +1 -0
- package/dist/number-runtime.js +37 -0
- package/dist/number-runtime.js.map +1 -0
- package/dist/parser.d.ts +245 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +3582 -0
- package/dist/parser.js.map +1 -0
- package/dist/primitive-runtime.d.ts +4 -0
- package/dist/primitive-runtime.d.ts.map +1 -0
- package/dist/primitive-runtime.js +39 -0
- package/dist/primitive-runtime.js.map +1 -0
- package/dist/promise-runtime.d.ts +6 -0
- package/dist/promise-runtime.d.ts.map +1 -0
- package/dist/promise-runtime.js +86 -0
- package/dist/promise-runtime.js.map +1 -0
- package/dist/reactive-bridge-runtime.d.ts +7 -0
- package/dist/reactive-bridge-runtime.d.ts.map +1 -0
- package/dist/reactive-bridge-runtime.js +112 -0
- package/dist/reactive-bridge-runtime.js.map +1 -0
- package/dist/runtime-abi.d.ts +24 -0
- package/dist/runtime-abi.d.ts.map +1 -0
- package/dist/runtime-abi.js +24 -0
- package/dist/runtime-abi.js.map +1 -0
- package/dist/semantic.d.ts +142 -0
- package/dist/semantic.d.ts.map +1 -0
- package/dist/semantic.js +845 -0
- package/dist/semantic.js.map +1 -0
- package/dist/source-names.d.ts +32 -0
- package/dist/source-names.d.ts.map +1 -0
- package/dist/source-names.js +101 -0
- package/dist/source-names.js.map +1 -0
- package/dist/source.d.ts +19 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +64 -0
- package/dist/source.js.map +1 -0
- package/dist/text-runtime.d.ts +2 -0
- package/dist/text-runtime.d.ts.map +1 -0
- package/dist/text-runtime.js +285 -0
- package/dist/text-runtime.js.map +1 -0
- package/dist/token.d.ts +19 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +51 -0
- package/dist/token.js.map +1 -0
- package/dist/type-registry-runtime.d.ts +7 -0
- package/dist/type-registry-runtime.d.ts.map +1 -0
- package/dist/type-registry-runtime.js +51 -0
- package/dist/type-registry-runtime.js.map +1 -0
- package/dist/type-validation-runtime.d.ts +17 -0
- package/dist/type-validation-runtime.d.ts.map +1 -0
- package/dist/type-validation-runtime.js +150 -0
- package/dist/type-validation-runtime.js.map +1 -0
- package/dist/types.d.ts +356 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1170 -0
- package/dist/types.js.map +1 -0
- package/dist/utf8-runtime.d.ts +7 -0
- package/dist/utf8-runtime.d.ts.map +1 -0
- package/dist/utf8-runtime.js +43 -0
- package/dist/utf8-runtime.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,1175 @@
|
|
|
1
|
+
import type { Expression, FunctionDeclaration, Program, Statement, TypeParameterDeclaration, TypeReference, TypeSyntax } from "./ast.ts";
|
|
2
|
+
import { type PermanentNamespaceName } from "./core-vocabulary.ts";
|
|
3
|
+
import { type Diagnostic, type DiagnosticFix } from "./diagnostic.ts";
|
|
4
|
+
import type { CompilerAnalysisExtension } from "./extension.ts";
|
|
5
|
+
import { type Span } from "./source.ts";
|
|
6
|
+
import { type EnumInfo, type BinaryStorageKind, type ExtensionValueType, type GenericTypeInfo, type TypeEnvironment, type TypeParameterBound, type ValueType } from "./types.ts";
|
|
7
|
+
interface Binding {
|
|
8
|
+
readonly mutable: boolean;
|
|
9
|
+
type: ValueType;
|
|
10
|
+
declaredType: ValueType;
|
|
11
|
+
storageType: ValueType;
|
|
12
|
+
readonly storageBinding?: Binding;
|
|
13
|
+
readonly span: Span;
|
|
14
|
+
narrowingFrame: number | null;
|
|
15
|
+
/**
|
|
16
|
+
* D44 rule 71: true while the active narrowing was established by an
|
|
17
|
+
* assignment (or a declaration initializer) rather than a check. Only
|
|
18
|
+
* meaningful when narrowingFrame is not null. Assigned facts refine reads;
|
|
19
|
+
* equality tests still judge the declared domain (storageType).
|
|
20
|
+
*/
|
|
21
|
+
assignedFact?: boolean;
|
|
22
|
+
reactiveKind?: "state" | "prop";
|
|
23
|
+
/**
|
|
24
|
+
* D51 rule 101: the binding holds — or carries — a resource this scope owns
|
|
25
|
+
* and releases at its exit. `handle` is the `using` name to blame, and
|
|
26
|
+
* `depth` is the scope nesting level that releases it, so a store into any
|
|
27
|
+
* shallower binding is a store into something that outlives the release.
|
|
28
|
+
*/
|
|
29
|
+
ownedResource?: {
|
|
30
|
+
readonly handle: string;
|
|
31
|
+
readonly depth: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface AnalyzableFunctionDeclaration {
|
|
35
|
+
readonly kind: string;
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly typeParameters?: readonly TypeParameterDeclaration[];
|
|
38
|
+
readonly parameters: FunctionDeclaration["parameters"];
|
|
39
|
+
readonly returnType: FunctionDeclaration["returnType"];
|
|
40
|
+
readonly resultAnnotationSpan?: FunctionDeclaration["resultAnnotationSpan"];
|
|
41
|
+
readonly signatureSpan: FunctionDeclaration["signatureSpan"];
|
|
42
|
+
readonly body: FunctionDeclaration["body"];
|
|
43
|
+
readonly span: Span;
|
|
44
|
+
readonly asynchronous?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ClassField {
|
|
47
|
+
readonly mutable: boolean;
|
|
48
|
+
readonly type: ValueType;
|
|
49
|
+
}
|
|
50
|
+
export interface ClassInfo {
|
|
51
|
+
readonly identity?: string;
|
|
52
|
+
/** D43 item 69: the class declares `@dispose:`, and whether releasing awaits. */
|
|
53
|
+
readonly dispose?: "sync" | "async";
|
|
54
|
+
/**
|
|
55
|
+
* D68 rule 177: the collection the class's own `@iterate:` block answers
|
|
56
|
+
* with. Absent when the class declares no block — a derived class reads its
|
|
57
|
+
* base's answer instead of copying it, because overriding replaces rather
|
|
58
|
+
* than composes.
|
|
59
|
+
*/
|
|
60
|
+
readonly iterate?: ValueType;
|
|
61
|
+
readonly parameters: readonly ValueType[];
|
|
62
|
+
readonly parameterNames?: readonly string[];
|
|
63
|
+
readonly requiredParameters: number;
|
|
64
|
+
readonly constructorRest?: ValueType;
|
|
65
|
+
readonly base: string | null;
|
|
66
|
+
readonly abstract: boolean;
|
|
67
|
+
readonly fields: ReadonlyMap<string, ClassField>;
|
|
68
|
+
readonly getters: ReadonlySet<string>;
|
|
69
|
+
readonly abstractGetters: ReadonlySet<string>;
|
|
70
|
+
readonly methods: ReadonlyMap<string, ValueType>;
|
|
71
|
+
readonly abstractMethods: ReadonlySet<string>;
|
|
72
|
+
readonly staticFields: ReadonlyMap<string, ClassField>;
|
|
73
|
+
readonly staticGetters: ReadonlySet<string>;
|
|
74
|
+
readonly staticMethods: ReadonlyMap<string, ValueType>;
|
|
75
|
+
}
|
|
76
|
+
export type CollectionOperation = "get" | "slice" | "listAppend" | "listExtend" | "listInsert" | "listRemove" | "listPop" | "listCopy" | "listCount" | "listIndex" | "listFind" | "listSome" | "listEvery" | "listMap" | "listFilter" | "listFlatMap" | "listReduce" | "listJoin" | "listSorted" | "listReversed" | "listSum" | "listMin" | "listMax" | "setAdd" | "setUpdate" | "setCopy" | "setUnion" | "setIntersection" | "setDifference" | "mapSet" | "mapUpdate" | "mapCopy" | "recordSet" | "recordCopy" | "has" | "remove" | "clear" | "keys" | "values" | "entries";
|
|
77
|
+
export type PrimitiveOperation = "stringTrim" | "stringUpper" | "stringLower" | "stringSlice" | "stringChar" | "stringHas" | "stringIndex" | "stringCount" | "stringStartsWith" | "stringEndsWith" | "stringSplit" | "stringReplace" | "stringReplaceAll" | "stringPadStart" | "stringPadEnd" | "stringRepeat" | "stringIsBlank" | "numberAbs" | "numberRound" | "numberFloor" | "numberCeil" | "numberToFixed" | "numberIsInteger" | "numberIsNaN" | "numberIsFinite";
|
|
78
|
+
export interface FormReadField {
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly kind: "string" | "number" | "bool" | "enum" | "strings";
|
|
81
|
+
readonly optional: boolean;
|
|
82
|
+
readonly enumValues?: readonly string[];
|
|
83
|
+
}
|
|
84
|
+
export interface LoweringHints {
|
|
85
|
+
readonly collectionCalls: ReadonlyMap<number, CollectionOperation>;
|
|
86
|
+
readonly collectionSizes: ReadonlySet<number>;
|
|
87
|
+
/** Binary members and indexes lower directly against their typed-array storage. */
|
|
88
|
+
readonly binaryCalls: ReadonlyMap<number, "bufferCopy" | "bufferSlice" | "bufferToBytes">;
|
|
89
|
+
readonly binarySizes: ReadonlyMap<number, BinaryStorageKind>;
|
|
90
|
+
readonly binaryIndexes: ReadonlyMap<string, BinaryStorageKind>;
|
|
91
|
+
readonly primitiveCalls: ReadonlyMap<number, PrimitiveOperation>;
|
|
92
|
+
readonly stringSizes: ReadonlySet<number>;
|
|
93
|
+
readonly constructorCalls: ReadonlySet<string>;
|
|
94
|
+
readonly javaScriptCallBoundaries: ReadonlySet<string>;
|
|
95
|
+
readonly classChecks: ReadonlySet<string>;
|
|
96
|
+
readonly privateMembers: ReadonlySet<string>;
|
|
97
|
+
readonly classNames: ReadonlySet<string>;
|
|
98
|
+
/** Class names whose chain reaches the builtin Error — their lowering stamps `.name` (audit 4 micro-ruling). */
|
|
99
|
+
readonly errorSubclassNames: ReadonlySet<string>;
|
|
100
|
+
readonly enumNames: ReadonlySet<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Module-scope bindings that hold runtime Type objects: local `type`
|
|
103
|
+
* declarations and aliases, plus imported ones. A narrowing recheck for any
|
|
104
|
+
* of these names may call `Name.is(value)` — the exporting module always
|
|
105
|
+
* emits the validator object for an exported type. Names outside this set
|
|
106
|
+
* (erased generics, extension host types such as DOM interfaces) have no
|
|
107
|
+
* such binding and keep the presence-only recheck.
|
|
108
|
+
*/
|
|
109
|
+
readonly runtimeTypeObjectNames: ReadonlySet<string>;
|
|
110
|
+
/**
|
|
111
|
+
* D55 rule 121: module-scope names bound to a generic record's instantiation
|
|
112
|
+
* factory, local or imported. A generic name is *not* a Type object — it
|
|
113
|
+
* answers `.of(...)`, never `.is(...)` — so the emitter has to tell the two
|
|
114
|
+
* apart before it writes either into the output.
|
|
115
|
+
*/
|
|
116
|
+
readonly genericTypeNames: ReadonlySet<string>;
|
|
117
|
+
readonly optionalMembers: ReadonlySet<string>;
|
|
118
|
+
readonly optionalCalls: ReadonlySet<string>;
|
|
119
|
+
readonly optionalIndexes: ReadonlySet<string>;
|
|
120
|
+
readonly optionalCallees: ReadonlySet<string>;
|
|
121
|
+
readonly truthConditions: ReadonlySet<string>;
|
|
122
|
+
readonly normalizedNullResults: ReadonlySet<string>;
|
|
123
|
+
readonly normalizedPromiseValues: ReadonlySet<string>;
|
|
124
|
+
readonly asyncResolvedValues: ReadonlySet<string>;
|
|
125
|
+
readonly asyncForStatements: ReadonlySet<number>;
|
|
126
|
+
/** Direct, unshadowed `for name in range(...)` loops that can use a counted loop. */
|
|
127
|
+
readonly nativeRangeForStatements: ReadonlySet<number>;
|
|
128
|
+
readonly normalizedUndefinedExpressions: ReadonlySet<string>;
|
|
129
|
+
readonly instanceFieldReads: ReadonlySet<string>;
|
|
130
|
+
readonly errorCodeReads: ReadonlySet<string>;
|
|
131
|
+
readonly privateInstanceFieldReads: ReadonlySet<string>;
|
|
132
|
+
readonly staticFieldReads: ReadonlyMap<string, number>;
|
|
133
|
+
/**
|
|
134
|
+
* Member spans that read a class method as a value rather than calling it.
|
|
135
|
+
* Methods live on the prototype, so these emit as receiver-evaluated-once
|
|
136
|
+
* plus a bind at the reference site (charter sections 8 and 18).
|
|
137
|
+
*/
|
|
138
|
+
readonly classMethodReferences: ReadonlySet<string>;
|
|
139
|
+
readonly optionalBindingEntries: ReadonlySet<number>;
|
|
140
|
+
readonly reactiveReferences: ReadonlyMap<string, "state" | "prop">;
|
|
141
|
+
readonly enumValueBindings: ReadonlyMap<number, string>;
|
|
142
|
+
readonly exhaustiveMatches: ReadonlySet<number>;
|
|
143
|
+
readonly formReads: ReadonlyMap<string, readonly FormReadField[]>;
|
|
144
|
+
readonly namedArgumentOrders: ReadonlyMap<string, readonly number[]>;
|
|
145
|
+
readonly extensionLiterals: ReadonlyMap<string, string>;
|
|
146
|
+
readonly extensionCalls: ReadonlyMap<string, string>;
|
|
147
|
+
/** Prelude and permanent-namespace reads, keyed by span so lexical shadows win. */
|
|
148
|
+
readonly builtinValueReferences: ReadonlyMap<string, PermanentNamespaceName | "range">;
|
|
149
|
+
readonly runtimeNarrowings: ReadonlyMap<string, RuntimeNarrowingGuard>;
|
|
150
|
+
/**
|
|
151
|
+
* Span identities of `==`/`!=` operations (and comparison-chain links)
|
|
152
|
+
* whose operands may both be NaN at runtime. These lower to SameValueZero;
|
|
153
|
+
* every other equality elides the repair and emits plain `===` (D36 item 41).
|
|
154
|
+
*/
|
|
155
|
+
readonly sameValueZeroEqualities: ReadonlySet<string>;
|
|
156
|
+
/**
|
|
157
|
+
* Span identities of match value candidates that must compare by
|
|
158
|
+
* SameValueZero — the subject and the candidate can both be NaN — so
|
|
159
|
+
* `case box.nan:` agrees with `==` (ENM-D2, charter section 8). Everything
|
|
160
|
+
* else keeps plain `===`.
|
|
161
|
+
*/
|
|
162
|
+
readonly sameValueZeroMatchValues: ReadonlySet<string>;
|
|
163
|
+
/** Span identities of calls to the prelude's equals(a, b) (D47 rule 81). */
|
|
164
|
+
readonly equalsCalls: ReadonlySet<string>;
|
|
165
|
+
/**
|
|
166
|
+
* Span identities of ordered comparisons (`< <= > >=`, including
|
|
167
|
+
* comparison-chain links) whose operands are strings. These lower through
|
|
168
|
+
* the code-point comparator so string order is code-point order everywhere
|
|
169
|
+
* (TXT-D1); number comparisons keep the plain operator.
|
|
170
|
+
*/
|
|
171
|
+
readonly stringOrderings: ReadonlySet<string>;
|
|
172
|
+
/**
|
|
173
|
+
* Span identities of ordered comparisons between `Comparable`-bounded type
|
|
174
|
+
* parameters (D41 item 61). The runtime category is not known statically,
|
|
175
|
+
* so these lower through the dispatching comparator, which keeps a string
|
|
176
|
+
* pair in code-point order exactly as a monomorphic string comparison is.
|
|
177
|
+
*/
|
|
178
|
+
readonly dynamicOrderings: ReadonlySet<string>;
|
|
179
|
+
/**
|
|
180
|
+
* How each `using` statement releases its value, keyed by the statement's
|
|
181
|
+
* span identity (D43 item 69). The analyzer resolves the contract because it
|
|
182
|
+
* is the only stage that knows the value's type.
|
|
183
|
+
*/
|
|
184
|
+
readonly usingDisposals: ReadonlyMap<string, DisposalContract>;
|
|
185
|
+
/**
|
|
186
|
+
* Class declarations whose `@dispose:` must forward to an inherited one
|
|
187
|
+
* (D51 rule 102), keyed by the declaration's span identity. The value is the
|
|
188
|
+
* inherited release's async-ness, which decides whether the forward awaits.
|
|
189
|
+
*/
|
|
190
|
+
readonly classDisposeChains: ReadonlyMap<string, "sync" | "async">;
|
|
191
|
+
/**
|
|
192
|
+
* D68 rule 177: span identities of the expressions a consumer iterates
|
|
193
|
+
* through a class's `@iterate:` contract — the eight sites that consume an
|
|
194
|
+
* iterable. The emitter projects each one through the contract member, so
|
|
195
|
+
* what the runtime receives is the List, Set, Map, or Record the block
|
|
196
|
+
* returns and every consumer keeps the lowering it already had.
|
|
197
|
+
*/
|
|
198
|
+
readonly iterationContracts: ReadonlySet<string>;
|
|
199
|
+
/**
|
|
200
|
+
* Span identities of JavaScript-boundary calls in synchronous
|
|
201
|
+
* module-initialization position. A non-Error value thrown there would
|
|
202
|
+
* reach the host uncaught and unnormalized — the last unowned failure
|
|
203
|
+
* shape at the bridge — so these sites rethrow through the owned Error
|
|
204
|
+
* normalization channel (BRG-U10).
|
|
205
|
+
*/
|
|
206
|
+
readonly moduleTopLevelHostCalls: ReadonlySet<string>;
|
|
207
|
+
}
|
|
208
|
+
export interface RuntimeNarrowingGuard {
|
|
209
|
+
readonly expected: ValueType;
|
|
210
|
+
readonly description: string;
|
|
211
|
+
}
|
|
212
|
+
export interface AnalysisContext {
|
|
213
|
+
readonly imports?: ReadonlyMap<string, ValueType>;
|
|
214
|
+
readonly dynamicImports?: ReadonlyMap<string, ValueType>;
|
|
215
|
+
readonly reactiveImports?: ReadonlyMap<string, "state">;
|
|
216
|
+
readonly namedTypes?: ReadonlyMap<string, ReadonlyMap<string, ValueType>>;
|
|
217
|
+
readonly namedTypeReadonlyFields?: ReadonlyMap<string, ReadonlySet<string>>;
|
|
218
|
+
readonly namedTypeIdentities?: ReadonlyMap<string, string>;
|
|
219
|
+
/** D55: imported generic record declarations, by the name this module writes. */
|
|
220
|
+
readonly genericTypes?: ReadonlyMap<string, GenericTypeInfo>;
|
|
221
|
+
readonly typeAliases?: ReadonlyMap<string, ValueType>;
|
|
222
|
+
readonly enums?: ReadonlyMap<string, EnumInfo>;
|
|
223
|
+
readonly classes?: ReadonlyMap<string, ClassInfo>;
|
|
224
|
+
readonly extensionImports?: ReadonlyMap<string, ReadonlyMap<string, unknown>>;
|
|
225
|
+
readonly extensionModules?: ReadonlyMap<string, readonly unknown[]>;
|
|
226
|
+
readonly resources?: ReadonlyMap<string, string>;
|
|
227
|
+
/** Compiler-owned seeds used while omitted function results converge. */
|
|
228
|
+
readonly inferredFunctionResults?: ReadonlyMap<string, ValueType>;
|
|
229
|
+
/** True only for the final semantic pass after result inference converges. */
|
|
230
|
+
readonly finalizeFunctionResultInference?: boolean;
|
|
231
|
+
/** The module's own path; `test "name":` is only declared in a `*.test.vel` module. */
|
|
232
|
+
readonly path?: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* A direct read of an imported binding from a module-initialization position
|
|
236
|
+
* (top-level initializers and expression statements, static class fields,
|
|
237
|
+
* extension top-level initializers). The project driver combines these with
|
|
238
|
+
* the module graph to reject import cycles whose source module has not
|
|
239
|
+
* evaluated when the read runs (D31 item 23).
|
|
240
|
+
*/
|
|
241
|
+
export interface InitializationImportRead {
|
|
242
|
+
readonly local: string;
|
|
243
|
+
readonly source: string;
|
|
244
|
+
/**
|
|
245
|
+
* The name the source module exports, which may differ from `local`. The
|
|
246
|
+
* project driver follows it through re-export barrels to the module that
|
|
247
|
+
* actually declares the binding; a namespace import has no single name and
|
|
248
|
+
* records null.
|
|
249
|
+
*/
|
|
250
|
+
readonly imported: string | null;
|
|
251
|
+
readonly span: Span;
|
|
252
|
+
}
|
|
253
|
+
export declare const inferredResultPlaceholderType: ValueType;
|
|
254
|
+
/**
|
|
255
|
+
* D43 item 69: the emitted member behind a class's `@dispose:` block. The key
|
|
256
|
+
* is not a source-shaped identifier, so no author member can collide with it —
|
|
257
|
+
* `@dispose` is the language's name, not a name in the author's namespace.
|
|
258
|
+
*/
|
|
259
|
+
export declare const disposeMemberKey = "__velar:dispose";
|
|
260
|
+
/**
|
|
261
|
+
* D68 rule 177: the emitted member behind a class's `@iterate:` block, under
|
|
262
|
+
* the same kind of key and for the same reason — `@iterate` is the language's
|
|
263
|
+
* name for the question, so no author member can answer it by accident and no
|
|
264
|
+
* author call can reach it.
|
|
265
|
+
*/
|
|
266
|
+
export declare const iterateMemberKey = "__velar:iterate";
|
|
267
|
+
/** How a `using` binding releases its value at scope exit. */
|
|
268
|
+
export interface DisposalContract {
|
|
269
|
+
readonly member: string;
|
|
270
|
+
readonly asynchronous: boolean;
|
|
271
|
+
readonly owner: "class" | "capability";
|
|
272
|
+
}
|
|
273
|
+
export declare const TEXT_NAMESPACE_MEMBERS: readonly string[];
|
|
274
|
+
export declare const MATH_NAMESPACE_MEMBERS: readonly string[];
|
|
275
|
+
/**
|
|
276
|
+
* D57 rule 136: the permanent namespace that reaches every export of a retired
|
|
277
|
+
* standard module, or null while the module still publishes something of its
|
|
278
|
+
* own. Derived from the roster VEL3008 rejects imports with, so a diagnostic
|
|
279
|
+
* cannot list a module as importable after its members moved behind a prefix.
|
|
280
|
+
*/
|
|
281
|
+
export declare function permanentNamespaceCoveringModule(source: string, exports: Iterable<string>): PermanentNamespaceName | null;
|
|
282
|
+
export declare function isCorePrimitiveName(name: string): boolean;
|
|
283
|
+
export declare class Analyzer implements TypeEnvironment {
|
|
284
|
+
protected readonly diagnostics: Diagnostic[];
|
|
285
|
+
private readonly scopes;
|
|
286
|
+
private readonly memberNarrowings;
|
|
287
|
+
private readonly namedTypes;
|
|
288
|
+
private readonly namedTypeReadonlyFields;
|
|
289
|
+
private readonly namedTypeIdentities;
|
|
290
|
+
/** D55: generic record declarations in scope, by the name this module writes. */
|
|
291
|
+
private readonly genericTypes;
|
|
292
|
+
/** The same declarations by identity, so a substituted application can be re-instantiated. */
|
|
293
|
+
private readonly genericTypesByIdentity;
|
|
294
|
+
/** Every instantiation seen, by identity, waiting for its field table to be asked for. */
|
|
295
|
+
private readonly genericApplications;
|
|
296
|
+
/** One canonical object per instantiation, so identity-keyed cycle guards still cut. */
|
|
297
|
+
private readonly canonicalGenericApplications;
|
|
298
|
+
private readonly typeAliases;
|
|
299
|
+
private readonly invalidDeclaredTypes;
|
|
300
|
+
private readonly typeReferenceValidity;
|
|
301
|
+
private readonly typeParameterFrames;
|
|
302
|
+
private readonly typeParameterFrameBounds;
|
|
303
|
+
private readonly invalidExternTypeReferences;
|
|
304
|
+
private readonly enums;
|
|
305
|
+
private readonly classes;
|
|
306
|
+
private readonly classDisplayNames;
|
|
307
|
+
private readonly externModules;
|
|
308
|
+
private readonly externTypeImports;
|
|
309
|
+
private readonly externClassDeclarations;
|
|
310
|
+
private readonly returnContexts;
|
|
311
|
+
private readonly asynchronousFunctions;
|
|
312
|
+
private readonly collectionCalls;
|
|
313
|
+
private readonly collectionSizes;
|
|
314
|
+
private readonly binaryCalls;
|
|
315
|
+
private readonly binarySizes;
|
|
316
|
+
private readonly binaryIndexes;
|
|
317
|
+
private readonly primitiveCalls;
|
|
318
|
+
private readonly sameValueZeroEqualities;
|
|
319
|
+
private readonly sameValueZeroMatchValues;
|
|
320
|
+
private readonly equalsCalls;
|
|
321
|
+
private readonly stringOrderings;
|
|
322
|
+
private readonly dynamicOrderings;
|
|
323
|
+
private readonly reportedBoundViolations;
|
|
324
|
+
private readonly usingDisposals;
|
|
325
|
+
private readonly classDisposeChains;
|
|
326
|
+
/** D68 rule 177: expression spans a consumer iterates through `@iterate:`. */
|
|
327
|
+
private readonly iterationContracts;
|
|
328
|
+
/**
|
|
329
|
+
* D68 rule 177: the function depth of each `@iterate:` body being analyzed.
|
|
330
|
+
* A nested arrow inside the block is an ordinary callable and keeps the
|
|
331
|
+
* ordinary advice, so the contract's own message needs the exact depth.
|
|
332
|
+
*/
|
|
333
|
+
private readonly iterateContractDepths;
|
|
334
|
+
/** D51 rule 101: arrows that read a `using`-owned binding, by arrow span. */
|
|
335
|
+
private readonly arrowOwnedCaptures;
|
|
336
|
+
private readonly arrowCaptureFrames;
|
|
337
|
+
private readonly declaredTestTitles;
|
|
338
|
+
private readonly moduleTopLevelHostCalls;
|
|
339
|
+
private readonly stringSizes;
|
|
340
|
+
private readonly constructorCalls;
|
|
341
|
+
private readonly javaScriptBindings;
|
|
342
|
+
private readonly javaScriptCallBoundaries;
|
|
343
|
+
private readonly classChecks;
|
|
344
|
+
private readonly privateMembers;
|
|
345
|
+
private readonly optionalMembers;
|
|
346
|
+
private readonly optionalCalls;
|
|
347
|
+
private readonly optionalIndexes;
|
|
348
|
+
private readonly optionalCallees;
|
|
349
|
+
private readonly constructorFieldInitializations;
|
|
350
|
+
private readonly truthConditions;
|
|
351
|
+
private readonly normalizedNullResults;
|
|
352
|
+
private readonly normalizedPromiseValues;
|
|
353
|
+
private readonly asyncResolvedValues;
|
|
354
|
+
private readonly asyncForStatements;
|
|
355
|
+
private readonly nativeRangeForStatements;
|
|
356
|
+
private readonly nonFallthroughWhileStatements;
|
|
357
|
+
private readonly reportedPromiseResolutionHazards;
|
|
358
|
+
private readonly normalizedUndefinedExpressions;
|
|
359
|
+
private readonly instanceFieldReads;
|
|
360
|
+
private readonly errorCodeReads;
|
|
361
|
+
private readonly privateInstanceFieldReads;
|
|
362
|
+
private readonly staticFieldReads;
|
|
363
|
+
private readonly classMethodReferences;
|
|
364
|
+
private readonly callExpressionCallees;
|
|
365
|
+
private readonly memberAccessReceivers;
|
|
366
|
+
private readonly readonlyClassScanVerdicts;
|
|
367
|
+
private readonly optionalBindingEntries;
|
|
368
|
+
protected readonly reactiveBindings: Map<string, "state">;
|
|
369
|
+
private readonly reactiveReferences;
|
|
370
|
+
private readonly pendingScopeDeclarations;
|
|
371
|
+
private readonly reportedShadowedReads;
|
|
372
|
+
protected readonly enumValueBindings: Map<number, string>;
|
|
373
|
+
private readonly exhaustiveMatches;
|
|
374
|
+
private readonly formReads;
|
|
375
|
+
private readonly namedArgumentOrders;
|
|
376
|
+
protected readonly extensionLiterals: Map<string, string>;
|
|
377
|
+
protected readonly extensionCalls: Map<string, string>;
|
|
378
|
+
private readonly builtinValueReferences;
|
|
379
|
+
private readonly semanticBindingTypes;
|
|
380
|
+
private readonly semanticBindingMembers;
|
|
381
|
+
private readonly semanticMemberCache;
|
|
382
|
+
private readonly semanticExpressionTypes;
|
|
383
|
+
private readonly semanticExpressionMembers;
|
|
384
|
+
private readonly semanticExpressionOwners;
|
|
385
|
+
private readonly semanticObjectPropertyOwners;
|
|
386
|
+
private readonly semanticBindingEntryOwners;
|
|
387
|
+
protected readonly semanticJsxAttributeOwners: Map<string, ValueType>;
|
|
388
|
+
private readonly semanticExpressionContexts;
|
|
389
|
+
private readonly semanticExpressionContextMembers;
|
|
390
|
+
private readonly contextualAssignments;
|
|
391
|
+
private readonly inferredExpressionTypes;
|
|
392
|
+
private readonly runtimeNarrowings;
|
|
393
|
+
private readonly inferredFunctionResultSeeds;
|
|
394
|
+
private readonly inferredFunctionResultTypes;
|
|
395
|
+
private readonly finalizeFunctionResultInference;
|
|
396
|
+
private readonly logicalConditionNarrowings;
|
|
397
|
+
private readonly collectionInferenceGroups;
|
|
398
|
+
private readonly collectionInferenceTypes;
|
|
399
|
+
private readonly privateFields;
|
|
400
|
+
private readonly privateGetters;
|
|
401
|
+
private readonly privateMethods;
|
|
402
|
+
private readonly privateStaticFields;
|
|
403
|
+
private readonly privateStaticGetters;
|
|
404
|
+
private readonly privateStaticMethods;
|
|
405
|
+
private readonly predeclared;
|
|
406
|
+
private functionDepth;
|
|
407
|
+
private parameterDefaultDepth;
|
|
408
|
+
private loopDepth;
|
|
409
|
+
private finallyLoopDepths;
|
|
410
|
+
private unreachableDiagnosticDepth;
|
|
411
|
+
private readonly loopFlowContexts;
|
|
412
|
+
private loopCaptureFloor;
|
|
413
|
+
private currentClass;
|
|
414
|
+
private superMemberContext;
|
|
415
|
+
private classFieldInitializerDepth;
|
|
416
|
+
private instanceFieldInitializerDepth;
|
|
417
|
+
protected deferredExecutionDepth: number;
|
|
418
|
+
private readonly importedBindingSources;
|
|
419
|
+
private readonly importedBindingOrigins;
|
|
420
|
+
/** Namespace import locals by name, known before signature validation runs (ENM-I9 teaching). */
|
|
421
|
+
private readonly namespaceImportLocals;
|
|
422
|
+
private readonly initializationImportReadSites;
|
|
423
|
+
/** Local class bindings mapped to the source offset where their `class` statement evaluates (CLS-D8). */
|
|
424
|
+
private readonly hoistedClassDeclarations;
|
|
425
|
+
/** Module-scope names bound to runtime Type objects (local and imported); see LoweringHints.runtimeTypeObjectNames. */
|
|
426
|
+
private readonly runtimeTypeObjectNames;
|
|
427
|
+
private staticFieldInitialization;
|
|
428
|
+
protected constructorDepth: number;
|
|
429
|
+
private allowedSuperCall;
|
|
430
|
+
protected flowFrameDepth: number;
|
|
431
|
+
private readonly primitiveNames;
|
|
432
|
+
private readonly primitiveParents;
|
|
433
|
+
private readonly primitiveMutableFields;
|
|
434
|
+
private readonly extensionGlobals;
|
|
435
|
+
private readonly extensionReservedBindings;
|
|
436
|
+
private readonly globalGuidance;
|
|
437
|
+
private readonly scopedGlobalGuidance;
|
|
438
|
+
private readonly analysisExtensions;
|
|
439
|
+
private readonly retiredNamespaces;
|
|
440
|
+
/** Every `Retired.member` read, collected so one migration can carry the whole rewrite. */
|
|
441
|
+
private readonly retiredNamespaceUses;
|
|
442
|
+
/** The property each member access asks for, keyed by the receiver's span. */
|
|
443
|
+
private readonly memberAccessProperties;
|
|
444
|
+
/** Every name this module declares anywhere, so a rewrite can prove it collides with nothing. */
|
|
445
|
+
private readonly declaredNames;
|
|
446
|
+
private readonly promiseInitializerBindings;
|
|
447
|
+
private readonly testExpectOperands;
|
|
448
|
+
/** D52 rule 116: reads of a name imported from a module that has a permanent namespace. */
|
|
449
|
+
private readonly permanentNamespaceImportReads;
|
|
450
|
+
/** The import each such local came from, keyed by the local name. */
|
|
451
|
+
private readonly permanentNamespaceImportOrigins;
|
|
452
|
+
constructor(context?: AnalysisContext, extensions?: readonly CompilerAnalysisExtension[]);
|
|
453
|
+
/**
|
|
454
|
+
* The guidance a reserved global earns where it was written. A module path
|
|
455
|
+
* suffix selects the door that is actually open there before the module-wide
|
|
456
|
+
* answer applies.
|
|
457
|
+
*/
|
|
458
|
+
private guidanceForGlobal;
|
|
459
|
+
private nearestVisibleBindingName;
|
|
460
|
+
private readonly modulePath;
|
|
461
|
+
private readonly importBindings;
|
|
462
|
+
private readonly dynamicImports;
|
|
463
|
+
analyze(program: Program): readonly Diagnostic[];
|
|
464
|
+
private registerExternTypeImports;
|
|
465
|
+
private validateDataTypeDeclarations;
|
|
466
|
+
private validateCoreDeclarationSignatures;
|
|
467
|
+
private typeSyntaxReferencesInvalidDeclaration;
|
|
468
|
+
private rejectUnproductiveRecursiveTypes;
|
|
469
|
+
private predeclareTopLevel;
|
|
470
|
+
private registerExternClassDeclarations;
|
|
471
|
+
private validateExternDeclarations;
|
|
472
|
+
private validateReExports;
|
|
473
|
+
private registerExternModules;
|
|
474
|
+
loweringHints(): LoweringHints;
|
|
475
|
+
semanticTypes(): ReadonlyMap<string, ValueType>;
|
|
476
|
+
inferredFunctionResults(): ReadonlyMap<string, ValueType>;
|
|
477
|
+
static inferredFunctionResultsMatch(left: ReadonlyMap<string, ValueType>, right: ReadonlyMap<string, ValueType>): boolean;
|
|
478
|
+
semanticMembers(): ReadonlyMap<string, ReadonlyMap<string, ValueType>>;
|
|
479
|
+
analyzedClasses(): ReadonlyMap<string, ClassInfo>;
|
|
480
|
+
semanticExpressions(): {
|
|
481
|
+
readonly types: ReadonlyMap<string, ValueType>;
|
|
482
|
+
readonly members: ReadonlyMap<string, ReadonlyMap<string, ValueType>>;
|
|
483
|
+
readonly owners: ReadonlyMap<string, ValueType>;
|
|
484
|
+
readonly objectPropertyOwners: ReadonlyMap<string, ValueType>;
|
|
485
|
+
readonly bindingEntryOwners: ReadonlyMap<string, ValueType>;
|
|
486
|
+
readonly jsxAttributeOwners: ReadonlyMap<string, ValueType>;
|
|
487
|
+
readonly contexts: ReadonlyMap<string, ValueType>;
|
|
488
|
+
readonly contextMembers: ReadonlyMap<string, ReadonlyMap<string, ValueType>>;
|
|
489
|
+
};
|
|
490
|
+
fieldsOf(identity: string): ReadonlyMap<string, ValueType> | null;
|
|
491
|
+
/**
|
|
492
|
+
* D55 rule 121: an instantiation's field table is the declaration's fields
|
|
493
|
+
* with the arguments substituted, registered under the instantiation's own
|
|
494
|
+
* identity. Computing it on demand rather than at the point the application
|
|
495
|
+
* was written is what makes `type Tree<T>: kids: List<Tree<T>>` terminate:
|
|
496
|
+
* the application is *noted* while the declaration is still being read, and
|
|
497
|
+
* substituted only once someone asks, by which time the template is whole.
|
|
498
|
+
* Substitution rebuilds nested applications through the same constructor, so
|
|
499
|
+
* each one is noted in turn and the walk is finite in the number of distinct
|
|
500
|
+
* instantiations — homogeneous recursion reaches its fixed point, and rule
|
|
501
|
+
* 125's declaration-site rule is what stops a polymorphic one from existing.
|
|
502
|
+
*/
|
|
503
|
+
private instantiateGenericFields;
|
|
504
|
+
/**
|
|
505
|
+
* Records every generic application inside a type so its field table can be
|
|
506
|
+
* built on demand. Called wherever an application can first become visible —
|
|
507
|
+
* a resolved annotation, an imported binding, a substituted field — because a
|
|
508
|
+
* missed site is an instantiation whose fields silently read as "not a
|
|
509
|
+
* record" (the batch M failure shape, one layer out).
|
|
510
|
+
*/
|
|
511
|
+
private noteGenericApplications;
|
|
512
|
+
/** The generic record a name in this module refers to, local or imported. */
|
|
513
|
+
protected genericTypeInfo(name: string): GenericTypeInfo | null;
|
|
514
|
+
/**
|
|
515
|
+
* D55 rule 121: the one place an application written in this module becomes
|
|
516
|
+
* canonical — declaration identity, display text, instantiation identity, and
|
|
517
|
+
* the note that lets its field table be built. Every path that can be the
|
|
518
|
+
* first to see an application calls this, so none of them can produce a
|
|
519
|
+
* half-resolved one.
|
|
520
|
+
*/
|
|
521
|
+
private resolveGenericApplication;
|
|
522
|
+
/**
|
|
523
|
+
* D55 rules 124 and 126: everything an instantiation has to answer for at the
|
|
524
|
+
* place it is written — arity, the declared bounds, and the one argument
|
|
525
|
+
* shape a runtime-validated record can never hold.
|
|
526
|
+
*/
|
|
527
|
+
private validateGenericApplication;
|
|
528
|
+
/**
|
|
529
|
+
* D55 rule 125: a generic record's reference to a declaration in its own
|
|
530
|
+
* recursive group must pass that group's parameters straight through.
|
|
531
|
+
* `type Tree<T>: kids: List<Tree<T>>` is homogeneous — `Tree<string>` needs
|
|
532
|
+
* only `Tree<string>`, and monomorphization reaches its fixed point. The
|
|
533
|
+
* refused shape, `type Bad<T>: next: Bad<List<T>>?`, demands
|
|
534
|
+
* `Bad<List<string>>`, `Bad<List<List<string>>>`, without end. The rule is
|
|
535
|
+
* checked here, on the line that declares it, because an instantiation-depth
|
|
536
|
+
* limit could only say "too deep" at some later call — the undirected
|
|
537
|
+
* diagnostic family D42 spent its length removing.
|
|
538
|
+
*/
|
|
539
|
+
private rejectPolymorphicRecursion;
|
|
540
|
+
isExtensionTypeAssignable(actual: ExtensionValueType, expected: ExtensionValueType, assign: (actual: ValueType, expected: ValueType) => boolean): boolean | undefined;
|
|
541
|
+
extensionTextForm(type: ValueType): boolean | undefined;
|
|
542
|
+
protected readonlyDataViewOf(type: ValueType): ValueType;
|
|
543
|
+
readonlyFieldsOf(identity: string): ReadonlySet<string> | null;
|
|
544
|
+
/**
|
|
545
|
+
* D44 rule 72: `readonly T` promises that everything reachable through the
|
|
546
|
+
* view is protected data, so a class type at any depth is rejected at the
|
|
547
|
+
* declaration site — otherwise the promise would silently end at the class
|
|
548
|
+
* member. Bare type parameters stay legal (opacity is as good as
|
|
549
|
+
* immutability), `unknown`/`any` are already where static promises end, and
|
|
550
|
+
* function types are behavior boundaries whose signatures are not data.
|
|
551
|
+
* Named records are memoized per identity; a verdict computed through a
|
|
552
|
+
* recursion cut stays local to that traversal so shared types keep sound
|
|
553
|
+
* cached answers.
|
|
554
|
+
*/
|
|
555
|
+
protected findClassInReadonlyData(type: ValueType, seen?: Set<string>, sawCycle?: {
|
|
556
|
+
cut: boolean;
|
|
557
|
+
}): {
|
|
558
|
+
readonly suffix: string;
|
|
559
|
+
readonly className: string;
|
|
560
|
+
} | null;
|
|
561
|
+
protected predeclareExtensionStatement(_statement: Statement): boolean;
|
|
562
|
+
protected analyzeExtensionStatement(_statement: Statement): boolean;
|
|
563
|
+
protected extensionExpressionContainsDirectAwait(expression: Expression, contains: (expression: Expression) => boolean): boolean | undefined;
|
|
564
|
+
protected extensionStatementContainsDirectAwait(statement: Statement, containsExpression: (expression: Expression) => boolean, containsBlock: (statements: readonly Statement[]) => boolean): boolean | undefined;
|
|
565
|
+
protected prescanExtensionScopeDeclaration(_statement: Statement): {
|
|
566
|
+
readonly name: string;
|
|
567
|
+
readonly span: Span;
|
|
568
|
+
} | null;
|
|
569
|
+
protected inferExtensionExpression(_expression: Expression, _contextualType: ValueType): ValueType | undefined;
|
|
570
|
+
protected inferExtensionCall(_callee: ExtensionValueType, _arguments: readonly Expression[], _argumentNames: readonly (string | null)[] | undefined, _callSpan: Span): ValueType | undefined;
|
|
571
|
+
protected validateExtensionTypeSyntax(_syntax: TypeSyntax, _validate: (syntax: TypeSyntax) => boolean, _resolve: (reference: TypeReference) => ValueType): boolean | undefined;
|
|
572
|
+
protected extensionFieldsOf(_name: string): ReadonlyMap<string, ValueType> | null;
|
|
573
|
+
protected invalidExtensionAwaitContext(): boolean;
|
|
574
|
+
protected invalidExtensionAwaitMessage(): string | null;
|
|
575
|
+
protected isTopLevelScope(): boolean;
|
|
576
|
+
protected isPredeclared(statement: object): boolean;
|
|
577
|
+
isSubclassOf(actual: string, expected: string): boolean;
|
|
578
|
+
isPrimitiveType(name: string): boolean;
|
|
579
|
+
isPrimitiveSubtype(actual: string, expected: string): boolean;
|
|
580
|
+
/**
|
|
581
|
+
* D51 rule 109: `Comparable`, `Text`, and `Data` are the compiler's own
|
|
582
|
+
* closed bound vocabulary (D41 item 61). A user type of the same name used to
|
|
583
|
+
* be accepted and then silently ignored at every `<T: Data>` — the bound won,
|
|
584
|
+
* so `save(42)` passed a function whose author had declared a record. The
|
|
585
|
+
* name is rejected where it is introduced, which is the only place a rename
|
|
586
|
+
* is cheap; the use site could only report an ambiguity nobody can fix.
|
|
587
|
+
*/
|
|
588
|
+
private rejectReservedTypeNames;
|
|
589
|
+
private registerAliasShapes;
|
|
590
|
+
protected expandAliases(type: ValueType, seen?: ReadonlySet<string>): ValueType;
|
|
591
|
+
/**
|
|
592
|
+
* D55 rule 120: generic record declarations are registered in two steps —
|
|
593
|
+
* every name and parameter list first, then the field types. A field type may
|
|
594
|
+
* apply another generic record, or this one, and neither could be resolved if
|
|
595
|
+
* the declarations were read one at a time.
|
|
596
|
+
*/
|
|
597
|
+
private registerGenericTypeShapes;
|
|
598
|
+
private registerTypeShapes;
|
|
599
|
+
private registerEnumShapes;
|
|
600
|
+
private registerClassNames;
|
|
601
|
+
private registerClassShapes;
|
|
602
|
+
protected analyzeStatement(statement: Statement): void;
|
|
603
|
+
private checkFloatingPromiseStatement;
|
|
604
|
+
private checkDiscardedExpressionResult;
|
|
605
|
+
private carriesPromise;
|
|
606
|
+
private checkDiscardedPureResult;
|
|
607
|
+
private callSpelling;
|
|
608
|
+
private analyzeAsyncStatement;
|
|
609
|
+
private analyzeTypeDeclaration;
|
|
610
|
+
private analyzeTypeAliasDeclaration;
|
|
611
|
+
private analyzeClassDeclaration;
|
|
612
|
+
/**
|
|
613
|
+
* D51 item NEW-D7: `name`, `code`, `message`, `stack`, and `cause` are the
|
|
614
|
+
* Error contract's own members, not names a subclass may reuse. The generic
|
|
615
|
+
* inherited-field check let a `const` through whenever it restated the same
|
|
616
|
+
* type — and that spelling forged `code` (charter 2070 promises `code` and
|
|
617
|
+
* `name` never disagree) or silently discarded the constructed message.
|
|
618
|
+
*/
|
|
619
|
+
private errorContractMemberRejection;
|
|
620
|
+
private validateClassMemberName;
|
|
621
|
+
private analyzeClassInitialization;
|
|
622
|
+
/**
|
|
623
|
+
* D39 item 53: `test "name":` is one test. Its body is an async frame — a
|
|
624
|
+
* test awaits its own work — and its name is the product specification a
|
|
625
|
+
* person reads, so it must be present, unique in the module, and declared
|
|
626
|
+
* where the runner actually looks.
|
|
627
|
+
*/
|
|
628
|
+
private analyzeTestDeclaration;
|
|
629
|
+
/**
|
|
630
|
+
* D43 item 69: `using name = expression` claims ownership of a resource for
|
|
631
|
+
* the enclosing scope. The value's type must declare the release contract,
|
|
632
|
+
* the scope must be able to run it, and the module top level — which lives
|
|
633
|
+
* until the process ends — has no scope exit to release at.
|
|
634
|
+
*/
|
|
635
|
+
private analyzeUsingDeclaration;
|
|
636
|
+
/**
|
|
637
|
+
* D51 rule 101: an owned resource may not leave the scope that releases it.
|
|
638
|
+
* `using` means "this scope owns it and guarantees the release", so letting
|
|
639
|
+
* the value out hands back a reference that is already known to be dead —
|
|
640
|
+
* which is the construct's definition, not a restriction on top of it. The
|
|
641
|
+
* judgement is *storage and return*, never use: passing the handle to a
|
|
642
|
+
* function stays legal, because a callee borrows and must not assume
|
|
643
|
+
* ownership. Returns the owned binding an expression carries, or null.
|
|
644
|
+
*/
|
|
645
|
+
private carriedOwnedResource;
|
|
646
|
+
/** The scope nesting level a name is declared at, or 0 when it is not a local. */
|
|
647
|
+
private bindingScopeDepth;
|
|
648
|
+
private rejectOwnedResourceEscape;
|
|
649
|
+
/**
|
|
650
|
+
* The release contract of a value's type: a class's own `@dispose:` block, or
|
|
651
|
+
* a standard capability handle, which delegates to the verb it already
|
|
652
|
+
* publishes (`close()` or `stop()`) rather than being renamed for `using`.
|
|
653
|
+
*/
|
|
654
|
+
private disposalContract;
|
|
655
|
+
/**
|
|
656
|
+
* D51 rule 102 + item NEW-D4. Rule 102 makes the compiler chain a derived
|
|
657
|
+
* `@dispose:` into its base's, so the emitter is told which classes forward
|
|
658
|
+
* and whether the forwarded release awaits. NEW-D4 is the soundness half:
|
|
659
|
+
* `using` reads the release contract off the *static* type, so a subclass
|
|
660
|
+
* that starts awaiting where its ancestors do not would be released without
|
|
661
|
+
* an await through a base-typed binding — an unhandled rejection that kills
|
|
662
|
+
* the process. Adding `await` downward is therefore rejected at the subclass;
|
|
663
|
+
* an ancestor that already awaits carries every descendant with it.
|
|
664
|
+
*/
|
|
665
|
+
private checkDisposalChain;
|
|
666
|
+
/** Every `@dispose:` a class releases through, most derived first (D51 rule 102). */
|
|
667
|
+
private disposalChain;
|
|
668
|
+
/**
|
|
669
|
+
* D43 item 69 rule 6: `using` needs a scope exit to release at. The module
|
|
670
|
+
* top level has none — it lives until the process ends. An extension whose
|
|
671
|
+
* body is not an ordinary scope adds its own answer.
|
|
672
|
+
*/
|
|
673
|
+
protected ownershipScopeRejection(): string | null;
|
|
674
|
+
private disposalGuidance;
|
|
675
|
+
/**
|
|
676
|
+
* D43 item 69: the `@dispose:` body is a release contract, not a method. It
|
|
677
|
+
* runs with `self` in scope and may `await`; whether it actually does is what
|
|
678
|
+
* decides that a `using` of this class needs an async scope.
|
|
679
|
+
*/
|
|
680
|
+
private analyzeClassDispose;
|
|
681
|
+
/** D68 rule 177: the convergence key of one `@iterate:` block. */
|
|
682
|
+
private iterationResultKey;
|
|
683
|
+
/**
|
|
684
|
+
* D68 rule 177: `@iterate:` carries no result annotation — the block *is* the
|
|
685
|
+
* answer — so the class shape pre-pass reads what the previous convergence
|
|
686
|
+
* pass learned. Without the seed, a use written above the class would see an
|
|
687
|
+
* unresolved placeholder, which is the same problem an omitted function
|
|
688
|
+
* result has and gets the same solution.
|
|
689
|
+
*/
|
|
690
|
+
private seededIterationSource;
|
|
691
|
+
/**
|
|
692
|
+
* D68 rule 177: `@iterate:` answers the language's question "what does
|
|
693
|
+
* iterating you mean?" with a collection the language already iterates. It
|
|
694
|
+
* shares `@dispose:`'s path because it is the same kind of member — a
|
|
695
|
+
* contract, not a method — and it differs in exactly two ways, both forced:
|
|
696
|
+
* it produces a value, and it may not `await`, because every one of the eight
|
|
697
|
+
* consumers reads it synchronously.
|
|
698
|
+
*/
|
|
699
|
+
private analyzeClassIterate;
|
|
700
|
+
/**
|
|
701
|
+
* The four collections are the whole answer space: the block says "iterating
|
|
702
|
+
* me is iterating this", and the language already fixed what iterating a
|
|
703
|
+
* List, Set, Map, or Record means. Anything else would be a second iteration
|
|
704
|
+
* semantics, which is the thing charter section 19 keeps out.
|
|
705
|
+
*/
|
|
706
|
+
private validatedIterationSource;
|
|
707
|
+
/** The `@iterate:` answer a class inherits, most derived ancestor first. */
|
|
708
|
+
private inheritedIterationSource;
|
|
709
|
+
/**
|
|
710
|
+
* D68 rule 177: what iterating this value means. A class answers through
|
|
711
|
+
* `@iterate:` — its own, or the one it inherits, because overriding replaces
|
|
712
|
+
* a single answer instead of composing a chain the way `@dispose:` does.
|
|
713
|
+
*/
|
|
714
|
+
private iterationContract;
|
|
715
|
+
/**
|
|
716
|
+
* Projects one consumer's operand through `@iterate:` and records the span so
|
|
717
|
+
* the emitter projects it too. Every consumer of an iterable calls this, so
|
|
718
|
+
* `for item in bag` and `item in bag` can never disagree about whether a
|
|
719
|
+
* class participates — D68 names that split as the trap this design exists to
|
|
720
|
+
* avoid.
|
|
721
|
+
*/
|
|
722
|
+
private iterationSource;
|
|
723
|
+
/**
|
|
724
|
+
* The one sentence that teaches the contract, appended wherever a consumer
|
|
725
|
+
* refuses a class. A class that already declares `@iterate:` gets nothing:
|
|
726
|
+
* its own block carries the precise diagnostic.
|
|
727
|
+
*/
|
|
728
|
+
private iterationGuidance;
|
|
729
|
+
private validateConstructorShape;
|
|
730
|
+
private validateMethodSignature;
|
|
731
|
+
private findField;
|
|
732
|
+
private findGetter;
|
|
733
|
+
private findMethod;
|
|
734
|
+
private asyncPullElementType;
|
|
735
|
+
private findStaticField;
|
|
736
|
+
private findStaticFieldOwner;
|
|
737
|
+
private findStaticGetter;
|
|
738
|
+
private findStaticMethod;
|
|
739
|
+
private privateFieldForAccess;
|
|
740
|
+
private privateMethodForAccess;
|
|
741
|
+
private declaresPrivateMember;
|
|
742
|
+
private unimplementedAbstractMethods;
|
|
743
|
+
/**
|
|
744
|
+
* D58 rule 139: `-> null` is the one result annotation that names nothing a
|
|
745
|
+
* caller can use — a caller that ignores a result already knows as much — so
|
|
746
|
+
* where a body infers exactly that, the annotation is two spellings of one
|
|
747
|
+
* declaration and the written one is refused. `extern` declarations,
|
|
748
|
+
* abstract methods, and function types have no body to infer from and keep
|
|
749
|
+
* declaring it (VEL4023, VEL2001), and a getter's result is the property's
|
|
750
|
+
* type, which the parser requires outright (VEL2023).
|
|
751
|
+
*
|
|
752
|
+
* Deleting an annotation the compiler would infer identically is provably
|
|
753
|
+
* equivalent, so it is a mechanical fix under D50 rule 95 — but only there.
|
|
754
|
+
* D58 correction 2: where the body returns a value, the deletion is not
|
|
755
|
+
* equivalent, it widens the signature and takes VEL4001 down with it, so the
|
|
756
|
+
* refusal is reported without a fix and the author decides whether the body
|
|
757
|
+
* or the intent was wrong. `velar fix` runs unattended because it never does
|
|
758
|
+
* the second kind of thing.
|
|
759
|
+
*
|
|
760
|
+
* D64 rule 162: dropping the fix was only half of that correction. The
|
|
761
|
+
* message still said "delete the annotation" — the one move the ruling had
|
|
762
|
+
* just refused to make — so the diagnostic taught an exit it rejects on the
|
|
763
|
+
* next step, which is the D57 rule 136 shape. The two cases now carry two
|
|
764
|
+
* messages: where the body does infer null the deletion is the answer, and
|
|
765
|
+
* where it does not, the disagreement between the body and the annotation is
|
|
766
|
+
* the answer, and deleting would only widen the signature to hide it.
|
|
767
|
+
*/
|
|
768
|
+
private inferredNullResultAnnotation;
|
|
769
|
+
private reportInferredNullResult;
|
|
770
|
+
protected analyzeFunctionDeclaration(statement: AnalyzableFunctionDeclaration, className: string | null, method?: boolean, declareSelf?: boolean, forceAsynchronous?: boolean, declarationKind?: string): void;
|
|
771
|
+
protected analyzeBlock(statements: readonly Statement[], narrowed?: ReadonlyMap<string, ValueType>): ReadonlyMap<string, ValueType>;
|
|
772
|
+
private survivingNarrowings;
|
|
773
|
+
protected analyzeStatements(statements: readonly Statement[]): void;
|
|
774
|
+
private analyzeAssignment;
|
|
775
|
+
private primitiveFieldWritable;
|
|
776
|
+
protected inferExpression(expression: Expression, contextualType?: ValueType): ValueType;
|
|
777
|
+
private inferredOrAnalyze;
|
|
778
|
+
private hasNullishContract;
|
|
779
|
+
private expressionAlreadyNormalizesUndefined;
|
|
780
|
+
private shouldNormalizeNullish;
|
|
781
|
+
private recordSemanticExpression;
|
|
782
|
+
/**
|
|
783
|
+
* CLS-I1: the positions where `self` does not exist, and why. A field
|
|
784
|
+
* initializer runs while the instance is still being assembled, so there is
|
|
785
|
+
* no complete `self` to read; a static member belongs to the class and has
|
|
786
|
+
* no instance at all. Outside a class the word is simply an unknown name and
|
|
787
|
+
* keeps the ordinary message.
|
|
788
|
+
*/
|
|
789
|
+
private unavailableSelfGuidance;
|
|
790
|
+
private inferExpressionType;
|
|
791
|
+
private isCoreDurationLiteral;
|
|
792
|
+
private containsCoreDuration;
|
|
793
|
+
private inferCoreDurationExpression;
|
|
794
|
+
private inferBinary;
|
|
795
|
+
private requireIntersectingEquality;
|
|
796
|
+
private rejectFreshCollectionEquality;
|
|
797
|
+
private freshCollectionOperand;
|
|
798
|
+
private requireMembershipIntersection;
|
|
799
|
+
private rejectDisjointEnumTest;
|
|
800
|
+
/** The enum/null arms of a type, or null when any arm falls outside that domain. */
|
|
801
|
+
private pureEnumDomainArms;
|
|
802
|
+
private rejectDisjointEnumValidatorProbe;
|
|
803
|
+
private enumTargetOfValidatorObject;
|
|
804
|
+
/** The enum behind a type alias name, or null when the alias does not resolve to an enum. */
|
|
805
|
+
private aliasedEnumTarget;
|
|
806
|
+
private rejectCollidingKeyDomain;
|
|
807
|
+
/**
|
|
808
|
+
* The declared domain behind an assignment-established fact: what a test
|
|
809
|
+
* (`== null`, `??`) judges, and what an unannotated alias declares. Returns
|
|
810
|
+
* the inferred type unchanged when the expression's narrowing came from a
|
|
811
|
+
* check (or from nothing).
|
|
812
|
+
*/
|
|
813
|
+
private assignedFactDomain;
|
|
814
|
+
private equalityTypesIntersect;
|
|
815
|
+
private typesIntersect;
|
|
816
|
+
private equalityGuidance;
|
|
817
|
+
private valueLevelEnum;
|
|
818
|
+
private hasValueLevelString;
|
|
819
|
+
private equalityOperandMayBeNaN;
|
|
820
|
+
private equalityMayCompareNaN;
|
|
821
|
+
private coalescingFallbackContext;
|
|
822
|
+
private requireOrderedComparison;
|
|
823
|
+
private unorderedTypeGuidance;
|
|
824
|
+
private mentionsEnumType;
|
|
825
|
+
protected inferParameterDefault(expression: Expression, contextualType?: ValueType): ValueType;
|
|
826
|
+
protected resolvedAsyncResult(type: ValueType): ValueType;
|
|
827
|
+
private asyncResultContainsPromise;
|
|
828
|
+
private callableThenMember;
|
|
829
|
+
private promiseResolutionHazard;
|
|
830
|
+
private promiseResolutionNeedsRuntimeGuard;
|
|
831
|
+
private reportPromiseResolutionHazard;
|
|
832
|
+
private reportPromiseCarrierHazard;
|
|
833
|
+
private inferArrow;
|
|
834
|
+
private inferCall;
|
|
835
|
+
private javaScriptBoundaryCallee;
|
|
836
|
+
private inferGenericCall;
|
|
837
|
+
/**
|
|
838
|
+
* D41 item 61 check site 1: once the two-phase inference has solved the
|
|
839
|
+
* bindings, every bound is verified before the ordinary assignability loop
|
|
840
|
+
* runs, so a rejected type argument is reported once, at its cause.
|
|
841
|
+
*/
|
|
842
|
+
private reportGenericBoundViolations;
|
|
843
|
+
/**
|
|
844
|
+
* D41 item 61 check site 2: a generic callable used as a value is solved and
|
|
845
|
+
* erased silently, so the wrapper re-asks the bound question and turns the
|
|
846
|
+
* rejection into a directed message at the value's own span.
|
|
847
|
+
*/
|
|
848
|
+
private instantiateCallable;
|
|
849
|
+
private genericBoundViolation;
|
|
850
|
+
private concreteCallableFor;
|
|
851
|
+
/** One diagnostic per site, whichever of the two value paths reaches it first. */
|
|
852
|
+
private reportFirstClassBoundViolation;
|
|
853
|
+
private inferIntrinsicCall;
|
|
854
|
+
private inferRangeCall;
|
|
855
|
+
private inferEqualsCall;
|
|
856
|
+
/** The reason a type cannot participate in equals(a, b), or null when it is pure data. */
|
|
857
|
+
private equalsDomainViolation;
|
|
858
|
+
private inferCollectionCall;
|
|
859
|
+
private inferPrimitiveCall;
|
|
860
|
+
private planNamedArguments;
|
|
861
|
+
private inferMember;
|
|
862
|
+
/**
|
|
863
|
+
* A record shorthand names a binding. Reserved names have no binding to name,
|
|
864
|
+
* so `{computed}` and `{print}` used to reach past the author entirely and
|
|
865
|
+
* capture the runtime entry point. The shorthand is refused with the explicit
|
|
866
|
+
* spelling, which is the only way to mean either thing on purpose — and it
|
|
867
|
+
* puts the reserved names on the same footing as every softened word, whose
|
|
868
|
+
* shorthand now resolves to an ordinary binding.
|
|
869
|
+
*/
|
|
870
|
+
private checkShorthandReservedName;
|
|
871
|
+
private recordRuntimeObjectShape;
|
|
872
|
+
private listMember;
|
|
873
|
+
private stringMember;
|
|
874
|
+
private numberMember;
|
|
875
|
+
private collectionMemberError;
|
|
876
|
+
/**
|
|
877
|
+
* D38 §48: a retired collection member whose guidance names one successor
|
|
878
|
+
* member is a mechanical rename of the member name itself.
|
|
879
|
+
*/
|
|
880
|
+
private collectionMemberFix;
|
|
881
|
+
private isNullExclusionPredicate;
|
|
882
|
+
private mapMember;
|
|
883
|
+
private recordMember;
|
|
884
|
+
private setMember;
|
|
885
|
+
private inferredExpressionType;
|
|
886
|
+
private checkArguments;
|
|
887
|
+
private orderNamedArguments;
|
|
888
|
+
private callableWithInferredResult;
|
|
889
|
+
private updateInferredCallableResult;
|
|
890
|
+
private functionResultKey;
|
|
891
|
+
protected inferredFunctionResult(statement: Pick<FunctionDeclaration, "returnType" | "signatureSpan"> & {
|
|
892
|
+
readonly abstract?: boolean;
|
|
893
|
+
}): ValueType;
|
|
894
|
+
private inferCollectedFunctionResult;
|
|
895
|
+
private functionType;
|
|
896
|
+
private externFunctionType;
|
|
897
|
+
private externConstantType;
|
|
898
|
+
private externClassIdentity;
|
|
899
|
+
private resolveExternAnnotation;
|
|
900
|
+
private crossBlockExternClassType;
|
|
901
|
+
private resolveValidatedExternAnnotation;
|
|
902
|
+
private importType;
|
|
903
|
+
protected narrowingFor(expression: Expression, knownType?: ValueType): ReadonlyMap<string, ValueType>;
|
|
904
|
+
protected negativeNarrowingFor(expression: Expression, knownType?: ValueType): ReadonlyMap<string, ValueType>;
|
|
905
|
+
private conditionNarrowing;
|
|
906
|
+
/** What one element of a membership probe's container is, matching the `in` operand rules. */
|
|
907
|
+
private membershipElementType;
|
|
908
|
+
/** The concrete checked value behind `Kind.is(value)`, when Kind is a runtime validator. */
|
|
909
|
+
private validatorTargetOf;
|
|
910
|
+
private bareConditionNarrowing;
|
|
911
|
+
private excludeCheckedType;
|
|
912
|
+
private addLocationNarrowing;
|
|
913
|
+
private narrowableLocation;
|
|
914
|
+
private narrowEnumMember;
|
|
915
|
+
/**
|
|
916
|
+
* FLW-N7: the fact a boolean-literal comparison proves about its owner.
|
|
917
|
+
* A location already typed `bool` learns nothing, so no fact is recorded
|
|
918
|
+
* for it — a needless fact would only buy a runtime recheck on every later
|
|
919
|
+
* read.
|
|
920
|
+
*/
|
|
921
|
+
private narrowToBoolean;
|
|
922
|
+
private narrowDiscriminatedOwner;
|
|
923
|
+
private inferNarrowedExpression;
|
|
924
|
+
private withTemporaryNarrowings;
|
|
925
|
+
private optionalExecutionNarrowings;
|
|
926
|
+
private inferConditionWithNarrowings;
|
|
927
|
+
private combineNarrowings;
|
|
928
|
+
protected requireCondition(type: ValueType, condition: Expression): void;
|
|
929
|
+
/**
|
|
930
|
+
* FLW-S2: a getter is a computed value, not a stable location, so a check on
|
|
931
|
+
* one establishes no fact — the guard reads exactly like every other
|
|
932
|
+
* narrowing check and silently does nothing. Say so where it is written,
|
|
933
|
+
* and name the one spelling that works: bind the getter to a `const` and
|
|
934
|
+
* check that. Following `?.` instead would compute the getter twice.
|
|
935
|
+
*/
|
|
936
|
+
private checkGetterNarrowingTest;
|
|
937
|
+
/** The location a condition would narrow, for the forms that narrow one. */
|
|
938
|
+
private narrowingSubjectExpression;
|
|
939
|
+
/** The property name when an expression reads a getter rather than a stored field. */
|
|
940
|
+
private getterAccessProperty;
|
|
941
|
+
private conditionSubjectText;
|
|
942
|
+
protected requireAssignable(actual: ValueType, expected: ValueType, valueSpan: Span): void;
|
|
943
|
+
/**
|
|
944
|
+
* D44 rule 72's readonly view refuses exactly one shape of assignment: the
|
|
945
|
+
* value is the target type with readonly added. Component props arrive that
|
|
946
|
+
* way — the body of `component List(items: List<Item>)` sees a readonly
|
|
947
|
+
* projection — so the helper that would accept the value has a signature the
|
|
948
|
+
* author never wrote, and the diagnostic is the only place to hand it over.
|
|
949
|
+
* The return shape matters as much as the parameter: a List built from a
|
|
950
|
+
* readonly List carries readonly elements.
|
|
951
|
+
*/
|
|
952
|
+
private readonlyProjectionGuidance;
|
|
953
|
+
/**
|
|
954
|
+
* D64 rule 163: the async result annotation is spelled two ways in two
|
|
955
|
+
* positions, and both are right. A *declaration* annotates the resolved
|
|
956
|
+
* value — `async def load(id: string) -> string` — because the `async` is
|
|
957
|
+
* standing right there; VEL4018 refuses `-> Promise<T>` for that reason. A
|
|
958
|
+
* function *type* has no `async` on it and describes the value the call
|
|
959
|
+
* hands back, which is a Promise, so `-> Promise<T>` is the spelling there.
|
|
960
|
+
*
|
|
961
|
+
* An author who has just been taught VEL4018 therefore writes `-> string` in
|
|
962
|
+
* the type position and is refused for obeying it. Naming only the mismatch
|
|
963
|
+
* leaves that author with two diagnostics that contradict each other, so the
|
|
964
|
+
* refusal names the spelling the type position wants. The check is exact:
|
|
965
|
+
* the mismatch has to disappear when the result is wrapped, which is what
|
|
966
|
+
* makes the named spelling a fact rather than a guess.
|
|
967
|
+
*/
|
|
968
|
+
private asyncResultSpellingGuidance;
|
|
969
|
+
private collectionBridgeGuidance;
|
|
970
|
+
private freezeEscapedCollectionInference;
|
|
971
|
+
private contextuallyAssignable;
|
|
972
|
+
private contextualObjectType;
|
|
973
|
+
private contextualObjectDiscriminantsMatch;
|
|
974
|
+
private knownEnumSingleton;
|
|
975
|
+
private widenAggregateSingleton;
|
|
976
|
+
private contextualCollectionType;
|
|
977
|
+
private formReadField;
|
|
978
|
+
private jsonSerializable;
|
|
979
|
+
private isHttpFormBody;
|
|
980
|
+
private orderedTypeCategory;
|
|
981
|
+
private combineJsonStatuses;
|
|
982
|
+
private typeParameterFrame;
|
|
983
|
+
/** D41 item 61: the ordered bound vector of a declaration, for its callable type. */
|
|
984
|
+
private typeParameterBoundVector;
|
|
985
|
+
/**
|
|
986
|
+
* D41 item 61 risk 2: only the innermost frame is consulted. A nested `def`
|
|
987
|
+
* may not name an enclosing declaration's type parameter (VEL4021 rejects
|
|
988
|
+
* it), so one frame is the whole visible scope.
|
|
989
|
+
*/
|
|
990
|
+
boundOf(type: Extract<ValueType, {
|
|
991
|
+
kind: "parameter";
|
|
992
|
+
}>): TypeParameterBound | null;
|
|
993
|
+
/**
|
|
994
|
+
* The one decision procedure for "does this solved type argument satisfy
|
|
995
|
+
* this bound", shared by the call site and the first-class value path. Each
|
|
996
|
+
* bound reuses the predicate that already governs its capability.
|
|
997
|
+
*/
|
|
998
|
+
satisfiesBound(type: ValueType, bound: TypeParameterBound): boolean;
|
|
999
|
+
private withTypeParameterFrame;
|
|
1000
|
+
private enclosingTypeParameterName;
|
|
1001
|
+
private checkTypeParameterDeclarations;
|
|
1002
|
+
private isDeclaredTypeName;
|
|
1003
|
+
private rejectErasedRuntimeCheck;
|
|
1004
|
+
protected resolveAnnotation(reference: TypeReference | null): ValueType;
|
|
1005
|
+
protected resolveRawTypeReference(reference: TypeReference): ValueType;
|
|
1006
|
+
protected resolveValidatedAnnotation(reference: TypeReference | null): ValueType;
|
|
1007
|
+
protected resolveResult(reference: TypeReference | null): ValueType;
|
|
1008
|
+
protected resolveValidatedResult(reference: TypeReference | null): ValueType;
|
|
1009
|
+
private resolveNamedClasses;
|
|
1010
|
+
protected validateTypeReference(reference: TypeReference, resolve?: (reference: TypeReference) => ValueType): boolean;
|
|
1011
|
+
/**
|
|
1012
|
+
* The retired namespace whose module exports this bare name, when exactly one
|
|
1013
|
+
* does and no permanent namespace claims the same spelling. `min`, `max`, and
|
|
1014
|
+
* `clamp` are claimed by `Math.` as well, so those keep the guidance and lose
|
|
1015
|
+
* only the automatic rewrite — a fix has to be provably the author's meaning,
|
|
1016
|
+
* and there the meaning is genuinely ambiguous.
|
|
1017
|
+
*/
|
|
1018
|
+
private retiredNamespaceOwning;
|
|
1019
|
+
private recordMemberAccessProperty;
|
|
1020
|
+
/** The import line a migration writes, in the sorted shape every module here already uses. */
|
|
1021
|
+
private renderNamedImport;
|
|
1022
|
+
/** Where a module that has no import of `source` yet should grow one. */
|
|
1023
|
+
private importInsertion;
|
|
1024
|
+
private registerPermanentNamespaceImports;
|
|
1025
|
+
/**
|
|
1026
|
+
* D52 rule 114: the migration off a namespace prefix the language withdrew.
|
|
1027
|
+
* It is the mirror of the one below — that one takes an import away and puts
|
|
1028
|
+
* a prefix on, this one takes the prefix off and puts an import back — and
|
|
1029
|
+
* both answer in one step, because a migration that needs a second compile to
|
|
1030
|
+
* find the working spelling has taught a loop rather than a spelling.
|
|
1031
|
+
*/
|
|
1032
|
+
private reportRetiredNamespaceUses;
|
|
1033
|
+
/**
|
|
1034
|
+
* D52 rule 116 / D50 rule 90: a permanent namespace needs no import, so the
|
|
1035
|
+
* import spelling retires. The rewrite is the import's own inverse — take the
|
|
1036
|
+
* specifier out, put the prefix on every read it left behind — and it is
|
|
1037
|
+
* carried whole so the author never sees a half-migrated module.
|
|
1038
|
+
*/
|
|
1039
|
+
private reportPermanentNamespaceImports;
|
|
1040
|
+
/** A member name to show in the rule 106 guidance, so the fix is concrete. */
|
|
1041
|
+
private firstNamespaceMember;
|
|
1042
|
+
protected typeError(message: string, errorSpan: Span, fix?: DiagnosticFix): void;
|
|
1043
|
+
protected recoveredTypeError(message: string, errorSpan: Span, fix?: DiagnosticFix): void;
|
|
1044
|
+
private analyzeMatchPattern;
|
|
1045
|
+
private matchLocationNarrowing;
|
|
1046
|
+
private retargetNarrowings;
|
|
1047
|
+
private matchFallthroughType;
|
|
1048
|
+
private matchPatternCoversWholeType;
|
|
1049
|
+
private unwrapMatchAs;
|
|
1050
|
+
private matchPatternIsIrrefutable;
|
|
1051
|
+
private matchPatternCoversType;
|
|
1052
|
+
private addMatchBinding;
|
|
1053
|
+
private matchListCandidates;
|
|
1054
|
+
private matchObjectCandidates;
|
|
1055
|
+
private matchObjectField;
|
|
1056
|
+
private matchPatternMayMatchType;
|
|
1057
|
+
private matchObjectRestType;
|
|
1058
|
+
private narrowMatchType;
|
|
1059
|
+
private matchLiteralCompatible;
|
|
1060
|
+
private matchValueKey;
|
|
1061
|
+
private matchValueDisplay;
|
|
1062
|
+
private matchTypesOverlap;
|
|
1063
|
+
private runtimeTypeCheckMayExecute;
|
|
1064
|
+
private matchTypeFullyCovered;
|
|
1065
|
+
private enumMemberCoverageKey;
|
|
1066
|
+
/** ENM-I5: enum members reached through a type pattern (parenthesized singletons, unions of them) credit member coverage. */
|
|
1067
|
+
private creditEnumMemberCoverage;
|
|
1068
|
+
/** ENM-I6: the enum behind a match subject - bare or optional - that carries the exhaustiveness contract. */
|
|
1069
|
+
private enumMatchSubject;
|
|
1070
|
+
/** The class arms of a match subject: the type itself, or the class members of its optional/union spellings. */
|
|
1071
|
+
private classArmsOf;
|
|
1072
|
+
private blockAlwaysReturns;
|
|
1073
|
+
private statementAlwaysExitsBlock;
|
|
1074
|
+
private blockAlwaysExits;
|
|
1075
|
+
private builtin;
|
|
1076
|
+
private isFreshUnresolvedCollection;
|
|
1077
|
+
private joinCollectionInference;
|
|
1078
|
+
private createCollectionInference;
|
|
1079
|
+
private refineCollectionInference;
|
|
1080
|
+
private rebindCollectionInference;
|
|
1081
|
+
protected declareBinding(name: string, mutable: boolean, type: ValueType, declarationSpan: Span, internal?: boolean, declaredType?: ValueType, importSource?: string): void;
|
|
1082
|
+
private recordImportedBindingSource;
|
|
1083
|
+
private recordImportedBindingOrigin;
|
|
1084
|
+
private recordInitializationImportRead;
|
|
1085
|
+
/** True while analysis is directly in a declaration body rather than a function frame. */
|
|
1086
|
+
protected inComponentSetupPosition(): boolean;
|
|
1087
|
+
protected inModuleInitializationPosition(): boolean;
|
|
1088
|
+
/** Initialization-position reads of imported bindings, for the project module-cycle check. */
|
|
1089
|
+
moduleInitializationImportReads(): readonly InitializationImportRead[];
|
|
1090
|
+
private requireTextConvertible;
|
|
1091
|
+
private isTextConvertible;
|
|
1092
|
+
/**
|
|
1093
|
+
* The `TypeEnvironment` view of alias expansion. Assignability needs it to
|
|
1094
|
+
* decide the text-conversion parameter domain on the expanded shape, exactly
|
|
1095
|
+
* as the direct `str()` check does.
|
|
1096
|
+
*/
|
|
1097
|
+
expandTypeAliases(type: ValueType): ValueType;
|
|
1098
|
+
protected markDeclaredBindingReactive(name: string, kind?: "state" | "prop"): void;
|
|
1099
|
+
protected reactiveBindingKind(name: string): "state" | "prop" | null;
|
|
1100
|
+
private recordSemanticBinding;
|
|
1101
|
+
protected semanticMembersOf(original: ValueType): ReadonlyMap<string, ValueType>;
|
|
1102
|
+
private privateSemanticContext;
|
|
1103
|
+
private createSemanticMembersOf;
|
|
1104
|
+
/** The runtime surface of an enum object: its members plus is, parse, and values() (ENM-U1). */
|
|
1105
|
+
private enumRuntimeMember;
|
|
1106
|
+
private runtimeTypeObjectValue;
|
|
1107
|
+
private displayExternalClasses;
|
|
1108
|
+
protected prescanScopeDeclarations(statements: readonly Statement[]): void;
|
|
1109
|
+
private collectPatternNames;
|
|
1110
|
+
private checkShadowedRead;
|
|
1111
|
+
private declarePattern;
|
|
1112
|
+
private validateKnownBindingShape;
|
|
1113
|
+
protected lookup(name: string): Binding | null;
|
|
1114
|
+
protected isBuiltinValueReference(expression: Expression, name: PermanentNamespaceName | "range"): boolean;
|
|
1115
|
+
protected applyNarrowings(narrowed: ReadonlyMap<string, ValueType>, narrowingSpan: Span): void;
|
|
1116
|
+
private persistNarrowings;
|
|
1117
|
+
private assignedFactType;
|
|
1118
|
+
/**
|
|
1119
|
+
* A check that narrows a location installs a shadow of the binding in the
|
|
1120
|
+
* scope it entered, so nested checks leave one shadow per enclosing scope.
|
|
1121
|
+
* Clearing only the innermost shadow lets an outer scope keep a fact this
|
|
1122
|
+
* write just falsified — visible after a `while` whose condition narrows
|
|
1123
|
+
* the same name its body assigns, where the body's shadow is discarded with
|
|
1124
|
+
* the body scope and the loop's own shadow never learns of the write.
|
|
1125
|
+
*/
|
|
1126
|
+
private invalidateShadowedNarrowings;
|
|
1127
|
+
private establishAssignedFact;
|
|
1128
|
+
/** Rule 71 for member targets: establish after invalidation so the new fact survives its own write. */
|
|
1129
|
+
private establishAssignedMemberFact;
|
|
1130
|
+
/** Rule 71 for destructuring declarations: each binding learns its own initializer piece. */
|
|
1131
|
+
private establishAssignedPatternFacts;
|
|
1132
|
+
private stableMemberAccessPath;
|
|
1133
|
+
private stableOptionalMemberAccessPath;
|
|
1134
|
+
private stableDataMember;
|
|
1135
|
+
private discriminatedDataField;
|
|
1136
|
+
private dataFieldIsReadonly;
|
|
1137
|
+
private lookupMemberNarrowing;
|
|
1138
|
+
private lookupMemberNarrowingEntry;
|
|
1139
|
+
private invalidateAssignmentNarrowings;
|
|
1140
|
+
private invalidateMemberNarrowings;
|
|
1141
|
+
private invalidateMemberDescendantNarrowings;
|
|
1142
|
+
private invalidateMutableCollectionCallReceiver;
|
|
1143
|
+
private invalidateCurrentMemberNarrowings;
|
|
1144
|
+
private invalidateAliasableMemberNarrowings;
|
|
1145
|
+
/** The current type of the binding a member-narrowing path is rooted at, or null when it cannot be resolved. */
|
|
1146
|
+
private memberNarrowingRootType;
|
|
1147
|
+
private runtimeCheckedType;
|
|
1148
|
+
private matchPatternReflectionMayExecute;
|
|
1149
|
+
private snapshotFlowFacts;
|
|
1150
|
+
private restoreFlowFacts;
|
|
1151
|
+
private analyzeIsolatedFlow;
|
|
1152
|
+
private flowInvalidationsSince;
|
|
1153
|
+
private reanalyzeLoopBackEdge;
|
|
1154
|
+
private flowInvalidationsAffectFacts;
|
|
1155
|
+
private deduplicateDiagnostics;
|
|
1156
|
+
private clearCachedFlowTypes;
|
|
1157
|
+
private clearCachedFlowTypesInSpan;
|
|
1158
|
+
private flowSnapshotAfterInvalidations;
|
|
1159
|
+
private visibleBindings;
|
|
1160
|
+
private narrowingsForVisibleBindings;
|
|
1161
|
+
private narrowingsInSnapshot;
|
|
1162
|
+
private commonNarrowings;
|
|
1163
|
+
/**
|
|
1164
|
+
* FLW-S1: a `while` is left through the condition test taken either on
|
|
1165
|
+
* entry or after the back edge, so the fact that holds afterwards is the
|
|
1166
|
+
* union of what the two tests prove. A location only one of them names is
|
|
1167
|
+
* dropped, because the other test proves nothing about it.
|
|
1168
|
+
*/
|
|
1169
|
+
private joinedNarrowings;
|
|
1170
|
+
private applyFlowInvalidations;
|
|
1171
|
+
protected enterScope(): void;
|
|
1172
|
+
protected exitScope(): void;
|
|
1173
|
+
}
|
|
1174
|
+
export {};
|
|
1175
|
+
//# sourceMappingURL=analyzer.d.ts.map
|