@shapeshift-labs/frontier-lang-compiler 0.2.149 → 0.2.151
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/README.md +315 -9
- package/bench/real-repo-corpus-checkout-identity.mjs +134 -0
- package/bench/real-repo-corpus-checkout-proof.mjs +263 -0
- package/bench/real-repo-corpus-command-execution.mjs +314 -0
- package/bench/real-repo-corpus-evidence.mjs +165 -0
- package/bench/real-repo-corpus-suite.mjs +273 -0
- package/bench/smoke.mjs +109 -7
- package/dist/declarations/import-adapter-core.d.ts +4 -3
- package/dist/declarations/import-adapter-options-native.d.ts +21 -0
- package/dist/declarations/js-ts-project-merge-admission-routes.d.ts +35 -0
- package/dist/declarations/js-ts-project-merge-commonjs-interop.d.ts +29 -0
- package/dist/declarations/js-ts-project-merge-confidence.d.ts +64 -0
- package/dist/declarations/js-ts-project-merge-declaration-emit-parity.d.ts +37 -0
- package/dist/declarations/js-ts-project-merge-declarations.d.ts +65 -0
- package/dist/declarations/js-ts-project-merge-diagnostics.d.ts +97 -0
- package/dist/declarations/js-ts-project-merge-global-augmentation.d.ts +30 -0
- package/dist/declarations/js-ts-project-merge-jsx-render-branch.d.ts +48 -0
- package/dist/declarations/js-ts-project-merge-proof-levels.d.ts +109 -0
- package/dist/declarations/js-ts-project-merge-quality-gates.d.ts +38 -0
- package/dist/declarations/js-ts-project-merge-semantic-equivalence-proof.d.ts +45 -0
- package/dist/declarations/js-ts-project-merge-tsconfig.d.ts +43 -0
- package/dist/declarations/js-ts-safe-merge.d.ts +47 -0
- package/dist/declarations/js-ts-safe-project-merge.d.ts +120 -38
- package/dist/declarations/native-project-compiler-assignability-oracle.d.ts +41 -0
- package/dist/declarations/native-project-compiler-callable-signatures.d.ts +31 -0
- package/dist/declarations/native-project-compiler-class-member-runtime-proof.d.ts +87 -0
- package/dist/declarations/native-project-compiler-composite-types.d.ts +23 -0
- package/dist/declarations/native-project-compiler-enum-proof.d.ts +58 -0
- package/dist/declarations/native-project-compiler-index-signature.d.ts +7 -0
- package/dist/declarations/native-project-compiler-public-api-source-binding.d.ts +8 -0
- package/dist/declarations/native-project-compiler-scope.d.ts +37 -0
- package/dist/declarations/native-project-compiler-type-reference-targets.d.ts +38 -0
- package/dist/declarations/native-project-css-modules.d.ts +90 -0
- package/dist/declarations/native-project-decorator-metadata.d.ts +126 -0
- package/dist/declarations/native-project-jsx-graph.d.ts +313 -0
- package/dist/declarations/native-project-module-declarations.d.ts +52 -0
- package/dist/declarations/native-project-module-resolution.d.ts +76 -1
- package/dist/declarations/native-project-runtime-effect-target.d.ts +29 -0
- package/dist/declarations/native-project-runtime-executable-effect-evidence.d.ts +107 -0
- package/dist/declarations/native-project-runtime-mutation-target.d.ts +33 -0
- package/dist/declarations/native-project-runtime-promise-chain.d.ts +30 -0
- package/dist/declarations/native-project-runtime-promise-combinator.d.ts +22 -0
- package/dist/declarations/native-project-runtime-reachability.d.ts +30 -0
- package/dist/declarations/native-project-runtime-resource-management.d.ts +27 -0
- package/dist/declarations/native-project-runtime-yield-delegation.d.ts +10 -0
- package/dist/declarations/native-project-scope-template-reference.d.ts +13 -0
- package/dist/declarations/native-project-source-evidence.d.ts +8 -0
- package/dist/declarations/native-project.d.ts +40 -39
- package/dist/declarations/semantic-edit-script.d.ts +10 -8
- package/dist/declarations/semantic-graph-layers.d.ts +79 -0
- package/dist/declarations/semantic-patch-bundle-composition.d.ts +62 -0
- package/dist/declarations/semantic-sidecar.d.ts +3 -2
- package/dist/declarations/semantic-structural-diff.d.ts +94 -0
- package/dist/declarations/source-preservation.d.ts +32 -1
- package/dist/declarations/target-adapters.d.ts +22 -2
- package/dist/index.d.ts +32 -0
- package/dist/index.js +6 -0
- package/dist/internal/index-impl/compileNativeSource.js +53 -5
- package/dist/internal/index-impl/createLightweightNativeImport.js +58 -4
- package/dist/internal/index-impl/createNativeImportFromSyntaxAst.js +17 -1
- package/dist/internal/index-impl/createNativeImportFromTypeScriptAst.js +28 -4
- package/dist/internal/index-impl/createNativeProjectImportResult.js +31 -27
- package/dist/internal/index-impl/createNativeProjectModuleResolutionFromPackageManifests.js +145 -0
- package/dist/internal/index-impl/createNativeSourcePreservation.js +34 -7
- package/dist/internal/index-impl/createSemanticImportSidecar.js +27 -1
- package/dist/internal/index-impl/createTypeScriptCompilerNativeImporterAdapter.js +16 -5
- package/dist/internal/index-impl/dynamicImportExpressionMetadata.js +80 -0
- package/dist/internal/index-impl/importMetaUrlDependencyMetadata.js +176 -0
- package/dist/internal/index-impl/importNativeSource.js +2 -3
- package/dist/internal/index-impl/moduleImportAttributeMetadata.js +232 -0
- package/dist/internal/index-impl/projectSemanticEditScriptToSource.js +8 -1
- package/dist/internal/index-impl/projectSymbolGraphClassStaticBlocks.js +148 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerAdvancedTypeMetadata.js +45 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerCallableSignatureEquivalence.js +107 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerClassPrivateAccessorRuntimeProof.js +280 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerClassShapeEquivalence.js +103 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerConditionalTypeEquivalence.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerDecoratorRuntimeProof.js +197 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerEnumEquivalence.js +188 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerFacts.js +244 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerIndexSignatureEquivalence.js +58 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerMetadata.js +168 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalence.js +199 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeEquivalenceProof.js +204 -0
- package/dist/internal/index-impl/projectSymbolGraphCompilerTypeReferenceTargetEquivalence.js +99 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleRecords.js +264 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleScanners.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModuleUtils.js +152 -0
- package/dist/internal/index-impl/projectSymbolGraphCssModules.js +82 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentImports.js +170 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentProviderLookup.js +167 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxComponentWrappers.js +150 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxContextTargets.js +71 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxContextValues.js +212 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxEventHandlers.js +172 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxHookEffects.js +124 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxHooks.js +281 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxMemberComponents.js +139 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxPropFlows.js +320 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxPropValues.js +145 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxProviderFlows.js +133 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRecords.js +315 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderCollections.js +155 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderReturns.js +291 -0
- package/dist/internal/index-impl/projectSymbolGraphJsxRenderRisk.js +279 -0
- package/dist/internal/index-impl/projectSymbolGraphModuleDeclarationShapes.js +138 -0
- package/dist/internal/index-impl/projectSymbolGraphModuleResolution.js +89 -87
- package/dist/internal/index-impl/projectSymbolGraphPackageConditions.js +314 -0
- package/dist/internal/index-impl/projectSymbolGraphReExportImportTargets.js +43 -0
- package/dist/internal/index-impl/projectSymbolGraphReExports.js +55 -1
- package/dist/internal/index-impl/projectSymbolGraphRuntimeRegions.js +108 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefAliases.js +307 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefLexical.js +320 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefOwners.js +50 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecordBuilders.js +112 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefRecords.js +238 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructural.js +104 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefStructuralNormalize.js +242 -0
- package/dist/internal/index-impl/projectSymbolGraphScopeUseDefUseHashes.js +107 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceMapGeneratedBoundary.js +111 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceRecords.js +268 -0
- package/dist/internal/index-impl/projectSymbolGraphSourceRecordsOwnership.js +309 -0
- package/dist/internal/index-impl/replaySemanticEditProjection.js +53 -39
- package/dist/internal/index-impl/runtimeOrderEvidenceBinding.js +151 -0
- package/dist/internal/index-impl/runtimeOrderProofSurfaces.js +253 -0
- package/dist/internal/index-impl/semanticEditCallsiteArgumentMerge.js +319 -0
- package/dist/internal/index-impl/semanticEditExplicitSourceReplacement.js +7 -2
- package/dist/internal/index-impl/semanticEditProjectionRecord.js +8 -0
- package/dist/internal/index-impl/semanticEditReplayDiagnostics.js +7 -2
- package/dist/internal/index-impl/semanticEditReplayOutputBinding.js +61 -0
- package/dist/internal/index-impl/semanticEditReplayRerunRoute.js +27 -0
- package/dist/internal/index-impl/semanticEditReplaySourceReplacement.js +6 -1
- package/dist/internal/index-impl/semanticEditRuntimeOrderReasons.js +320 -0
- package/dist/internal/index-impl/semanticEditScriptClassification.js +90 -5
- package/dist/internal/index-impl/semanticEditScripts.js +42 -5
- package/dist/internal/index-impl/semanticEditTypeSyntaxReasons.js +134 -0
- package/dist/internal/index-impl/semanticIndexFromNativeDeclarations.js +11 -5
- package/dist/internal/index-impl/semanticPatchBundleComposition.js +166 -0
- package/dist/internal/index-impl/semanticStructuralDiffRecords.js +150 -0
- package/dist/internal/index-impl/sourceMapGeneratedBoundaryGate.js +185 -0
- package/dist/internal/index-impl/staticMemberLiteral.js +31 -0
- package/dist/internal/index-impl/staticOptionalMemberReference.js +22 -0
- package/dist/internal/index-impl/syntaxAstSourcePreservation.js +273 -0
- package/dist/internal/index-impl/syntaxCommonJsModuleDeclarationEntries.js +297 -0
- package/dist/internal/index-impl/syntaxModuleDeclarationEntries.js +56 -132
- package/dist/internal/index-impl/syntaxModuleEntryRecords.js +160 -0
- package/dist/internal/index-impl/typeScriptCompilerAdvancedTypeShapes.js +160 -0
- package/dist/internal/index-impl/typeScriptCompilerAssignabilityOracle.js +97 -0
- package/dist/internal/index-impl/typeScriptCompilerClassApi.js +238 -0
- package/dist/internal/index-impl/typeScriptCompilerDecoratorMetadata.js +290 -0
- package/dist/internal/index-impl/typeScriptCompilerEnumShape.js +279 -0
- package/dist/internal/index-impl/typeScriptCompilerFacts.js +294 -0
- package/dist/internal/index-impl/typeScriptCompilerInferenceSyntax.js +170 -0
- package/dist/internal/index-impl/typeScriptCompilerReferenceGraph.js +186 -0
- package/dist/internal/index-impl/typeScriptCompilerSymbolIdentity.js +294 -0
- package/dist/internal/index-impl/typeScriptCompilerTypeReferenceTargets.js +142 -0
- package/dist/internal/index-impl/typeScriptDeclaration.js +10 -38
- package/dist/internal/index-impl/typeScriptModuleDeclarationEntries.js +52 -15
- package/dist/internal/index-impl/typeScriptSourceFilePreservation.js +296 -0
- package/dist/js-ts-safe-member-class-invariants.js +247 -0
- package/dist/js-ts-safe-member-merge-result.js +23 -3
- package/dist/js-ts-safe-member-merge.js +28 -4
- package/dist/js-ts-safe-merge-binding-patterns.js +170 -0
- package/dist/js-ts-safe-merge-context.js +1 -0
- package/dist/js-ts-safe-merge-jsx-attribute-fallback.js +314 -0
- package/dist/js-ts-safe-merge-jsx-attribute-parser.js +277 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-fallback.js +161 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-merge.js +319 -0
- package/dist/js-ts-safe-merge-jsx-child-expression-parser.js +300 -0
- package/dist/js-ts-safe-merge-parse-declarations.js +46 -2
- package/dist/js-ts-safe-merge-parse-statements.js +8 -0
- package/dist/js-ts-safe-merge-plan.js +3 -1
- package/dist/js-ts-safe-merge-semantic-edit-fallback.js +49 -0
- package/dist/js-ts-safe-merge-source-shape-fallbacks.js +5 -1
- package/dist/js-ts-safe-merge-top-level-rename-fallback.js +31 -5
- package/dist/js-ts-safe-merge-top-level-rename-result.js +7 -2
- package/dist/js-ts-safe-merge-variable-declarator-fallback.js +124 -6
- package/dist/js-ts-safe-merge-variable-declarator-parser.js +34 -4
- package/dist/js-ts-safe-merge.js +136 -0
- package/dist/js-ts-safe-project-merge-admission-routes.js +216 -0
- package/dist/js-ts-safe-project-merge-admission.js +161 -0
- package/dist/js-ts-safe-project-merge-ambient.js +110 -0
- package/dist/js-ts-safe-project-merge-core.js +85 -0
- package/dist/js-ts-safe-project-merge-css-module-conflicts.js +60 -0
- package/dist/js-ts-safe-project-merge-declaration-emit-parity.js +186 -0
- package/dist/js-ts-safe-project-merge-declarations.js +227 -0
- package/dist/js-ts-safe-project-merge-diagnostics-metadata.js +42 -0
- package/dist/js-ts-safe-project-merge-diagnostics-ts.js +73 -0
- package/dist/js-ts-safe-project-merge-diagnostics.js +283 -0
- package/dist/js-ts-safe-project-merge-evidence-routing.js +38 -0
- package/dist/js-ts-safe-project-merge-files.js +70 -0
- package/dist/js-ts-safe-project-merge-global-augmentation-compatibility.js +99 -0
- package/dist/js-ts-safe-project-merge-graph-conflicts.js +90 -2
- package/dist/js-ts-safe-project-merge-graph-delta-commonjs-interop.js +108 -0
- package/dist/js-ts-safe-project-merge-graph-delta-compiler-conflicts.js +179 -0
- package/dist/js-ts-safe-project-merge-graph-delta-compiler-details.js +189 -0
- package/dist/js-ts-safe-project-merge-graph-delta-conflicts.js +51 -184
- package/dist/js-ts-safe-project-merge-graph-delta-identity-conflicts.js +202 -0
- package/dist/js-ts-safe-project-merge-graph-delta-inference-syntax.js +80 -0
- package/dist/js-ts-safe-project-merge-graph-delta-module-declarations.js +155 -0
- package/dist/js-ts-safe-project-merge-graph-limits.js +16 -1
- package/dist/js-ts-safe-project-merge-graph.js +37 -5
- package/dist/js-ts-safe-project-merge-import-removal.js +292 -0
- package/dist/js-ts-safe-project-merge-jsx-graph-conflict-details.js +235 -0
- package/dist/js-ts-safe-project-merge-jsx-graph-conflicts.js +173 -0
- package/dist/js-ts-safe-project-merge-jsx-prop-contracts.js +86 -0
- package/dist/js-ts-safe-project-merge-jsx-render-branch-proof.js +189 -0
- package/dist/js-ts-safe-project-merge-missing-evidence.js +310 -0
- package/dist/js-ts-safe-project-merge-move-rename.js +209 -0
- package/dist/js-ts-safe-project-merge-proof-conflicts.js +44 -0
- package/dist/js-ts-safe-project-merge-proof-levels.js +320 -0
- package/dist/js-ts-safe-project-merge-quality-gates.js +140 -0
- package/dist/js-ts-safe-project-merge-routing-calibration.js +125 -0
- package/dist/js-ts-safe-project-merge-runtime-region-conflicts.js +156 -0
- package/dist/js-ts-safe-project-merge-scope-use-def-conflicts.js +292 -0
- package/dist/js-ts-safe-project-merge-semantic-equivalence-proof.js +175 -0
- package/dist/js-ts-safe-project-merge-semantic-replay-proof.js +311 -0
- package/dist/js-ts-safe-project-merge-semantic-replay-routes.js +179 -0
- package/dist/js-ts-safe-project-merge-source-span-conflicts.js +310 -0
- package/dist/js-ts-safe-project-merge-source-span-roundtrip-proof.js +172 -0
- package/dist/js-ts-safe-project-merge-split-merge-admission.js +96 -0
- package/dist/js-ts-safe-project-merge-split-merge-records.js +320 -0
- package/dist/js-ts-safe-project-merge-split-merge-shapes.js +234 -0
- package/dist/js-ts-safe-project-merge-split-merge.js +218 -0
- package/dist/js-ts-safe-project-merge-summary.js +320 -0
- package/dist/js-ts-safe-project-merge-symbol-move-admission.js +63 -0
- package/dist/js-ts-safe-project-merge-symbol-move-default-admission.js +143 -0
- package/dist/js-ts-safe-project-merge-symbol-move-risks.js +213 -0
- package/dist/js-ts-safe-project-merge-symbol-move.js +316 -0
- package/dist/js-ts-safe-project-merge-symbol-rename-admission.js +59 -0
- package/dist/js-ts-safe-project-merge-symbol-rename-default-admission.js +111 -0
- package/dist/js-ts-safe-project-merge-symbol-rename.js +319 -0
- package/dist/js-ts-safe-project-merge-ts-options.js +205 -0
- package/dist/js-ts-safe-project-merge-ts-program.js +268 -0
- package/dist/js-ts-safe-project-merge-typed-property-rename-rebase-utils.js +69 -0
- package/dist/js-ts-safe-project-merge-typed-property-rename-rebase.js +317 -0
- package/dist/js-ts-safe-project-merge-unsupported-surfaces.js +319 -0
- package/dist/js-ts-safe-project-merge.js +171 -172
- package/dist/js-ts-semantic-scope-use-def-bindings.js +287 -0
- package/dist/js-ts-semantic-scope-use-def-scan.js +241 -0
- package/dist/js-ts-semantic-scope-use-def-utils.js +132 -0
- package/dist/js-ts-semantic-scope-use-def.js +217 -0
- package/dist/lightweight-dependency-effects.js +28 -4
- package/dist/lightweight-dependency-relations.js +13 -7
- package/dist/lightweight-dependency-top-level.js +63 -0
- package/dist/native-import-language-profiles.js +27 -1
- package/dist/native-js-ts-importers.js +9 -5
- package/dist/native-parser-ast-format-profiles.js +12 -0
- package/dist/native-parser-html-css-format-profiles.js +85 -0
- package/dist/native-region-scanner-core.js +5 -3
- package/dist/native-region-scanner-js-commonjs.js +155 -0
- package/dist/native-region-scanner-js-imports.js +51 -13
- package/dist/native-region-scanner-js-reexports.js +79 -0
- package/dist/native-region-scanner-js-ts-helpers.js +23 -0
- package/dist/native-source-ledger-helpers.js +1 -1
- package/dist/native-source-ledger.js +24 -10
- package/dist/native-source-maps-ecma426.js +316 -0
- package/dist/native-source-maps.js +36 -6
- package/dist/native-source-preservation-ownership.js +292 -0
- package/dist/native-source-preservation-scanner.js +63 -25
- package/dist/native-source-preservation-types.d.ts +3 -0
- package/dist/semantic-import-effect-occurrences.js +242 -0
- package/dist/semantic-import-effect-regions.js +95 -58
- package/dist/semantic-import-graph-layers.js +224 -0
- package/dist/semantic-import-runtime-conditional-evidence.js +135 -0
- package/dist/semantic-import-runtime-effect-target-evidence.js +145 -0
- package/dist/semantic-import-runtime-exit-evidence.js +32 -0
- package/dist/semantic-import-runtime-import-meta-evidence.js +33 -0
- package/dist/semantic-import-runtime-mutation-evidence.js +155 -0
- package/dist/semantic-import-runtime-order-evidence.js +318 -0
- package/dist/semantic-import-runtime-promise-chain-evidence.js +103 -0
- package/dist/semantic-import-runtime-promise-combinator-evidence.js +166 -0
- package/dist/semantic-import-runtime-reachability-evidence.js +269 -0
- package/dist/semantic-import-runtime-resource-management-evidence.js +293 -0
- package/dist/semantic-import-runtime-switch-evidence.js +304 -0
- package/dist/semantic-import-runtime-throw-evidence.js +44 -0
- package/dist/semantic-import-runtime-try-finally-evidence.js +172 -0
- package/dist/semantic-import-sidecar-entry.js +4 -0
- package/dist/semantic-import-source-preservation.js +6 -2
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
|
+
|
|
3
|
+
const IndexSignatureTypeEquivalenceProofKind = 'typescript-checker-public-api-index-signature-equivalence';
|
|
4
|
+
|
|
5
|
+
function indexSignatureSetHash(value, counts) {
|
|
6
|
+
return counts.indexSignatureCount > 0 ? hashSemanticValue({ kind: 'frontier.lang.typescript.compilerPublicIndexSignatureSetEquivalence.v1', indexSignatures: arrayValue(value.indexSignatures) }) : undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function indexSignatureProofKind(counts) { return counts.indexSignatureCount > 0 ? IndexSignatureTypeEquivalenceProofKind : undefined; }
|
|
10
|
+
function indexSignatureUnsupportedReasonCodes(counts) { return counts.indexSignatureCount > 0 ? ['typescript-public-index-signature-equivalence-unproven'] : []; }
|
|
11
|
+
function indexSignatureProofLevel(counts) { return counts.indexSignatureCount > 0 ? 'index-signature-set' : undefined; }
|
|
12
|
+
function indexSignatureCheckerInvariant(counts) { return counts.indexSignatureCount > 0 ? 'index signature key/value/modifiers complete' : undefined; }
|
|
13
|
+
function indexSignatureRequiredSignals(counts) {
|
|
14
|
+
return counts.indexSignatureCount > 0 ? [
|
|
15
|
+
'compiler-index-signature-count',
|
|
16
|
+
'compiler-index-signature-key-type-texts',
|
|
17
|
+
'compiler-index-signature-value-type-texts',
|
|
18
|
+
'compiler-index-signature-readonly'
|
|
19
|
+
] : [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function missingIndexSignatureEquivalenceSignals(_value, counts, checkerEvidence) {
|
|
23
|
+
const missing = [];
|
|
24
|
+
if (counts.indexSignatureCount > 0 && checkerEvidence.indexSignatureKeyTypeTexts.length !== counts.indexSignatureCount) missing.push('compiler-index-signature-count');
|
|
25
|
+
if (counts.indexSignatureCount > 0 && (checkerEvidence.indexSignatureKeyTypeTexts.length !== counts.indexSignatureCount || checkerEvidence.indexSignatureKeyTypeTexts.some((text) => !text))) missing.push('compiler-index-signature-key-type-texts');
|
|
26
|
+
if (counts.indexSignatureCount > 0 && (checkerEvidence.indexSignatureValueTypeTexts.length !== counts.indexSignatureCount || checkerEvidence.indexSignatureValueTypeTexts.some((text) => !text))) missing.push('compiler-index-signature-value-type-texts');
|
|
27
|
+
if (counts.indexSignatureCount > 0 && !compilerBooleanSignalsCovered(checkerEvidence.indexSignatureReadonly, counts.indexSignatureCount)) missing.push('compiler-index-signature-readonly');
|
|
28
|
+
return missing;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function indexSignatureCheckerEvidence(value, counts) {
|
|
32
|
+
const indexSignatures = arrayValue(value.indexSignatures);
|
|
33
|
+
return compactRecord({
|
|
34
|
+
indexSignatureCount: counts.indexSignatureCount || undefined,
|
|
35
|
+
indexSignatureReadonlyCount: counts.indexSignatureReadonlyCount || undefined,
|
|
36
|
+
indexSignatureKeyTypeTexts: indexSignatures.map((signature) => signature.keyTypeText),
|
|
37
|
+
indexSignatureValueTypeTexts: indexSignatures.map((signature) => signature.valueTypeText),
|
|
38
|
+
indexSignatureReadonly: indexSignatures.map((signature) => signature.readonly),
|
|
39
|
+
indexSignatureDeclarationTexts: indexSignatures.map((signature) => signature.declarationText),
|
|
40
|
+
indexSignatures: nonEmptyArray(indexSignatures)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function compilerBooleanSignalsCovered(values, count) { return Array.isArray(values) && values.length === count && values.every((value) => typeof value === 'boolean'); }
|
|
45
|
+
function arrayValue(value) { return Array.isArray(value) ? value : []; }
|
|
46
|
+
function nonEmptyArray(value) { return Array.isArray(value) && value.length ? value : undefined; }
|
|
47
|
+
function compactRecord(record) { return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined)); }
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
indexSignatureCheckerEvidence,
|
|
51
|
+
indexSignatureCheckerInvariant,
|
|
52
|
+
indexSignatureProofKind,
|
|
53
|
+
indexSignatureProofLevel,
|
|
54
|
+
indexSignatureRequiredSignals,
|
|
55
|
+
indexSignatureSetHash,
|
|
56
|
+
indexSignatureUnsupportedReasonCodes,
|
|
57
|
+
missingIndexSignatureEquivalenceSignals
|
|
58
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
function compilerClassMemberShapeMetadata(value, source = {}) {
|
|
2
|
+
const privateClassMembers = arrayValue(value.privateClassMembers);
|
|
3
|
+
const accessorFieldMembers = arrayValue(value.accessorFieldMembers);
|
|
4
|
+
const counts = {
|
|
5
|
+
privateClassMemberCount: numberValue(value.privateClassMemberCount) ?? privateClassMembers.length,
|
|
6
|
+
accessorFieldCount: numberValue(value.accessorFieldCount) ?? accessorFieldMembers.length
|
|
7
|
+
};
|
|
8
|
+
const runtimeProof = classPrivateAccessorRuntimeProjection(value, counts, source);
|
|
9
|
+
return {
|
|
10
|
+
counts,
|
|
11
|
+
record: compactRecord({
|
|
12
|
+
privateClassMemberCount: counts.privateClassMemberCount || undefined,
|
|
13
|
+
privateClassMemberShapeHash: value.privateClassMemberShapeHash,
|
|
14
|
+
privateClassMembers: nonEmptyArray(privateClassMembers),
|
|
15
|
+
accessorFieldCount: counts.accessorFieldCount || undefined,
|
|
16
|
+
accessorFieldShapeHash: value.accessorFieldShapeHash,
|
|
17
|
+
accessorFieldMembers: nonEmptyArray(accessorFieldMembers),
|
|
18
|
+
classMemberShapeProof: value.classMemberShapeProof,
|
|
19
|
+
...runtimeProof.record
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function compilerAssignabilityOracleMetadata(value) {
|
|
25
|
+
const record = objectRecord(value.assignabilityOracle);
|
|
26
|
+
const directions = arrayValue(record?.directions);
|
|
27
|
+
const counts = {
|
|
28
|
+
assignabilityOracleCount: record ? 1 : 0,
|
|
29
|
+
assignabilityOracleDirectionCount: numberValue(value.assignabilityOracleDirectionCount) ?? directions.length
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
counts,
|
|
33
|
+
record: compactRecord({
|
|
34
|
+
assignabilityOracleCount: counts.assignabilityOracleCount || undefined,
|
|
35
|
+
assignabilityOracleDirectionCount: counts.assignabilityOracleDirectionCount || undefined,
|
|
36
|
+
assignabilityOracleHash: value.assignabilityOracleHash,
|
|
37
|
+
assignabilityOracle: record
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function compilerDecoratorMetadata(value, source = {}) {
|
|
43
|
+
const records = arrayValue(value.decoratorMetadata);
|
|
44
|
+
const counts = {
|
|
45
|
+
decoratorMetadataCount: numberValue(value.decoratorMetadataCount) ?? records.length,
|
|
46
|
+
classDecoratorCount: numberValue(value.classDecoratorCount) ?? countKind(records, 'class-decorator'),
|
|
47
|
+
memberDecoratorCount: numberValue(value.memberDecoratorCount) ?? countKind(records, 'member-decorator'),
|
|
48
|
+
parameterDecoratorCount: numberValue(value.parameterDecoratorCount) ?? countKind(records, 'parameter-decorator')
|
|
49
|
+
};
|
|
50
|
+
const runtimeExecution = decoratorRuntimeExecutionProjection(value, counts, source);
|
|
51
|
+
return {
|
|
52
|
+
counts,
|
|
53
|
+
record: compactRecord({
|
|
54
|
+
decoratorMetadataCount: counts.decoratorMetadataCount || undefined,
|
|
55
|
+
classDecoratorCount: counts.classDecoratorCount || undefined,
|
|
56
|
+
memberDecoratorCount: counts.memberDecoratorCount || undefined,
|
|
57
|
+
parameterDecoratorCount: counts.parameterDecoratorCount || undefined,
|
|
58
|
+
decoratorMetadataHash: value.decoratorMetadataHash,
|
|
59
|
+
decoratorMetadataProof: value.decoratorMetadataProof,
|
|
60
|
+
...runtimeExecution.record,
|
|
61
|
+
decoratorMetadata: nonEmptyArray(records)
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function compilerEnumShapeMetadata(value) {
|
|
67
|
+
const enumMembers = arrayValue(value.enumMembers);
|
|
68
|
+
const counts = {
|
|
69
|
+
enumMemberCount: numberValue(value.enumMemberCount) ?? enumMembers.length,
|
|
70
|
+
enumNumericMemberCount: numberValue(value.enumNumericMemberCount) ?? countKind(enumMembers, 'number', 'valueKind'),
|
|
71
|
+
enumStringMemberCount: numberValue(value.enumStringMemberCount) ?? countKind(enumMembers, 'string', 'valueKind'),
|
|
72
|
+
enumAutoMemberCount: numberValue(value.enumAutoMemberCount) ?? enumMembers.filter((member) => member?.auto === true).length,
|
|
73
|
+
enumComputedMemberCount: numberValue(value.enumComputedMemberCount) ?? enumMembers.filter((member) => member?.computed === true).length
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
counts,
|
|
77
|
+
record: compactRecord({
|
|
78
|
+
enumKind: value.enumKind,
|
|
79
|
+
constEnum: value.constEnum,
|
|
80
|
+
declareEnum: value.declareEnum,
|
|
81
|
+
enumDeclarationCount: value.enumDeclarationCount,
|
|
82
|
+
enumMemberCount: counts.enumMemberCount || undefined,
|
|
83
|
+
enumNumericMemberCount: counts.enumNumericMemberCount || undefined,
|
|
84
|
+
enumStringMemberCount: counts.enumStringMemberCount || undefined,
|
|
85
|
+
enumAutoMemberCount: counts.enumAutoMemberCount || undefined,
|
|
86
|
+
enumComputedMemberCount: counts.enumComputedMemberCount || undefined,
|
|
87
|
+
enumRuntimeShapeHash: value.enumRuntimeShapeHash,
|
|
88
|
+
enumEmittedRuntimeShapeHash: value.enumEmittedRuntimeShapeHash,
|
|
89
|
+
enumRuntimeShapeProof: value.enumRuntimeShapeProof,
|
|
90
|
+
computedEnumRuntimeValueProof: value.computedEnumRuntimeValueProof,
|
|
91
|
+
enumMembers: nonEmptyArray(enumMembers)
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function compilerTypeInferenceSyntaxMetadata(value, source = {}) {
|
|
97
|
+
const records = arrayValue(value.typeInferenceSyntax);
|
|
98
|
+
const counts = {
|
|
99
|
+
typeInferenceSyntaxCount: numberValue(value.typeInferenceSyntaxCount) ?? records.length,
|
|
100
|
+
satisfiesExpressionCount: numberValue(value.satisfiesExpressionCount) ?? countKind(records, 'satisfies-expression'),
|
|
101
|
+
asConstAssertionCount: numberValue(value.asConstAssertionCount) ?? countKind(records, 'as-const-assertion'),
|
|
102
|
+
constTypeParameterCount: numberValue(value.constTypeParameterCount) ?? countKind(records, 'const-type-parameter')
|
|
103
|
+
};
|
|
104
|
+
const proof = compilerTypeInferenceSyntaxProof(value, counts, source);
|
|
105
|
+
return {
|
|
106
|
+
counts,
|
|
107
|
+
record: compactRecord({
|
|
108
|
+
typeInferenceSyntaxCount: counts.typeInferenceSyntaxCount || undefined,
|
|
109
|
+
typeInferenceSyntaxKinds: value.typeInferenceSyntaxKinds ?? nonEmptyArray(uniqueStrings(records.map((record) => record.kind))),
|
|
110
|
+
satisfiesExpressionCount: counts.satisfiesExpressionCount || undefined,
|
|
111
|
+
asConstAssertionCount: counts.asConstAssertionCount || undefined,
|
|
112
|
+
constTypeParameterCount: counts.constTypeParameterCount || undefined,
|
|
113
|
+
typeInferenceSyntaxHash: value.typeInferenceSyntaxHash,
|
|
114
|
+
typeInferenceSyntaxProof: proof,
|
|
115
|
+
typeInferenceSyntax: nonEmptyArray(records)
|
|
116
|
+
})
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function compilerTypeInferenceSyntaxProof(value, counts, source = {}) {
|
|
121
|
+
const proof = objectRecord(value.typeInferenceSyntaxProof);
|
|
122
|
+
if (!proof || counts.typeInferenceSyntaxCount <= 0) return proof;
|
|
123
|
+
const reasonCodes = [];
|
|
124
|
+
const missingSignals = [];
|
|
125
|
+
if (proof.status !== 'passed') reasonCodes.push('typescript-type-inference-syntax-proof-status-not-passed');
|
|
126
|
+
if (proof.kind !== 'typescript-checker-public-api-type-inference-syntax-evidence') reasonCodes.push('typescript-type-inference-syntax-proof-kind-missing');
|
|
127
|
+
if (proof.typeInferenceSyntaxHash !== value.typeInferenceSyntaxHash) reasonCodes.push('typescript-type-inference-syntax-proof-hash-mismatch');
|
|
128
|
+
if (proof.autoMergeClaim !== false || proof.semanticEquivalenceClaim !== false) reasonCodes.push('typescript-type-inference-syntax-proof-claim-flags-missing');
|
|
129
|
+
if (source.publicContract === true && !source.sourcePath) missingSignals.push('compiler-public-api-source-path');
|
|
130
|
+
if (source.publicContract === true && !source.sourceHash) missingSignals.push('compiler-public-api-source-hash');
|
|
131
|
+
if (proof.sourcePath !== undefined && proof.sourcePath !== source.sourcePath) reasonCodes.push('typescript-type-inference-syntax-proof-source-path-mismatch');
|
|
132
|
+
if (proof.sourceHash !== undefined && proof.sourceHash !== source.sourceHash) reasonCodes.push('typescript-type-inference-syntax-proof-source-hash-mismatch');
|
|
133
|
+
const failed = reasonCodes.length > 0 || missingSignals.length > 0;
|
|
134
|
+
return compactRecord({
|
|
135
|
+
...proof,
|
|
136
|
+
status: failed ? 'failed' : proof.status,
|
|
137
|
+
sourcePath: proof.sourcePath ?? source.sourcePath,
|
|
138
|
+
sourceHash: proof.sourceHash ?? source.sourceHash,
|
|
139
|
+
sourceBoundPublicApi: source.publicContract === true || undefined,
|
|
140
|
+
requiredSignals: uniqueStrings([
|
|
141
|
+
...arrayValue(proof.requiredSignals),
|
|
142
|
+
source.publicContract === true ? 'compiler-public-api-source-path' : undefined,
|
|
143
|
+
source.publicContract === true ? 'compiler-public-api-source-hash' : undefined
|
|
144
|
+
]),
|
|
145
|
+
missingSignals: nonEmptyArray(uniqueStrings([...(proof.missingSignals ?? []), ...missingSignals])),
|
|
146
|
+
reasonCodes: nonEmptyArray(uniqueStrings([...(proof.reasonCodes ?? []), ...reasonCodes])),
|
|
147
|
+
autoMergeClaim: false,
|
|
148
|
+
semanticEquivalenceClaim: false
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function countKind(records, kind, field = 'kind') { return records.filter((record) => record?.[field] === kind).length; }
|
|
153
|
+
function objectRecord(value) { return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined; }
|
|
154
|
+
function arrayValue(value) { return Array.isArray(value) ? value : []; }
|
|
155
|
+
function compactRecord(record) { return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined)); }
|
|
156
|
+
function numberValue(value) { return Number.isFinite(value) ? value : undefined; }
|
|
157
|
+
function nonEmptyArray(value) { return Array.isArray(value) && value.length ? value : undefined; }
|
|
158
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
159
|
+
|
|
160
|
+
export {
|
|
161
|
+
compilerAssignabilityOracleMetadata,
|
|
162
|
+
compilerClassMemberShapeMetadata,
|
|
163
|
+
compilerDecoratorMetadata,
|
|
164
|
+
compilerEnumShapeMetadata,
|
|
165
|
+
compilerTypeInferenceSyntaxMetadata
|
|
166
|
+
};
|
|
167
|
+
import { decoratorRuntimeExecutionProjection } from './projectSymbolGraphCompilerDecoratorRuntimeProof.js';
|
|
168
|
+
import { classPrivateAccessorRuntimeProjection } from './projectSymbolGraphCompilerClassPrivateAccessorRuntimeProof.js';
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { hashSemanticValue } from '@shapeshift-labs/frontier-lang-kernel';
|
|
2
|
+
import * as advancedTypes from './projectSymbolGraphCompilerConditionalTypeEquivalence.js';
|
|
3
|
+
import * as cls from './projectSymbolGraphCompilerClassShapeEquivalence.js';
|
|
4
|
+
import * as enumTypes from './projectSymbolGraphCompilerEnumEquivalence.js';
|
|
5
|
+
import * as indexSigs from './projectSymbolGraphCompilerIndexSignatureEquivalence.js';
|
|
6
|
+
import * as typeRefs from './projectSymbolGraphCompilerTypeReferenceTargetEquivalence.js';
|
|
7
|
+
import {
|
|
8
|
+
missingTypeEquivalenceSignals,
|
|
9
|
+
requiresTypeEquivalenceProof,
|
|
10
|
+
typeEquivalenceCheckerInvariant,
|
|
11
|
+
typeEquivalenceProofKind,
|
|
12
|
+
typeEquivalenceProofLevel,
|
|
13
|
+
typeEquivalenceRequiredSignals,
|
|
14
|
+
unsupportedTypeEquivalenceReasonCodes,
|
|
15
|
+
unsupportedTypeEquivalenceSignals
|
|
16
|
+
} from './projectSymbolGraphCompilerTypeEquivalenceProof.js';
|
|
17
|
+
|
|
18
|
+
function compilerTypeEquivalenceRecord(value, compilerSymbol, counts, source = {}) {
|
|
19
|
+
if (!requiresTypeEquivalenceProof(counts)) return { reasonCodes: [] };
|
|
20
|
+
const evidence = typeEquivalenceCheckerEvidence(value, compilerSymbol, counts);
|
|
21
|
+
const missingSignals = missingTypeEquivalenceSignals(value, compilerSymbol, evidence, counts, source);
|
|
22
|
+
const enumComputedValueProof = enumTypes.computedEnumRuntimeValueProofBinding(value, counts, source);
|
|
23
|
+
const unsupportedSignals = unsupportedTypeEquivalenceSignals(counts, value, source);
|
|
24
|
+
const reasonCodes = unsupportedTypeEquivalenceReasonCodes(counts, missingSignals, value, source);
|
|
25
|
+
const canProve = !missingSignals.length && !unsupportedSignals.length;
|
|
26
|
+
const signatureSetHash = canProve ? hashSemanticValue({ kind: 'frontier.lang.typescript.compilerSignatureSetEquivalence.v1', callSignatures: canonicalSignatureRecords(value.callSignatures), constructSignatures: canonicalSignatureRecords(value.constructSignatures), properties: canonicalPropertyRecords(value.properties) }) : undefined;
|
|
27
|
+
const typeParameterSetHash = canProve && counts.typeParameterCount > 0 ? hashSemanticValue({ kind: 'frontier.lang.typescript.compilerGenericParameterSetEquivalence.v1', typeParameters: value.typeParameters }) : undefined;
|
|
28
|
+
const propertySetHash = canProve && counts.propertyCount > 0 ? hashSemanticValue({ kind: 'frontier.lang.typescript.compilerPublicMemberPropertySetEquivalence.v1', properties: canonicalPropertyRecords(value.properties) }) : undefined;
|
|
29
|
+
const indexSignatureSetHash = canProve ? indexSigs.indexSignatureSetHash(value, counts) : undefined;
|
|
30
|
+
const constructorSetHash = canProve && counts.constructorSignatureCount > 0 ? hashSemanticValue({ kind: 'frontier.lang.typescript.compilerConstructorSetEquivalence.v1', constructorSignatures: value.constructorSignatures }) : undefined;
|
|
31
|
+
const classHeritageHash = canProve && counts.classHeritageCount > 0 ? hashSemanticValue({ kind: 'frontier.lang.typescript.compilerClassHeritageEquivalence.v1', classHeritage: value.classHeritage }) : undefined;
|
|
32
|
+
const classHashes = canProve ? cls.classShapeSetHashes(value, counts) : {};
|
|
33
|
+
const enumRuntimeShapeHash = canProve ? enumTypes.enumRuntimeShapeHash(value, counts) : undefined;
|
|
34
|
+
const advancedTypeHashes = canProve ? advancedTypes.advancedTypeSetHashes(value, counts) : {};
|
|
35
|
+
const typeReferenceTargetSetHash = canProve ? typeRefs.typeReferenceTargetSetHash(value, counts) : undefined;
|
|
36
|
+
const assignabilityOracleHash = canProve && counts.assignabilityOracleCount > 0 ? value.assignabilityOracleHash : undefined;
|
|
37
|
+
const proof = compactRecord({
|
|
38
|
+
kind: typeEquivalenceProofKind(counts),
|
|
39
|
+
status: canProve ? 'passed' : 'failed',
|
|
40
|
+
proofLevel: typeEquivalenceProofLevel(counts),
|
|
41
|
+
checkerInvariant: typeEquivalenceCheckerInvariant(counts, source),
|
|
42
|
+
requiredSignals: typeEquivalenceRequiredSignals(counts, source),
|
|
43
|
+
missingSignals: nonEmptyArray(missingSignals),
|
|
44
|
+
unsupportedSignals: nonEmptyArray(unsupportedSignals),
|
|
45
|
+
reasonCodes: nonEmptyArray(reasonCodes),
|
|
46
|
+
signatureSetHash,
|
|
47
|
+
typeParameterSetHash,
|
|
48
|
+
propertySetHash,
|
|
49
|
+
indexSignatureSetHash,
|
|
50
|
+
constructorSetHash,
|
|
51
|
+
classHeritageHash,
|
|
52
|
+
...classHashes,
|
|
53
|
+
enumRuntimeShapeHash,
|
|
54
|
+
enumEmittedRuntimeShapeHash: value.enumEmittedRuntimeShapeHash,
|
|
55
|
+
computedEnumRuntimeValueHash: enumComputedValueProof.computedEnumRuntimeValueHash,
|
|
56
|
+
computedEnumRuntimeValueProof: enumComputedValueProof.proof,
|
|
57
|
+
...advancedTypeHashes,
|
|
58
|
+
typeReferenceTargetSetHash,
|
|
59
|
+
assignabilityOracleHash,
|
|
60
|
+
assignabilityOracleScope: counts.assignabilityOracleCount > 0 ? 'declared-apparent-type-only' : undefined,
|
|
61
|
+
apiSignatureHash: value.apiSignatureHash,
|
|
62
|
+
compilerSymbolIdentityHash: compilerSymbol?.identityHash,
|
|
63
|
+
typeIdentityHash: value.identityHash,
|
|
64
|
+
sourcePath: source.sourcePath,
|
|
65
|
+
sourceHash: source.sourceHash,
|
|
66
|
+
callSignatureCount: counts.callSignatureCount || undefined,
|
|
67
|
+
constructSignatureCount: counts.constructSignatureCount || undefined,
|
|
68
|
+
overloadSignatureCount: counts.overloadSignatureCount || undefined,
|
|
69
|
+
declarationCount: counts.declarationCount,
|
|
70
|
+
typeParameterCount: counts.typeParameterCount || undefined,
|
|
71
|
+
typeParameterDefaultCount: counts.typeParameterDefaultCount || undefined,
|
|
72
|
+
typeParameterConstraintCount: counts.typeParameterConstraintCount || undefined,
|
|
73
|
+
propertyCount: counts.propertyCount || undefined,
|
|
74
|
+
propertyOptionalCount: counts.propertyOptionalCount || undefined,
|
|
75
|
+
propertyReadonlyCount: counts.propertyReadonlyCount || undefined,
|
|
76
|
+
indexSignatureCount: counts.indexSignatureCount || undefined,
|
|
77
|
+
indexSignatureReadonlyCount: counts.indexSignatureReadonlyCount || undefined,
|
|
78
|
+
constructorSignatureCount: counts.constructorSignatureCount || undefined,
|
|
79
|
+
classHeritageCount: counts.classHeritageCount || undefined,
|
|
80
|
+
privateClassMemberCount: counts.privateClassMemberCount || undefined,
|
|
81
|
+
accessorFieldCount: counts.accessorFieldCount || undefined,
|
|
82
|
+
enumMemberCount: counts.enumMemberCount || undefined,
|
|
83
|
+
enumComputedMemberCount: counts.enumComputedMemberCount || undefined,
|
|
84
|
+
advancedTypeShapeCount: counts.advancedTypeShapeCount || undefined,
|
|
85
|
+
typeReferenceTargetCount: counts.typeReferenceTargetCount || undefined,
|
|
86
|
+
conditionalTypeCount: counts.conditionalTypeCount || undefined,
|
|
87
|
+
mappedTypeCount: counts.mappedTypeCount || undefined,
|
|
88
|
+
indexedAccessTypeCount: counts.indexedAccessTypeCount || undefined,
|
|
89
|
+
keyofTypeOperatorCount: counts.keyofTypeOperatorCount || undefined,
|
|
90
|
+
templateLiteralTypeCount: counts.templateLiteralTypeCount || undefined,
|
|
91
|
+
inferTypeCount: counts.inferTypeCount || undefined,
|
|
92
|
+
assignabilityOracleCount: counts.assignabilityOracleCount || undefined,
|
|
93
|
+
assignabilityOracleDirectionCount: counts.assignabilityOracleDirectionCount || undefined,
|
|
94
|
+
evidenceIds: uniqueStrings([...(counts.evidenceIds ?? []), ...enumComputedValueProof.evidenceIds]),
|
|
95
|
+
autoMergeClaim: false,
|
|
96
|
+
semanticEquivalenceClaim: false
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
status: canProve ? 'compiler-backed-equivalent' : 'unsupported',
|
|
100
|
+
reasonCodes: canProve ? [] : reasonCodes,
|
|
101
|
+
signatureSetHash,
|
|
102
|
+
typeParameterSetHash,
|
|
103
|
+
propertySetHash,
|
|
104
|
+
indexSignatureSetHash,
|
|
105
|
+
constructorSetHash,
|
|
106
|
+
classHeritageHash,
|
|
107
|
+
...classHashes,
|
|
108
|
+
enumRuntimeShapeHash,
|
|
109
|
+
enumEmittedRuntimeShapeHash: value.enumEmittedRuntimeShapeHash,
|
|
110
|
+
...advancedTypeHashes,
|
|
111
|
+
typeReferenceTargetSetHash,
|
|
112
|
+
assignabilityOracleHash,
|
|
113
|
+
proof,
|
|
114
|
+
checkerEvidence: evidence
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function typeEquivalenceCheckerEvidence(value, compilerSymbol, counts) {
|
|
119
|
+
const signatures = [...arrayValue(value.callSignatures), ...arrayValue(value.constructSignatures)];
|
|
120
|
+
const typeParameters = arrayValue(value.typeParameters);
|
|
121
|
+
const properties = arrayValue(value.properties);
|
|
122
|
+
const constructorSignatures = arrayValue(value.constructorSignatures);
|
|
123
|
+
const classHeritage = arrayValue(value.classHeritage);
|
|
124
|
+
const advancedShapes = arrayValue(value.advancedTypeShapes);
|
|
125
|
+
const typeReferenceTargets = arrayValue(value.typeReferenceTargets);
|
|
126
|
+
const assignabilityOracle = objectValue(value.assignabilityOracle);
|
|
127
|
+
const assignabilityDirections = arrayValue(assignabilityOracle.directions);
|
|
128
|
+
return compactRecord({
|
|
129
|
+
parser: value.parser,
|
|
130
|
+
compilerSymbolIdentityHash: compilerSymbol?.identityHash,
|
|
131
|
+
typeIdentityHash: value.identityHash,
|
|
132
|
+
apiSignatureHash: value.apiSignatureHash,
|
|
133
|
+
declarationCount: counts.declarationCount,
|
|
134
|
+
callSignatureCount: counts.callSignatureCount || undefined,
|
|
135
|
+
constructSignatureCount: counts.constructSignatureCount || undefined,
|
|
136
|
+
overloadSignatureCount: counts.overloadSignatureCount || undefined,
|
|
137
|
+
typeParameterCount: counts.typeParameterCount || undefined,
|
|
138
|
+
typeParameterDefaultCount: counts.typeParameterDefaultCount || undefined,
|
|
139
|
+
typeParameterConstraintCount: counts.typeParameterConstraintCount || undefined,
|
|
140
|
+
propertyCount: counts.propertyCount || undefined,
|
|
141
|
+
propertyOptionalCount: counts.propertyOptionalCount || undefined,
|
|
142
|
+
propertyReadonlyCount: counts.propertyReadonlyCount || undefined,
|
|
143
|
+
...indexSigs.indexSignatureCheckerEvidence(value, counts),
|
|
144
|
+
constructorSignatureCount: counts.constructorSignatureCount || undefined,
|
|
145
|
+
classHeritageCount: counts.classHeritageCount || undefined,
|
|
146
|
+
...cls.classShapeCheckerEvidence(value, counts),
|
|
147
|
+
...enumTypes.enumCheckerEvidence(value, counts),
|
|
148
|
+
advancedTypeShapeCount: counts.advancedTypeShapeCount || undefined,
|
|
149
|
+
advancedTypeShapeKinds: nonEmptyArray(uniqueStrings(advancedShapes.map((shape) => shape.kind))),
|
|
150
|
+
advancedTypeShapeNodeTexts: advancedShapes.map((shape) => shape.nodeText).filter(Boolean),
|
|
151
|
+
advancedTypeShapeTypeTexts: advancedShapes.map((shape) => shape.typeText).filter(Boolean),
|
|
152
|
+
...advancedTypes.advancedTypeCheckerEvidence(value),
|
|
153
|
+
typeReferenceTargetCount: counts.typeReferenceTargetCount || undefined,
|
|
154
|
+
typeReferenceTargets: nonEmptyArray(typeReferenceTargets),
|
|
155
|
+
...typeRefs.typeReferenceTargetCheckerEvidence(value, counts),
|
|
156
|
+
assignabilityOracleHash: value.assignabilityOracleHash,
|
|
157
|
+
assignabilityOracleCount: counts.assignabilityOracleCount || undefined,
|
|
158
|
+
assignabilityOracleDirectionCount: counts.assignabilityOracleDirectionCount || undefined,
|
|
159
|
+
assignabilityOracleScope: counts.assignabilityOracleCount > 0 ? 'declared-apparent-type-only' : undefined,
|
|
160
|
+
assignabilityOracleDeclaredTypeText: assignabilityOracle.declaredTypeText,
|
|
161
|
+
assignabilityOracleApparentTypeText: assignabilityOracle.apparentTypeText,
|
|
162
|
+
assignabilityOracleResults: assignabilityDirections.map((direction) => direction.assignable),
|
|
163
|
+
assignabilityOracleDirections: assignabilityDirections,
|
|
164
|
+
assignabilityOracleEquivalentByBidirectionalAssignability: assignabilityOracle.equivalentByBidirectionalAssignability,
|
|
165
|
+
assignabilityOracleAmbiguous: assignabilityOracle.ambiguous,
|
|
166
|
+
assignabilityOracle: counts.assignabilityOracleCount > 0 ? assignabilityOracle : undefined,
|
|
167
|
+
typeParameterNames: typeParameters.map((parameter) => parameter.name),
|
|
168
|
+
typeParameterDefaultTypeTexts: typeParameters.filter((parameter) => parameter.hasDefault).map((parameter) => parameter.defaultTypeText),
|
|
169
|
+
typeParameterConstraintTypeTexts: typeParameters.filter((parameter) => parameter.hasConstraint).map((parameter) => parameter.constraintTypeText),
|
|
170
|
+
propertyNames: properties.map((property) => property.name),
|
|
171
|
+
propertyTypeTexts: properties.map((property) => property.typeText),
|
|
172
|
+
propertyOptionality: properties.map((property) => property.optional),
|
|
173
|
+
propertyReadonly: properties.map((property) => property.readonly),
|
|
174
|
+
propertyDeclarationCounts: properties.map((property) => property.declarations),
|
|
175
|
+
constructorSignatureTexts: constructorSignatures.map((signature) => signature.signatureText),
|
|
176
|
+
constructorParameterTypeTexts: constructorSignatures.map((signature) => (signature.parameters ?? []).map((parameter) => parameter.typeText)),
|
|
177
|
+
classHeritageKinds: classHeritage.map((heritage) => heritage.kind),
|
|
178
|
+
classHeritageTypeTexts: classHeritage.map((heritage) => heritage.typeText),
|
|
179
|
+
classHeritageExpressionTexts: classHeritage.map((heritage) => heritage.expressionText),
|
|
180
|
+
typeParameters: nonEmptyArray(typeParameters),
|
|
181
|
+
properties: nonEmptyArray(properties),
|
|
182
|
+
constructorSignatures: nonEmptyArray(constructorSignatures),
|
|
183
|
+
classHeritage: nonEmptyArray(classHeritage),
|
|
184
|
+
advancedTypeShapes: nonEmptyArray(advancedShapes),
|
|
185
|
+
signatureTexts: signatures.map((signature) => signature.signatureText),
|
|
186
|
+
returnTypeTexts: signatures.map((signature) => signature.returnTypeText),
|
|
187
|
+
parameterTypeTexts: signatures.map((signature) => (signature.parameters ?? []).map((parameter) => parameter.typeText))
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function canonicalSignatureRecords(signatures) { return arrayValue(signatures).map((signature) => compactRecord({ ...signature, parameters: nonEmptyArray(arrayValue(signature.parameters).map(({ flags: _flags, ...parameter }) => parameter)) })); }
|
|
192
|
+
function canonicalPropertyRecords(properties) { return arrayValue(properties).map(({ flags: _flags, ...property }) => property); }
|
|
193
|
+
function arrayValue(value) { return Array.isArray(value) ? value : []; }
|
|
194
|
+
function objectValue(value) { return value && typeof value === 'object' && !Array.isArray(value) ? value : {}; }
|
|
195
|
+
function compactRecord(record) { return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined)); }
|
|
196
|
+
function nonEmptyArray(value) { return Array.isArray(value) && value.length ? value : undefined; }
|
|
197
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
198
|
+
|
|
199
|
+
export { compilerTypeEquivalenceRecord };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import * as advancedTypes from './projectSymbolGraphCompilerConditionalTypeEquivalence.js';
|
|
2
|
+
import * as cls from './projectSymbolGraphCompilerClassShapeEquivalence.js';
|
|
3
|
+
import * as enumTypes from './projectSymbolGraphCompilerEnumEquivalence.js';
|
|
4
|
+
import * as indexSigs from './projectSymbolGraphCompilerIndexSignatureEquivalence.js';
|
|
5
|
+
import * as typeRefs from './projectSymbolGraphCompilerTypeReferenceTargetEquivalence.js';
|
|
6
|
+
|
|
7
|
+
const GenericTypeEquivalenceProofKind = 'typescript-checker-public-api-generic-parameter-equivalence';
|
|
8
|
+
const SignatureAndGenericTypeEquivalenceProofKind = 'typescript-checker-public-api-signature-set-and-generic-parameter-equivalence';
|
|
9
|
+
const MemberPropertyTypeEquivalenceProofKind = 'typescript-checker-public-api-member-property-signature-equivalence';
|
|
10
|
+
const AssignabilityOracleEquivalenceProofKind = 'typescript-checker-public-api-assignability-oracle-equivalence';
|
|
11
|
+
|
|
12
|
+
function requiresTypeEquivalenceProof(counts) {
|
|
13
|
+
return counts.overloadSignatureCount > 1 || counts.declarationCount > 1 || counts.typeParameterCount > 0 || counts.propertyCount > 0
|
|
14
|
+
|| counts.indexSignatureCount > 0 || counts.constructorSignatureCount > 0 || counts.classHeritageCount > 0 || counts.privateClassMemberCount > 0 || counts.accessorFieldCount > 0 || counts.enumMemberCount > 0 || counts.advancedTypeShapeCount > 0 || counts.typeReferenceTargetCount > 0 || counts.assignabilityOracleCount > 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function unsupportedTypeEquivalenceReasonCodes(counts, missingSignals = [], value = {}, source = {}) {
|
|
18
|
+
const reasonCodes = [];
|
|
19
|
+
if (counts.overloadSignatureCount > 1) reasonCodes.push('typescript-overload-signature-set-equivalence-unproven');
|
|
20
|
+
if (counts.declarationCount > 1) reasonCodes.push('typescript-exported-declaration-equivalence-unproven');
|
|
21
|
+
if (counts.typeParameterCount > 0) reasonCodes.push('typescript-generic-type-parameter-equivalence-unproven');
|
|
22
|
+
if (counts.typeParameterDefaultCount > 0) reasonCodes.push('typescript-generic-type-parameter-default-equivalence-unproven');
|
|
23
|
+
if (counts.typeParameterConstraintCount > 0) reasonCodes.push('typescript-generic-type-parameter-constraint-equivalence-unproven');
|
|
24
|
+
if (counts.propertyCount > 0) reasonCodes.push('typescript-public-member-property-signature-equivalence-unproven');
|
|
25
|
+
reasonCodes.push(...indexSigs.indexSignatureUnsupportedReasonCodes(counts));
|
|
26
|
+
if (counts.constructorSignatureCount > 0) reasonCodes.push('typescript-public-constructor-signature-equivalence-unproven');
|
|
27
|
+
if (counts.classHeritageCount > 0) reasonCodes.push('typescript-public-class-heritage-equivalence-unproven');
|
|
28
|
+
reasonCodes.push(...cls.classShapeUnsupportedReasonCodes(counts));
|
|
29
|
+
reasonCodes.push(...enumTypes.enumUnsupportedReasonCodes(value, counts, source));
|
|
30
|
+
reasonCodes.push(...advancedTypes.advancedTypeUnsupportedReasonCodes(counts));
|
|
31
|
+
if (counts.typeReferenceTargetCount > 0) reasonCodes.push('typescript-public-api-type-reference-target-proof-unproven');
|
|
32
|
+
if (counts.assignabilityOracleCount > 0) reasonCodes.push('typescript-public-api-assignability-oracle-equivalence-unproven');
|
|
33
|
+
for (const signal of missingSignals) reasonCodes.push(`typescript-${signal}-missing`);
|
|
34
|
+
return reasonCodes;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function typeEquivalenceProofKind(counts) {
|
|
38
|
+
const advancedTypeProofKind = advancedTypes.advancedTypeProofKind(counts);
|
|
39
|
+
if (advancedTypeProofKind) return advancedTypeProofKind;
|
|
40
|
+
const enumProofKind = enumTypes.enumProofKind(counts);
|
|
41
|
+
const typeReferenceTargetProofKind = typeRefs.typeReferenceTargetProofKind(counts);
|
|
42
|
+
const indexSignatureProofKind = indexSigs.indexSignatureProofKind(counts);
|
|
43
|
+
const hasSignatureProof = counts.overloadSignatureCount > 1 || counts.declarationCount > 1;
|
|
44
|
+
const hasGenericProof = counts.typeParameterCount > 0;
|
|
45
|
+
const hasPropertyProof = counts.propertyCount > 0;
|
|
46
|
+
const hasClassProof = counts.constructorSignatureCount > 0 || counts.classHeritageCount > 0 || counts.privateClassMemberCount > 0 || counts.accessorFieldCount > 0;
|
|
47
|
+
const hasAssignabilityProof = counts.assignabilityOracleCount > 0;
|
|
48
|
+
if (enumProofKind && !hasSignatureProof && !hasGenericProof && !hasPropertyProof && !indexSignatureProofKind && !hasClassProof) return enumProofKind;
|
|
49
|
+
if (typeReferenceTargetProofKind && !hasSignatureProof && !hasGenericProof && !hasPropertyProof && !indexSignatureProofKind && !hasClassProof && !enumProofKind) return typeReferenceTargetProofKind;
|
|
50
|
+
if (hasSignatureProof && hasGenericProof) return SignatureAndGenericTypeEquivalenceProofKind;
|
|
51
|
+
if (hasGenericProof) return GenericTypeEquivalenceProofKind;
|
|
52
|
+
if (hasClassProof && !hasPropertyProof) return 'typescript-checker-public-api-class-shape-equivalence';
|
|
53
|
+
if (indexSignatureProofKind && !hasPropertyProof) return indexSignatureProofKind;
|
|
54
|
+
if (hasPropertyProof) return MemberPropertyTypeEquivalenceProofKind;
|
|
55
|
+
if (hasAssignabilityProof) return AssignabilityOracleEquivalenceProofKind;
|
|
56
|
+
return 'typescript-checker-public-api-signature-set-equivalence';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function typeEquivalenceProofLevel(counts) {
|
|
60
|
+
const levels = [];
|
|
61
|
+
if (counts.overloadSignatureCount > 1 || counts.declarationCount > 1) levels.push('signature-set');
|
|
62
|
+
if (counts.typeParameterCount > 0) levels.push('generic-parameter-set');
|
|
63
|
+
if (counts.propertyCount > 0) levels.push('member-property-set');
|
|
64
|
+
const indexSignatureLevel = indexSigs.indexSignatureProofLevel(counts);
|
|
65
|
+
if (indexSignatureLevel) levels.push(indexSignatureLevel);
|
|
66
|
+
if (counts.constructorSignatureCount > 0) levels.push('constructor-signature-set');
|
|
67
|
+
if (counts.classHeritageCount > 0) levels.push('class-heritage-set');
|
|
68
|
+
const clsLevel = cls.classShapeProofLevel(counts);
|
|
69
|
+
if (clsLevel) levels.push(clsLevel);
|
|
70
|
+
const enumLevel = enumTypes.enumProofLevel(counts);
|
|
71
|
+
if (enumLevel) levels.push(enumLevel);
|
|
72
|
+
const advancedTypeLevel = advancedTypes.advancedTypeProofLevel(counts);
|
|
73
|
+
if (advancedTypeLevel) levels.push(advancedTypeLevel);
|
|
74
|
+
const typeReferenceTargetLevel = typeRefs.typeReferenceTargetProofLevel(counts);
|
|
75
|
+
if (typeReferenceTargetLevel) levels.push(typeReferenceTargetLevel);
|
|
76
|
+
if (counts.assignabilityOracleCount > 0) levels.push('declared-apparent-assignability-oracle');
|
|
77
|
+
return `typescript-checker-public-api-${levels.length ? levels.join('-and-') : 'signature-set'}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function typeEquivalenceCheckerInvariant(counts, source = {}) {
|
|
81
|
+
const invariants = [];
|
|
82
|
+
if (source.publicContract) invariants.push('public API source path/hash bound');
|
|
83
|
+
if (counts.overloadSignatureCount > 1 || counts.declarationCount > 1) invariants.push('signature/return/parameter texts complete');
|
|
84
|
+
if (counts.typeParameterCount > 0) invariants.push('generic defaults/constraints complete');
|
|
85
|
+
if (counts.propertyCount > 0) invariants.push('member names/types/modifiers complete');
|
|
86
|
+
const indexSignatureInvariant = indexSigs.indexSignatureCheckerInvariant(counts);
|
|
87
|
+
if (indexSignatureInvariant) invariants.push(indexSignatureInvariant);
|
|
88
|
+
if (counts.constructorSignatureCount > 0) invariants.push('constructor signatures complete');
|
|
89
|
+
if (counts.classHeritageCount > 0) invariants.push('heritage type texts complete');
|
|
90
|
+
const clsInvariant = cls.classShapeCheckerInvariant(counts);
|
|
91
|
+
if (clsInvariant) invariants.push(clsInvariant);
|
|
92
|
+
const enumInvariant = enumTypes.enumCheckerInvariant(counts);
|
|
93
|
+
if (enumInvariant) invariants.push(enumInvariant);
|
|
94
|
+
const advancedTypeInvariant = advancedTypes.advancedTypeCheckerInvariant(counts);
|
|
95
|
+
if (advancedTypeInvariant) invariants.push(advancedTypeInvariant);
|
|
96
|
+
const typeReferenceTargetInvariant = typeRefs.typeReferenceTargetCheckerInvariant(counts);
|
|
97
|
+
if (typeReferenceTargetInvariant) invariants.push(typeReferenceTargetInvariant);
|
|
98
|
+
if (counts.assignabilityOracleCount > 0) invariants.push('declared/apparent type texts and bidirectional checker assignability complete');
|
|
99
|
+
return invariants.join('; ');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function typeEquivalenceRequiredSignals(counts, source = {}) {
|
|
103
|
+
return [
|
|
104
|
+
source.publicContract ? 'compiler-public-api-source-path' : undefined,
|
|
105
|
+
source.publicContract ? 'compiler-public-api-source-hash' : undefined,
|
|
106
|
+
'compiler-symbol-identity-hash', 'compiler-symbol-declaration-count', 'compiler-type-identity-hash', 'compiler-api-signature-hash',
|
|
107
|
+
counts.overloadSignatureCount > 1 || counts.declarationCount > 1 ? 'compiler-overload-signature-count' : undefined,
|
|
108
|
+
counts.typeParameterCount > 0 ? 'compiler-type-parameter-count' : undefined,
|
|
109
|
+
counts.typeParameterCount > 0 ? 'compiler-type-parameter-names' : undefined,
|
|
110
|
+
counts.typeParameterDefaultCount > 0 ? 'compiler-type-parameter-default-type-texts' : undefined,
|
|
111
|
+
counts.typeParameterConstraintCount > 0 ? 'compiler-type-parameter-constraint-type-texts' : undefined,
|
|
112
|
+
counts.propertyCount > 0 ? 'compiler-member-property-count' : undefined,
|
|
113
|
+
counts.propertyCount > 0 ? 'compiler-member-property-names' : undefined,
|
|
114
|
+
counts.propertyCount > 0 ? 'compiler-member-property-type-texts' : undefined,
|
|
115
|
+
counts.propertyCount > 0 ? 'compiler-member-property-optionality' : undefined,
|
|
116
|
+
counts.propertyCount > 0 ? 'compiler-member-property-readonly' : undefined,
|
|
117
|
+
...indexSigs.indexSignatureRequiredSignals(counts),
|
|
118
|
+
counts.constructorSignatureCount > 0 ? 'compiler-constructor-signature-count' : undefined,
|
|
119
|
+
counts.constructorSignatureCount > 0 ? 'compiler-constructor-signature-texts' : undefined,
|
|
120
|
+
counts.constructorSignatureCount > 0 ? 'compiler-constructor-parameter-type-texts' : undefined,
|
|
121
|
+
counts.classHeritageCount > 0 ? 'compiler-class-heritage-count' : undefined,
|
|
122
|
+
counts.classHeritageCount > 0 ? 'compiler-class-heritage-type-texts' : undefined,
|
|
123
|
+
...cls.classShapeRequiredSignals(counts),
|
|
124
|
+
...enumTypes.enumRequiredSignals(counts),
|
|
125
|
+
...advancedTypes.advancedTypeRequiredSignals(counts),
|
|
126
|
+
...typeRefs.typeReferenceTargetRequiredSignals(counts),
|
|
127
|
+
counts.advancedTypeShapeCount > 0 ? 'compiler-advanced-type-shape-node-texts' : undefined,
|
|
128
|
+
counts.advancedTypeShapeCount > 0 ? 'compiler-advanced-type-shape-type-texts' : undefined,
|
|
129
|
+
counts.assignabilityOracleCount > 0 ? 'compiler-assignability-oracle-hash' : undefined,
|
|
130
|
+
counts.assignabilityOracleCount > 0 ? 'compiler-assignability-oracle-direction-count' : undefined,
|
|
131
|
+
counts.assignabilityOracleCount > 0 ? 'compiler-assignability-oracle-directions' : undefined,
|
|
132
|
+
counts.assignabilityOracleCount > 0 ? 'compiler-assignability-oracle-type-texts' : undefined,
|
|
133
|
+
counts.assignabilityOracleCount > 0 ? 'compiler-assignability-oracle-result' : undefined,
|
|
134
|
+
counts.assignabilityOracleCount > 0 ? 'compiler-assignability-oracle-unambiguous-result' : undefined,
|
|
135
|
+
'compiler-signature-texts', 'compiler-return-type-texts', 'compiler-parameter-type-texts'
|
|
136
|
+
].filter(Boolean);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function missingTypeEquivalenceSignals(value, compilerSymbol, evidence, counts, source = {}) {
|
|
140
|
+
const missing = [];
|
|
141
|
+
if (source.publicContract && !source.sourcePath) missing.push('compiler-public-api-source-path');
|
|
142
|
+
if (source.publicContract && !source.sourceHash) missing.push('compiler-public-api-source-hash');
|
|
143
|
+
if (!compilerSymbol?.identityHash) missing.push('compiler-symbol-identity-hash');
|
|
144
|
+
if (!Number.isFinite(counts.declarationCount)) missing.push('compiler-symbol-declaration-count');
|
|
145
|
+
if (!value.identityHash) missing.push('compiler-type-identity-hash');
|
|
146
|
+
if (!value.apiSignatureHash) missing.push('compiler-api-signature-hash');
|
|
147
|
+
if (counts.declarationCount > 1 && counts.overloadSignatureCount <= 1) missing.push('compiler-overload-signature-count');
|
|
148
|
+
if (counts.overloadSignatureCount > 1 && evidence.signatureTexts.length !== counts.overloadSignatureCount) missing.push('compiler-overload-signature-count');
|
|
149
|
+
if (evidence.signatureTexts.length !== counts.overloadSignatureCount || evidence.signatureTexts.some((text) => !text)) missing.push('compiler-signature-texts');
|
|
150
|
+
if (evidence.returnTypeTexts.length !== counts.overloadSignatureCount || evidence.returnTypeTexts.some((text) => !text)) missing.push('compiler-return-type-texts');
|
|
151
|
+
if (!compilerSignatureParametersCovered(value.callSignatures) || !compilerSignatureParametersCovered(value.constructSignatures)) missing.push('compiler-parameter-type-texts');
|
|
152
|
+
if (counts.typeParameterCount > 0 && (evidence.typeParameterNames.length !== counts.typeParameterCount || evidence.typeParameterNames.some((text) => !text))) missing.push('compiler-type-parameter-names');
|
|
153
|
+
if (counts.typeParameterDefaultCount > 0 && (evidence.typeParameterDefaultTypeTexts.length !== counts.typeParameterDefaultCount || evidence.typeParameterDefaultTypeTexts.some((text) => !text))) missing.push('compiler-type-parameter-default-type-texts');
|
|
154
|
+
if (counts.typeParameterConstraintCount > 0 && (evidence.typeParameterConstraintTypeTexts.length !== counts.typeParameterConstraintCount || evidence.typeParameterConstraintTypeTexts.some((text) => !text))) missing.push('compiler-type-parameter-constraint-type-texts');
|
|
155
|
+
if (counts.propertyCount > 0 && evidence.propertyNames.length !== counts.propertyCount) missing.push('compiler-member-property-count');
|
|
156
|
+
if (counts.propertyCount > 0 && (evidence.propertyNames.length !== counts.propertyCount || evidence.propertyNames.some((text) => !text))) missing.push('compiler-member-property-names');
|
|
157
|
+
if (counts.propertyCount > 0 && (evidence.propertyTypeTexts.length !== counts.propertyCount || evidence.propertyTypeTexts.some((text) => !text))) missing.push('compiler-member-property-type-texts');
|
|
158
|
+
if (counts.propertyCount > 0 && !compilerBooleanSignalsCovered(evidence.propertyOptionality, counts.propertyCount)) missing.push('compiler-member-property-optionality');
|
|
159
|
+
if (counts.propertyCount > 0 && !compilerBooleanSignalsCovered(evidence.propertyReadonly, counts.propertyCount)) missing.push('compiler-member-property-readonly');
|
|
160
|
+
missing.push(...indexSigs.missingIndexSignatureEquivalenceSignals(value, counts, evidence));
|
|
161
|
+
if (counts.constructorSignatureCount > 0 && evidence.constructorSignatureTexts.length !== counts.constructorSignatureCount) missing.push('compiler-constructor-signature-count');
|
|
162
|
+
if (counts.constructorSignatureCount > 0 && (evidence.constructorSignatureTexts.length !== counts.constructorSignatureCount || evidence.constructorSignatureTexts.some((text) => !text))) missing.push('compiler-constructor-signature-texts');
|
|
163
|
+
if (counts.constructorSignatureCount > 0 && !compilerConstructorParametersCovered(value.constructorSignatures)) missing.push('compiler-constructor-parameter-type-texts');
|
|
164
|
+
if (counts.classHeritageCount > 0 && evidence.classHeritageTypeTexts.length !== counts.classHeritageCount) missing.push('compiler-class-heritage-count');
|
|
165
|
+
if (counts.classHeritageCount > 0 && (evidence.classHeritageTypeTexts.length !== counts.classHeritageCount || evidence.classHeritageTypeTexts.some((text) => !text))) missing.push('compiler-class-heritage-type-texts');
|
|
166
|
+
missing.push(...cls.missingClassShapeEquivalenceSignals(value, counts, evidence));
|
|
167
|
+
missing.push(...enumTypes.missingEnumEquivalenceSignals(value, counts));
|
|
168
|
+
if (counts.advancedTypeShapeCount > 0 && evidence.advancedTypeShapeNodeTexts.length !== counts.advancedTypeShapeCount) missing.push('compiler-advanced-type-shape-node-texts');
|
|
169
|
+
if (counts.advancedTypeShapeCount > 0 && evidence.advancedTypeShapeTypeTexts.length !== counts.advancedTypeShapeCount) missing.push('compiler-advanced-type-shape-type-texts');
|
|
170
|
+
missing.push(...advancedTypes.missingAdvancedTypeEquivalenceSignals(value, counts));
|
|
171
|
+
missing.push(...typeRefs.missingTypeReferenceTargetSignals(value, counts));
|
|
172
|
+
if (counts.assignabilityOracleCount > 0) {
|
|
173
|
+
const oracle = objectValue(value.assignabilityOracle);
|
|
174
|
+
const directions = arrayValue(oracle.directions);
|
|
175
|
+
if (!value.assignabilityOracleHash) missing.push('compiler-assignability-oracle-hash');
|
|
176
|
+
if (directions.length !== counts.assignabilityOracleDirectionCount || directions.length !== 2) missing.push('compiler-assignability-oracle-direction-count');
|
|
177
|
+
if (directions.length !== 2 || directions.some((direction) => !direction.direction || !direction.fromTypeText || !direction.toTypeText)) missing.push('compiler-assignability-oracle-directions');
|
|
178
|
+
if (!oracle.declaredTypeText || !oracle.apparentTypeText) missing.push('compiler-assignability-oracle-type-texts');
|
|
179
|
+
if (directions.some((direction) => typeof direction.assignable !== 'boolean')) missing.push('compiler-assignability-oracle-result');
|
|
180
|
+
if (oracle.ambiguous === true || oracle.equivalentByBidirectionalAssignability !== true) missing.push('compiler-assignability-oracle-unambiguous-result');
|
|
181
|
+
}
|
|
182
|
+
return uniqueStrings(missing);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function unsupportedTypeEquivalenceSignals(counts, value = {}, source = {}) {
|
|
186
|
+
return [...enumTypes.enumUnsupportedSignals(value, counts, source), ...advancedTypes.advancedTypeUnsupportedSignals(counts)];
|
|
187
|
+
}
|
|
188
|
+
function compilerSignatureParametersCovered(signatures) { return arrayValue(signatures).every((signature) => arrayValue(signature.parameters).every((parameter) => Boolean(parameter.typeText))); }
|
|
189
|
+
function compilerConstructorParametersCovered(signatures) { return arrayValue(signatures).every((signature) => arrayValue(signature.parameters).every((parameter) => Boolean(parameter.typeText))); }
|
|
190
|
+
function compilerBooleanSignalsCovered(values, count) { return Array.isArray(values) && values.length === count && values.every((value) => typeof value === 'boolean'); }
|
|
191
|
+
function arrayValue(value) { return Array.isArray(value) ? value : []; }
|
|
192
|
+
function objectValue(value) { return value && typeof value === 'object' && !Array.isArray(value) ? value : {}; }
|
|
193
|
+
function uniqueStrings(values) { return [...new Set(values.filter((value) => typeof value === 'string' && value.length > 0))]; }
|
|
194
|
+
|
|
195
|
+
export {
|
|
196
|
+
missingTypeEquivalenceSignals,
|
|
197
|
+
requiresTypeEquivalenceProof,
|
|
198
|
+
typeEquivalenceCheckerInvariant,
|
|
199
|
+
typeEquivalenceProofKind,
|
|
200
|
+
typeEquivalenceProofLevel,
|
|
201
|
+
typeEquivalenceRequiredSignals,
|
|
202
|
+
unsupportedTypeEquivalenceReasonCodes,
|
|
203
|
+
unsupportedTypeEquivalenceSignals
|
|
204
|
+
};
|