@geastack/compiler 1.0.27 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-coverage.js +2 -2
- package/dist/cli-emit.js +36 -12
- package/dist/compiler.d.ts +11 -9
- package/dist/compiler.js +264 -43
- package/dist/conversion/algebra.d.ts +84 -4
- package/dist/conversion/algebra.js +39 -0
- package/dist/conversion/array-view.d.ts +63 -0
- package/dist/conversion/array-view.js +186 -0
- package/dist/conversion/build.d.ts +8 -8
- package/dist/conversion/build.js +56 -50
- package/dist/conversion/certified-iterator-object-view.d.ts +13 -0
- package/dist/conversion/certified-iterator-object-view.js +31 -0
- package/dist/conversion/certified-iterator-protocols.d.ts +23 -0
- package/dist/conversion/certified-iterator-protocols.js +50 -0
- package/dist/conversion/checked-native-field-read.d.ts +7 -0
- package/dist/conversion/checked-native-field-read.js +36 -0
- package/dist/conversion/constructor-identity-family.d.ts +6 -6
- package/dist/conversion/constructor-identity-family.js +3 -3
- package/dist/conversion/derive.js +11 -8
- package/dist/conversion/dictionary-view.d.ts +114 -0
- package/dist/conversion/dictionary-view.js +275 -0
- package/dist/conversion/document-record-view.d.ts +89 -0
- package/dist/conversion/document-record-view.js +269 -0
- package/dist/conversion/dynamic-result-carriers.d.ts +6 -0
- package/dist/conversion/dynamic-result-carriers.js +43 -0
- package/dist/conversion/dynamic-wrapper.d.ts +52 -0
- package/dist/conversion/dynamic-wrapper.js +82 -0
- package/dist/conversion/impossible-field-read.d.ts +9 -0
- package/dist/conversion/impossible-field-read.js +28 -0
- package/dist/conversion/iterable-object-view.d.ts +1 -1
- package/dist/conversion/iterator-object-view.d.ts +2 -2
- package/dist/conversion/native-absence.d.ts +4 -0
- package/dist/conversion/native-absence.js +4 -0
- package/dist/conversion/native-buffer-method.d.ts +16 -0
- package/dist/conversion/native-buffer-method.js +37 -0
- package/dist/conversion/native-callable-adapter.d.ts +13 -0
- package/dist/conversion/native-callable-adapter.js +73 -0
- package/dist/conversion/native-descriptor-snapshot.d.ts +30 -0
- package/dist/conversion/native-descriptor-snapshot.js +75 -0
- package/dist/conversion/native-entry-writer.d.ts +21 -0
- package/dist/conversion/native-entry-writer.js +32 -0
- package/dist/conversion/native-field-view.d.ts +42 -0
- package/dist/conversion/native-field-view.js +145 -0
- package/dist/conversion/native-logical-receiver.d.ts +11 -0
- package/dist/conversion/native-logical-receiver.js +19 -0
- package/dist/conversion/native-method.d.ts +43 -0
- package/dist/conversion/native-method.js +56 -0
- package/dist/conversion/native-object-sample.d.ts +30 -0
- package/dist/conversion/native-object-sample.js +37 -0
- package/dist/conversion/native-payload-transport.d.ts +1 -1
- package/dist/conversion/native-payload-transport.js +1 -1
- package/dist/conversion/native-record-products.d.ts +15 -0
- package/dist/conversion/native-record-products.js +73 -0
- package/dist/conversion/native-selection.d.ts +18 -1
- package/dist/conversion/native-selection.js +117 -4
- package/dist/conversion/native-sum.d.ts +27 -0
- package/dist/conversion/native-sum.js +74 -9
- package/dist/conversion/native-view-origins.d.ts +12 -0
- package/dist/conversion/native-view-origins.js +97 -0
- package/dist/conversion/nodes.d.ts +75 -7
- package/dist/conversion/nodes.js +694 -19
- package/dist/conversion/number-storage.d.ts +8 -0
- package/dist/conversion/number-storage.js +8 -0
- package/dist/conversion/operand-view.js +10 -1
- package/dist/conversion/promise-adoption.d.ts +15 -0
- package/dist/conversion/promise-adoption.js +29 -0
- package/dist/conversion/protocol-iterator.d.ts +3 -3
- package/dist/conversion/recipe-closure.d.ts +14 -0
- package/dist/conversion/recipe-closure.js +135 -0
- package/dist/conversion/record-view.d.ts +51 -26
- package/dist/conversion/record-view.js +160 -97
- package/dist/conversion/registry.d.ts +18 -2
- package/dist/conversion/sibling-class.d.ts +4 -0
- package/dist/conversion/sibling-class.js +7 -0
- package/dist/conversion/structural-plan.d.ts +87 -0
- package/dist/conversion/structural-plan.js +480 -0
- package/dist/ir/absent-class-arm.d.ts +1 -1
- package/dist/ir/absent-class-arm.js +1 -1
- package/dist/ir/async-result-conventions.d.ts +15 -0
- package/dist/ir/async-result-conventions.js +140 -0
- package/dist/ir/borrowed-call-arguments.d.ts +3 -3
- package/dist/ir/borrowed-call-arguments.js +9 -9
- package/dist/ir/build.d.ts +20 -29
- package/dist/ir/build.js +116 -19
- package/dist/ir/call-dispatch.js +153 -40
- package/dist/ir/call-entry.d.ts +14 -3
- package/dist/ir/call-entry.js +63 -5
- package/dist/ir/callable-class-flow.d.ts +48 -3
- package/dist/ir/callable-class-flow.js +1509 -81
- package/dist/ir/callable-flow-candidates.d.ts +25 -0
- package/dist/ir/callable-flow-candidates.js +135 -0
- package/dist/ir/callable-identity-demand.d.ts +2 -2
- package/dist/ir/callable-identity-demand.js +33 -1
- package/dist/ir/callable-member-candidates.d.ts +1 -1
- package/dist/ir/callable-member-candidates.js +2 -2
- package/dist/ir/callable-records.js +1 -0
- package/dist/ir/callable-site-escape.js +3 -4
- package/dist/ir/captures.js +1 -1
- package/dist/ir/certificate.d.ts +1 -0
- package/dist/ir/certificate.js +2 -1
- package/dist/ir/certify/carrier-keys.d.ts +2 -2
- package/dist/ir/certify/carrier-keys.js +4 -4
- package/dist/ir/certify/has-property-key.d.ts +3 -3
- package/dist/ir/certify/has-property-key.js +3 -3
- package/dist/ir/certify/parallel-region.d.ts +26 -0
- package/dist/ir/certify/parallel-region.js +1331 -0
- package/dist/ir/certify/property-access-keys.d.ts +11 -11
- package/dist/ir/certify/property-access-keys.js +11 -11
- package/dist/ir/certify/property-access.js +7 -9
- package/dist/ir/certify.d.ts +66 -3
- package/dist/ir/certify.js +1197 -36
- package/dist/ir/class-allocation-domain.d.ts +9 -0
- package/dist/ir/class-allocation-domain.js +111 -0
- package/dist/ir/class-evaluation.d.ts +2 -3
- package/dist/ir/class-evaluation.js +2 -3
- package/dist/ir/class-static-fields.d.ts +12 -1
- package/dist/ir/class-static-fields.js +25 -0
- package/dist/ir/closed-normal-results.d.ts +18 -0
- package/dist/ir/closed-normal-results.js +208 -0
- package/dist/ir/construct-entry.js +1 -0
- package/dist/ir/construction-only-fields.d.ts +20 -1
- package/dist/ir/construction-only-fields.js +95 -9
- package/dist/ir/convert-carriers.d.ts +7 -0
- package/dist/ir/convert-carriers.js +12 -0
- package/dist/ir/coroutine-bodies.d.ts +74 -0
- package/dist/ir/coroutine-bodies.js +93 -0
- package/dist/ir/dead-logical-merge.d.ts +7 -0
- package/dist/ir/dead-logical-merge.js +84 -0
- package/dist/ir/dead-values.d.ts +7 -5
- package/dist/ir/dead-values.js +34 -5
- package/dist/ir/deferral.d.ts +3 -1
- package/dist/ir/deferral.js +19 -6
- package/dist/ir/dense-loops.d.ts +96 -7
- package/dist/ir/dense-loops.js +333 -17
- package/dist/ir/descriptor-own-protocol.d.ts +12 -0
- package/dist/ir/descriptor-own-protocol.js +35 -0
- package/dist/ir/dynamic-constructor-conversions.d.ts +17 -0
- package/dist/ir/dynamic-constructor-conversions.js +52 -0
- package/dist/ir/emission-representations.js +44 -2
- package/dist/ir/facts.d.ts +14 -2
- package/dist/ir/facts.js +23 -9
- package/dist/ir/fixed-data-definition-attributes.d.ts +10 -0
- package/dist/ir/fixed-data-definition-attributes.js +200 -0
- package/dist/ir/fixed-data-definition.d.ts +23 -5
- package/dist/ir/fixed-data-definition.js +80 -2
- package/dist/ir/function-reflection-demand.d.ts +11 -0
- package/dist/ir/function-reflection-demand.js +71 -0
- package/dist/ir/generic-call-entry.d.ts +18 -0
- package/dist/ir/generic-call-entry.js +94 -0
- package/dist/ir/hoist.d.ts +16 -3
- package/dist/ir/hoist.js +121 -8
- package/dist/ir/host-method-aliases.d.ts +15 -0
- package/dist/ir/host-method-aliases.js +61 -0
- package/dist/ir/host-namespace-reads.d.ts +24 -0
- package/dist/ir/host-namespace-reads.js +151 -0
- package/dist/ir/host-promise-conversions.d.ts +5 -0
- package/dist/ir/host-promise-conversions.js +61 -0
- package/dist/ir/host-template-conversions.d.ts +34 -0
- package/dist/ir/host-template-conversions.js +357 -0
- package/dist/ir/instance-reparenting.d.ts +3 -4
- package/dist/ir/instantiation.d.ts +1 -1
- package/dist/ir/instantiation.js +1 -1
- package/dist/ir/integer-storage.d.ts +19 -9
- package/dist/ir/integer-storage.js +158 -44
- package/dist/ir/integers.d.ts +34 -7
- package/dist/ir/integers.js +240 -7
- package/dist/ir/integrity-restrictions.d.ts +4 -4
- package/dist/ir/integrity-restrictions.js +7 -4
- package/dist/ir/internal-operation-conversions.d.ts +7 -0
- package/dist/ir/internal-operation-conversions.js +195 -0
- package/dist/ir/intrinsic-call-facts.d.ts +40 -0
- package/dist/ir/intrinsic-call-facts.js +176 -0
- package/dist/ir/key-order-observation.d.ts +1 -1
- package/dist/ir/lazy-splits.d.ts +20 -0
- package/dist/ir/lazy-splits.js +58 -0
- package/dist/ir/literal-set-membership.d.ts +2 -2
- package/dist/ir/literal-set-membership.js +2 -2
- package/dist/ir/logical-receivers.d.ts +15 -0
- package/dist/ir/logical-receivers.js +98 -0
- package/dist/ir/lower-allocation.js +16 -13
- package/dist/ir/lower-destructuring.js +7 -6
- package/dist/ir/lower-graph.d.ts +4 -4
- package/dist/ir/lower-graph.js +2 -2
- package/dist/ir/lower-invocation.d.ts +2 -2
- package/dist/ir/lower-invocation.js +99 -57
- package/dist/ir/lower-narrow.js +35 -13
- package/dist/ir/lower-operands.d.ts +40 -11
- package/dist/ir/lower-operands.js +206 -87
- package/dist/ir/lower-property.js +31 -8
- package/dist/ir/lower.js +9 -9
- package/dist/ir/merge-conversions.d.ts +18 -0
- package/dist/ir/merge-conversions.js +106 -0
- package/dist/ir/model.d.ts +138 -28
- package/dist/ir/native-accessor-definition.d.ts +104 -0
- package/dist/ir/native-accessor-definition.js +735 -0
- package/dist/ir/native-array-descriptor-snapshot.d.ts +45 -0
- package/dist/ir/native-array-descriptor-snapshot.js +380 -0
- package/dist/ir/native-array-insertion.d.ts +16 -0
- package/dist/ir/native-array-insertion.js +42 -0
- package/dist/ir/native-callable-argument.d.ts +38 -0
- package/dist/ir/native-callable-argument.js +128 -0
- package/dist/ir/native-callable-data-flow.d.ts +9 -0
- package/dist/ir/native-callable-data-flow.js +59 -0
- package/dist/ir/native-callable-data-owner.d.ts +45 -0
- package/dist/ir/native-callable-data-owner.js +755 -0
- package/dist/ir/native-callable-data-reads.d.ts +45 -0
- package/dist/ir/native-callable-data-reads.js +282 -0
- package/dist/ir/native-callable-data-slots.d.ts +78 -0
- package/dist/ir/native-callable-data-slots.js +403 -0
- package/dist/ir/native-callable-data-write.d.ts +58 -0
- package/dist/ir/native-callable-data-write.js +254 -0
- package/dist/ir/native-callable-integrity.d.ts +23 -0
- package/dist/ir/native-callable-integrity.js +77 -0
- package/dist/ir/native-callable-own-property.d.ts +42 -0
- package/dist/ir/native-callable-own-property.js +505 -0
- package/dist/ir/native-callable-prototype.d.ts +38 -0
- package/dist/ir/native-callable-prototype.js +307 -0
- package/dist/ir/native-callable-readonly-set.d.ts +25 -0
- package/dist/ir/native-callable-readonly-set.js +238 -0
- package/dist/ir/native-class-accessor.d.ts +3 -3
- package/dist/ir/native-class-accessor.js +3 -3
- package/dist/ir/native-class-construction.js +2 -2
- package/dist/ir/native-constructor-reads.d.ts +15 -0
- package/dist/ir/native-constructor-reads.js +156 -0
- package/dist/ir/native-constructor-static.d.ts +18 -0
- package/dist/ir/native-constructor-static.js +61 -0
- package/dist/ir/native-data-definition.d.ts +43 -0
- package/dist/ir/native-data-definition.js +222 -0
- package/dist/ir/native-document-array-entries.d.ts +15 -0
- package/dist/ir/native-document-array-entries.js +37 -0
- package/dist/ir/native-document-entries.d.ts +21 -0
- package/dist/ir/native-document-entries.js +74 -0
- package/dist/ir/native-entry-field-views.d.ts +18 -0
- package/dist/ir/native-entry-field-views.js +62 -0
- package/dist/ir/native-field-view-domains.d.ts +43 -0
- package/dist/ir/native-field-view-domains.js +300 -0
- package/dist/ir/native-field-view-facts.d.ts +97 -0
- package/dist/ir/native-field-view-facts.js +341 -0
- package/dist/ir/native-fixed-layout.js +1 -1
- package/dist/ir/native-host-construction.d.ts +4 -6
- package/dist/ir/native-host-construction.js +4 -6
- package/dist/ir/native-host-method-reads.d.ts +13 -0
- package/dist/ir/native-host-method-reads.js +53 -0
- package/dist/ir/native-iterator-field-views.d.ts +15 -0
- package/dist/ir/native-iterator-field-views.js +39 -0
- package/dist/ir/native-iterator-receivers.d.ts +8 -0
- package/dist/ir/native-iterator-receivers.js +59 -0
- package/dist/ir/native-logical-receiver-body.d.ts +8 -0
- package/dist/ir/native-logical-receiver-body.js +23 -0
- package/dist/ir/native-method-frames.d.ts +18 -0
- package/dist/ir/native-method-frames.js +127 -0
- package/dist/ir/native-method-read-source.d.ts +16 -0
- package/dist/ir/native-method-read-source.js +61 -0
- package/dist/ir/native-object-data-slots.d.ts +60 -0
- package/dist/ir/native-object-data-slots.js +493 -0
- package/dist/ir/native-object-sample.d.ts +32 -0
- package/dist/ir/native-object-sample.js +113 -0
- package/dist/ir/native-own-assignment.d.ts +123 -0
- package/dist/ir/native-own-assignment.js +529 -0
- package/dist/ir/native-property-coercibility.d.ts +3 -0
- package/dist/ir/native-property-coercibility.js +10 -0
- package/dist/ir/native-property-key-texts.d.ts +11 -0
- package/dist/ir/native-property-key-texts.js +41 -0
- package/dist/ir/native-property-presence-effects.d.ts +11 -0
- package/dist/ir/native-property-presence-effects.js +19 -0
- package/dist/ir/native-property-presence.d.ts +27 -0
- package/dist/ir/native-property-presence.js +275 -0
- package/dist/ir/native-prototype-calls.d.ts +19 -0
- package/dist/ir/native-prototype-calls.js +53 -0
- package/dist/ir/native-prototype-conversions.d.ts +5 -0
- package/dist/ir/native-prototype-conversions.js +46 -0
- package/dist/ir/native-prototype-presence-demand.d.ts +9 -0
- package/dist/ir/native-prototype-presence-demand.js +58 -0
- package/dist/ir/native-record-index.d.ts +1 -1
- package/dist/ir/native-union-method-targets.d.ts +8 -0
- package/dist/ir/native-union-method-targets.js +69 -0
- package/dist/ir/no-normal-call-completion.d.ts +15 -0
- package/dist/ir/no-normal-call-completion.js +184 -0
- package/dist/ir/non-normal-receiver.d.ts +39 -0
- package/dist/ir/non-normal-receiver.js +253 -0
- package/dist/ir/operation-conversions.d.ts +29 -0
- package/dist/ir/operation-conversions.js +484 -0
- package/dist/ir/operation-index.d.ts +1 -1
- package/dist/ir/presence-proof.d.ts +1 -1
- package/dist/ir/presence-proof.js +1 -0
- package/dist/ir/program-conversions.d.ts +48 -0
- package/dist/ir/program-conversions.js +221 -0
- package/dist/ir/program-facts.d.ts +4 -1
- package/dist/ir/program-facts.js +9 -7
- package/dist/ir/promise-reaction-conversions.d.ts +6 -0
- package/dist/ir/promise-reaction-conversions.js +92 -0
- package/dist/ir/property-read-conversions.d.ts +10 -0
- package/dist/ir/property-read-conversions.js +124 -0
- package/dist/ir/proven-branches.d.ts +2 -1
- package/dist/ir/proven-branches.js +97 -10
- package/dist/ir/publish-conversion-recipes.d.ts +27 -0
- package/dist/ir/publish-conversion-recipes.js +246 -0
- package/dist/ir/publish-native-field-view-facts.d.ts +17 -0
- package/dist/ir/publish-native-field-view-facts.js +119 -0
- package/dist/ir/queries.js +42 -4
- package/dist/ir/read-only-dictionary.d.ts +38 -0
- package/dist/ir/read-only-dictionary.js +281 -0
- package/dist/ir/reflection-demand.d.ts +2 -0
- package/dist/ir/reflection-demand.js +600 -44
- package/dist/ir/shake.d.ts +3 -0
- package/dist/ir/shake.js +24 -14
- package/dist/ir/shared-empty-records.js +1 -1
- package/dist/ir/short-circuit-threading.d.ts +23 -0
- package/dist/ir/short-circuit-threading.js +133 -0
- package/dist/ir/spread-conversions.d.ts +27 -0
- package/dist/ir/spread-conversions.js +134 -0
- package/dist/ir/spread-copy-elision.d.ts +2 -2
- package/dist/ir/spread-copy-elision.js +7 -4
- package/dist/ir/string-layout-reuse.d.ts +9 -8
- package/dist/ir/string-layout-reuse.js +8 -16
- package/dist/ir/string-length-reuse.d.ts +20 -4
- package/dist/ir/string-length-reuse.js +57 -13
- package/dist/ir/transfer.d.ts +5 -5
- package/dist/ir/transfer.js +53 -31
- package/dist/ir/typed-property-access.d.ts +2 -0
- package/dist/ir/typed-property-access.js +21 -8
- package/dist/ir/virtual-call-frames.d.ts +7 -0
- package/dist/ir/virtual-call-frames.js +8 -0
- package/dist/native-signatures.d.ts +45 -0
- package/dist/native-signatures.js +368 -0
- package/dist/plugins/gea/host.d.ts +6 -1
- package/dist/plugins/gea/host.js +30 -1
- package/dist/plugins/gea/lower.js +9 -3
- package/dist/plugins/gea/members.js +1 -1
- package/dist/plugins/gea/plugin.js +2 -1
- package/dist/plugins/gea/prelude.d.ts +1 -1
- package/dist/plugins/gea/prelude.js +1 -1
- package/dist/plugins/gea/reactive-slots.js +6 -6
- package/dist/plugins/gea/render-bridge.js +5 -6
- package/dist/plugins/gea/user-agent-styles.js +1 -1
- package/dist/plugins/installed.d.ts +2 -2
- package/dist/plugins/installed.js +2 -2
- package/dist/plugins/load.js +1 -1
- package/dist/plugins/model.d.ts +21 -36
- package/dist/plugins/webgl/host.d.ts +23 -23
- package/dist/plugins/webgl/host.js +25 -26
- package/dist/plugins/webgl/plugin.d.ts +16 -19
- package/dist/plugins/webgl/plugin.js +16 -23
- package/dist/project-preparation.js +12 -14
- package/dist/projection/abi.js +13 -10
- package/dist/projection/bindings.d.ts +8 -0
- package/dist/projection/bindings.js +36 -5
- package/dist/projection/callee.d.ts +17 -15
- package/dist/projection/callee.js +108 -81
- package/dist/projection/class-property-presence.d.ts +1 -1
- package/dist/projection/class-property-presence.js +1 -1
- package/dist/projection/classes.d.ts +2 -0
- package/dist/projection/classes.js +4 -1
- package/dist/projection/dispatch.d.ts +19 -3
- package/dist/projection/dispatch.js +39 -16
- package/dist/projection/fields.d.ts +14 -2
- package/dist/projection/fields.js +100 -38
- package/dist/projection/function-source.d.ts +5 -0
- package/dist/projection/function-source.js +15 -0
- package/dist/projection/immediate-callees.d.ts +12 -0
- package/dist/projection/immediate-callees.js +36 -0
- package/dist/projection/index-protocols.d.ts +12 -0
- package/dist/projection/index-protocols.js +39 -0
- package/dist/projection/instance-test.d.ts +8 -0
- package/dist/projection/instance-test.js +3 -1
- package/dist/projection/method-values.d.ts +7 -0
- package/dist/projection/method-values.js +29 -0
- package/dist/projection/native-accessor-access.d.ts +26 -0
- package/dist/projection/native-accessor-access.js +18 -0
- package/dist/projection/native-callable-data.d.ts +24 -0
- package/dist/projection/native-callable-data.js +101 -0
- package/dist/projection/native-expando.d.ts +3 -0
- package/dist/projection/native-expando.js +13 -0
- package/dist/projection/native-object-data.d.ts +47 -0
- package/dist/projection/native-object-data.js +203 -0
- package/dist/projection/native-prototype-methods.d.ts +22 -0
- package/dist/projection/native-prototype-methods.js +161 -0
- package/dist/projection/regexp-fields.d.ts +35 -0
- package/dist/projection/regexp-fields.js +80 -0
- package/dist/projection/slots.d.ts +5 -1
- package/dist/projection/slots.js +89 -10
- package/dist/representation/derive.d.ts +5 -7
- package/dist/representation/derive.js +78 -78
- package/dist/representation/difference.js +1 -1
- package/dist/representation/host-abi.d.ts +2 -2
- package/dist/representation/host-abi.js +4 -5
- package/dist/representation/host-templates.d.ts +6 -2
- package/dist/representation/host-templates.js +8 -2
- package/dist/representation/intersection.d.ts +3 -3
- package/dist/representation/intersection.js +3 -3
- package/dist/representation/merge.js +1 -1
- package/dist/representation/model.d.ts +27 -22
- package/dist/representation/model.js +35 -22
- package/dist/representation/native-callable-data-storage.d.ts +85 -0
- package/dist/representation/native-callable-data-storage.js +398 -0
- package/dist/representation/native-data-properties.d.ts +14 -0
- package/dist/representation/native-data-properties.js +52 -0
- package/dist/representation/native-logical-receiver.d.ts +36 -0
- package/dist/representation/native-logical-receiver.js +92 -0
- package/dist/representation/object-shape.d.ts +1 -1
- package/dist/representation/object-shape.js +1 -1
- package/dist/representation/optional.js +2 -2
- package/dist/representation/physical-carrier.d.ts +25 -0
- package/dist/representation/physical-carrier.js +153 -0
- package/dist/representation/policies.d.ts +16 -10
- package/dist/representation/policies.js +5 -1
- package/dist/representation/primitives.js +3 -0
- package/dist/representation/promise-resolution.d.ts +19 -0
- package/dist/representation/promise-resolution.js +50 -0
- package/dist/representation/prototype-domains.d.ts +43 -0
- package/dist/representation/prototype-domains.js +226 -0
- package/dist/representation/proxy-carriers.d.ts +3 -3
- package/dist/representation/proxy-carriers.js +2 -3
- package/dist/representation/publish.d.ts +4 -0
- package/dist/representation/publish.js +73 -42
- package/dist/representation/record-fields.d.ts +2 -2
- package/dist/representation/record-fields.js +2 -2
- package/dist/representation/static-field-cells.d.ts +1 -1
- package/dist/representation/structural-method-abi.d.ts +6 -0
- package/dist/representation/structural-method-abi.js +13 -0
- package/dist/representation/unassigned-binding-cells.d.ts +3 -3
- package/dist/representation/union.js +19 -4
- package/dist/representation/unwritten-record-members.d.ts +6 -6
- package/dist/representation/unwritten-record-members.js +1 -1
- package/dist/representation/value-records.js +77 -5
- package/dist/representation/verify.js +1 -1
- package/dist/representation/well-known-symbols.d.ts +3 -0
- package/dist/representation/well-known-symbols.js +11 -0
- package/dist/semantics/alias-this-field-declaration-transform.js +3 -3
- package/dist/semantics/ambient-type-realization-transform.d.ts +19 -20
- package/dist/semantics/ambient-type-realization-transform.js +20 -12
- package/dist/semantics/ambient.d.ts +13 -13
- package/dist/semantics/ambient.js +12 -12
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.d.ts +5 -0
- package/dist/semantics/borrowed-builtin-call-bind-source-transform.js +110 -52
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.d.ts +4 -4
- package/dist/semantics/borrowed-method-receiver-copy-source-transform.js +4 -4
- package/dist/semantics/call-invalidated-narrowing.js +2 -2
- package/dist/semantics/callable-origins.d.ts +49 -1
- package/dist/semantics/callable-origins.js +148 -32
- package/dist/semantics/callable-own-data-slots.d.ts +122 -0
- package/dist/semantics/callable-own-data-slots.js +421 -0
- package/dist/semantics/class-alias.d.ts +4 -4
- package/dist/semantics/class-alias.js +4 -4
- package/dist/semantics/class-heritage.d.ts +8 -7
- package/dist/semantics/class-heritage.js +8 -7
- package/dist/semantics/commonjs-wrapper.js +5 -2
- package/dist/semantics/constructor-function-class-source-transform.js +2 -3
- package/dist/semantics/constructor-slot-subclasses.d.ts +1 -1
- package/dist/semantics/constructor-slot-subclasses.js +5 -5
- package/dist/semantics/declaration-overlay-transform.d.ts +9 -12
- package/dist/semantics/declaration-overlay-transform.js +135 -142
- package/dist/semantics/declared-integers.d.ts +24 -0
- package/dist/semantics/declared-integers.js +34 -0
- package/dist/semantics/define-property-source-transform.js +21 -8
- package/dist/semantics/dynamic-fallback.d.ts +1 -1
- package/dist/semantics/dynamic-fallback.js +1 -1
- package/dist/semantics/frontend.d.ts +12 -16
- package/dist/semantics/frontend.js +187 -75
- package/dist/semantics/host-methods.d.ts +3 -3
- package/dist/semantics/host-methods.js +1 -1
- package/dist/semantics/host-protocols.d.ts +3 -3
- package/dist/semantics/host-protocols.js +26 -26
- package/dist/semantics/interface-families.d.ts +2 -2
- package/dist/semantics/interface-families.js +46 -47
- package/dist/semantics/interface-implementors.d.ts +12 -15
- package/dist/semantics/interface-implementors.js +12 -15
- package/dist/semantics/jsdoc-namepath-transform.js +7 -7
- package/dist/semantics/model/operands.d.ts +18 -3
- package/dist/semantics/model/operands.js +41 -0
- package/dist/semantics/model/operations.d.ts +82 -1
- package/dist/semantics/model/selected-signature.d.ts +24 -3
- package/dist/semantics/model/structural-type-table.js +24 -6
- package/dist/semantics/model/structural-types.d.ts +10 -8
- package/dist/semantics/model/structural-types.js +7 -5
- package/dist/semantics/module-resolution.js +3 -2
- package/dist/semantics/native-callable-readonly-set.d.ts +17 -0
- package/dist/semantics/native-callable-readonly-set.js +1 -0
- package/dist/semantics/native-function-signatures.d.ts +14 -0
- package/dist/semantics/native-function-signatures.js +96 -0
- package/dist/semantics/native-object-data-slots.d.ts +72 -0
- package/dist/semantics/native-object-data-slots.js +679 -0
- package/dist/semantics/native-own-assignment.d.ts +62 -0
- package/dist/semantics/native-own-assignment.js +1 -0
- package/dist/semantics/normalize/absent-globals.d.ts +8 -8
- package/dist/semantics/normalize/absent-globals.js +5 -5
- package/dist/semantics/normalize/arguments-objects.d.ts +3 -1
- package/dist/semantics/normalize/arguments-objects.js +1 -1
- package/dist/semantics/normalize/asserted-argument-arms.d.ts +7 -7
- package/dist/semantics/normalize/asserted-arm-absence.d.ts +1 -2
- package/dist/semantics/normalize/asserted-arm-absence.js +1 -2
- package/dist/semantics/normalize/binding-fixpoint.js +3 -3
- package/dist/semantics/normalize/bivariant-slot-parameter.d.ts +2 -2
- package/dist/semantics/normalize/bivariant-slot-parameter.js +6 -6
- package/dist/semantics/normalize/callable-data-write.d.ts +46 -0
- package/dist/semantics/normalize/callable-data-write.js +182 -0
- package/dist/semantics/normalize/census.js +5 -5
- package/dist/semantics/normalize/class-instance-record-statement.d.ts +1 -1
- package/dist/semantics/normalize/class-instance-record-statement.js +1 -1
- package/dist/semantics/normalize/collection-bindings.d.ts +11 -13
- package/dist/semantics/normalize/collection-bindings.js +60 -33
- package/dist/semantics/normalize/commonjs-module-record.d.ts +7 -4
- package/dist/semantics/normalize/commonjs-module-record.js +93 -4
- package/dist/semantics/normalize/contribution.js +4 -4
- package/dist/semantics/normalize/dead-method-copies.d.ts +5 -5
- package/dist/semantics/normalize/dead-typeof-guards.d.ts +2 -2
- package/dist/semantics/normalize/dead-typeof-guards.js +6 -6
- package/dist/semantics/normalize/deferred-intrinsic-protocols.d.ts +22 -13
- package/dist/semantics/normalize/deferred-intrinsic-protocols.js +85 -13
- package/dist/semantics/normalize/derived-expression-type.d.ts +129 -91
- package/dist/semantics/normalize/derived-expression-type.js +419 -192
- package/dist/semantics/normalize/field-bindings.d.ts +4 -4
- package/dist/semantics/normalize/field-bindings.js +334 -67
- package/dist/semantics/normalize/flow/array-element-continuation.d.ts +2 -2
- package/dist/semantics/normalize/flow/array-element-continuation.js +35 -18
- package/dist/semantics/normalize/flow/callable-array-origins.d.ts +1 -1
- package/dist/semantics/normalize/flow/callable-array-origins.js +3 -3
- package/dist/semantics/normalize/flow/callable-completions.d.ts +2 -2
- package/dist/semantics/normalize/flow/callable-completions.js +2 -2
- package/dist/semantics/normalize/flow/callable-reach.d.ts +19 -6
- package/dist/semantics/normalize/flow/callable-reach.js +722 -289
- package/dist/semantics/normalize/flow/class-family-member-read.js +24 -29
- package/dist/semantics/normalize/flow/collection-value-continuation.d.ts +2 -2
- package/dist/semantics/normalize/flow/collection-value-continuation.js +2 -2
- package/dist/semantics/normalize/flow/component-solver.d.ts +19 -16
- package/dist/semantics/normalize/flow/component-solver.js +138 -69
- package/dist/semantics/normalize/flow/computed-key-set.d.ts +6 -7
- package/dist/semantics/normalize/flow/computed-key-set.js +20 -1
- package/dist/semantics/normalize/flow/export-importers.js +4 -4
- package/dist/semantics/normalize/flow/host-text-sink.d.ts +3 -2
- package/dist/semantics/normalize/flow/host-text-sink.js +4 -3
- package/dist/semantics/normalize/flow/intrinsic-array-callback-frames.js +3 -2
- package/dist/semantics/normalize/flow/intrinsic-data-definition.d.ts +2 -2
- package/dist/semantics/normalize/flow/intrinsic-data-definition.js +3 -3
- package/dist/semantics/normalize/flow/invocation-facts.d.ts +3 -2
- package/dist/semantics/normalize/flow/invocation-facts.js +3 -3
- package/dist/semantics/normalize/flow/member-call-forwarding.d.ts +12 -6
- package/dist/semantics/normalize/flow/member-call-forwarding.js +94 -21
- package/dist/semantics/normalize/flow/model.d.ts +5 -5
- package/dist/semantics/normalize/flow/model.js +11 -11
- package/dist/semantics/normalize/flow/node-path-token.js +3 -3
- package/dist/semantics/normalize/flow/origin-authority.d.ts +3 -3
- package/dist/semantics/normalize/flow/owned-class-receivers.js +8 -7
- package/dist/semantics/normalize/flow/parameter-values.js +6 -6
- package/dist/semantics/normalize/flow/proof-hypotheses.d.ts +30 -4
- package/dist/semantics/normalize/flow/proof-hypotheses.js +56 -5
- package/dist/semantics/normalize/flow/proof-memo-settlement.d.ts +21 -0
- package/dist/semantics/normalize/flow/proof-memo-settlement.js +32 -0
- package/dist/semantics/normalize/flow/record-alias-closure.d.ts +1 -1
- package/dist/semantics/normalize/flow/record-alias-closure.js +1 -1
- package/dist/semantics/normalize/flow/seeded-origins.d.ts +4 -4
- package/dist/semantics/normalize/flow/seeded-origins.js +4 -4
- package/dist/semantics/normalize/flow/source-accessor-descriptor.d.ts +22 -0
- package/dist/semantics/normalize/flow/source-accessor-descriptor.js +210 -0
- package/dist/semantics/normalize/flow/source-callable-own-data.d.ts +33 -0
- package/dist/semantics/normalize/flow/source-callable-own-data.js +238 -0
- package/dist/semantics/normalize/flow/source-callable-readonly-set.d.ts +26 -0
- package/dist/semantics/normalize/flow/source-callable-readonly-set.js +337 -0
- package/dist/semantics/normalize/flow/source-class-data.d.ts +7 -7
- package/dist/semantics/normalize/flow/source-class-data.js +25 -26
- package/dist/semantics/normalize/flow/source-class-static-data.d.ts +2 -2
- package/dist/semantics/normalize/flow/source-class-static-data.js +2 -2
- package/dist/semantics/normalize/flow/source-commonjs-exports.d.ts +15 -0
- package/dist/semantics/normalize/flow/source-commonjs-exports.js +7 -0
- package/dist/semantics/normalize/flow/source-descriptor-protocol.d.ts +20 -0
- package/dist/semantics/normalize/flow/source-descriptor-protocol.js +75 -0
- package/dist/semantics/normalize/flow/source-executing-parameter-values.d.ts +8 -0
- package/dist/semantics/normalize/flow/source-executing-parameter-values.js +93 -0
- package/dist/semantics/normalize/flow/source-global-binding.d.ts +13 -0
- package/dist/semantics/normalize/flow/source-global-binding.js +42 -0
- package/dist/semantics/normalize/flow/source-intrinsic-member-data.d.ts +27 -0
- package/dist/semantics/normalize/flow/source-intrinsic-member-data.js +178 -0
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.d.ts +1 -1
- package/dist/semantics/normalize/flow/source-invocation-frame-layout.js +31 -11
- package/dist/semantics/normalize/flow/source-invocation-receiver.d.ts +7 -3
- package/dist/semantics/normalize/flow/source-invocation-receiver.js +30 -2
- package/dist/semantics/normalize/flow/source-native-class-alias.d.ts +7 -0
- package/dist/semantics/normalize/flow/source-native-class-alias.js +91 -0
- package/dist/semantics/normalize/flow/source-normal-predecessor.d.ts +10 -0
- package/dist/semantics/normalize/flow/source-normal-predecessor.js +90 -0
- package/dist/semantics/normalize/flow/source-property-key.d.ts +3 -0
- package/dist/semantics/normalize/flow/source-property-key.js +7 -0
- package/dist/semantics/normalize/flow/source-read-protocol.d.ts +20 -0
- package/dist/semantics/normalize/flow/source-read-protocol.js +108 -0
- package/dist/semantics/normalize/flow/source-record-data.js +31 -30
- package/dist/semantics/normalize/flow/source-value-session.d.ts +106 -3
- package/dist/semantics/normalize/flow/source-value-session.js +1172 -218
- package/dist/semantics/normalize/flow/standard-prototype-method-source.d.ts +16 -0
- package/dist/semantics/normalize/flow/standard-prototype-method-source.js +64 -0
- package/dist/semantics/normalize/flow/targets.d.ts +13 -14
- package/dist/semantics/normalize/flow/targets.js +20 -23
- package/dist/semantics/normalize/flow/value-flow.d.ts +2 -4
- package/dist/semantics/normalize/flow/value-flow.js +4 -13
- package/dist/semantics/normalize/flow/value-provenance.d.ts +23 -3
- package/dist/semantics/normalize/flow/value-provenance.js +44 -4
- package/dist/semantics/normalize/fresh-dictionary-storage.d.ts +32 -0
- package/dist/semantics/normalize/fresh-dictionary-storage.js +530 -0
- package/dist/semantics/normalize/fresh-indexed-storage.d.ts +43 -0
- package/dist/semantics/normalize/fresh-indexed-storage.js +88 -0
- package/dist/semantics/normalize/fresh-ordinary-object.d.ts +8 -0
- package/dist/semantics/normalize/fresh-ordinary-object.js +27 -0
- package/dist/semantics/normalize/gating.js +2 -2
- package/dist/semantics/normalize/global-host-mutations.js +770 -261
- package/dist/semantics/normalize/host-effect-contracts.d.ts +1 -1
- package/dist/semantics/normalize/host-effect-contracts.js +1 -1
- package/dist/semantics/normalize/host-mutation-computed-keys.d.ts +2 -2
- package/dist/semantics/normalize/host-mutation-computed-keys.js +8 -0
- package/dist/semantics/normalize/host-mutation-key-reader.d.ts +6 -11
- package/dist/semantics/normalize/host-mutation-key-reader.js +11 -28
- package/dist/semantics/normalize/host-mutation-keys.d.ts +11 -7
- package/dist/semantics/normalize/host-mutation-keys.js +26 -15
- package/dist/semantics/normalize/identities.js +20 -17
- package/dist/semantics/normalize/implicit-arguments-tuple.d.ts +8 -3
- package/dist/semantics/normalize/implicit-arguments-tuple.js +21 -4
- package/dist/semantics/normalize/installed-global-properties.d.ts +17 -0
- package/dist/semantics/normalize/installed-global-properties.js +214 -0
- package/dist/semantics/normalize/instantiation.js +6 -6
- package/dist/semantics/normalize/intrinsic-accessor-getter.d.ts +1 -1
- package/dist/semantics/normalize/intrinsic-property-call.d.ts +6 -1
- package/dist/semantics/normalize/intrinsic-property-call.js +19 -0
- package/dist/semantics/normalize/intrinsic-prototype.d.ts +7 -0
- package/dist/semantics/normalize/intrinsic-prototype.js +10 -0
- package/dist/semantics/normalize/intrinsic-return-identity.d.ts +5 -0
- package/dist/semantics/normalize/intrinsic-return-identity.js +29 -0
- package/dist/semantics/normalize/jsdoc-type-names.js +59 -63
- package/dist/semantics/normalize/keyof.js +3 -3
- package/dist/semantics/normalize/local-bindings.d.ts +4 -4
- package/dist/semantics/normalize/local-bindings.js +60 -61
- package/dist/semantics/normalize/logical-object-truthiness.d.ts +8 -0
- package/dist/semantics/normalize/logical-object-truthiness.js +20 -0
- package/dist/semantics/normalize/merged-declaration.d.ts +3 -3
- package/dist/semantics/normalize/merged-declaration.js +3 -3
- package/dist/semantics/normalize/never-override-result.d.ts +2 -3
- package/dist/semantics/normalize/never-override-result.js +2 -3
- package/dist/semantics/normalize/null-blind-parameter.d.ts +2 -2
- package/dist/semantics/normalize/null-blind-parameter.js +2 -2
- package/dist/semantics/normalize/object-bag-bindings.d.ts +19 -19
- package/dist/semantics/normalize/object-bag-bindings.js +334 -141
- package/dist/semantics/normalize/omitted-stated-parameter.d.ts +8 -8
- package/dist/semantics/normalize/omitted-stated-parameter.js +8 -9
- package/dist/semantics/normalize/override-field-arms.d.ts +3 -3
- package/dist/semantics/normalize/override-field-arms.js +15 -16
- package/dist/semantics/normalize/parameter-bindings.d.ts +13 -12
- package/dist/semantics/normalize/parameter-bindings.js +173 -139
- package/dist/semantics/normalize/parameter-slot.d.ts +9 -10
- package/dist/semantics/normalize/parameter-slot.js +16 -17
- package/dist/semantics/normalize/physical-overload-result.d.ts +8 -8
- package/dist/semantics/normalize/physical-overload-result.js +10 -10
- package/dist/semantics/normalize/producer-context.d.ts +27 -12
- package/dist/semantics/normalize/producers/allocations.js +5 -1
- package/dist/semantics/normalize/producers/bindings.js +8 -7
- package/dist/semantics/normalize/producers/class-lifecycle.js +52 -7
- package/dist/semantics/normalize/producers/computations.js +27 -3
- package/dist/semantics/normalize/producers/control.js +5 -5
- package/dist/semantics/normalize/producers/declaration-lifecycle.js +4 -4
- package/dist/semantics/normalize/producers/destructuring.js +10 -5
- package/dist/semantics/normalize/producers/erasure.d.ts +9 -0
- package/dist/semantics/normalize/producers/erasure.js +22 -0
- package/dist/semantics/normalize/producers/invocations.d.ts +1 -1
- package/dist/semantics/normalize/producers/invocations.js +200 -55
- package/dist/semantics/normalize/producers/logical-merge-type.d.ts +2 -2
- package/dist/semantics/normalize/producers/logical-merge-type.js +12 -12
- package/dist/semantics/normalize/producers/native-callable-readonly-set.d.ts +6 -0
- package/dist/semantics/normalize/producers/native-callable-readonly-set.js +24 -0
- package/dist/semantics/normalize/producers/native-own-assignment.d.ts +14 -0
- package/dist/semantics/normalize/producers/native-own-assignment.js +153 -0
- package/dist/semantics/normalize/producers/properties.js +153 -20
- package/dist/semantics/normalize/producers/protocol.js +4 -4
- package/dist/semantics/normalize/producers/references.js +21 -19
- package/dist/semantics/normalize/producers/shared.d.ts +1 -1
- package/dist/semantics/normalize/producers/shared.js +59 -58
- package/dist/semantics/normalize/producers/spread-arguments.js +7 -3
- package/dist/semantics/normalize/producers/tuple-spread.d.ts +2 -2
- package/dist/semantics/normalize/producers/tuple-spread.js +5 -5
- package/dist/semantics/normalize/property-key-domain.d.ts +6 -6
- package/dist/semantics/normalize/property-key-domain.js +7 -7
- package/dist/semantics/normalize/reachability.d.ts +6 -7
- package/dist/semantics/normalize/reachability.js +60 -62
- package/dist/semantics/normalize/record-home-arms.js +2 -3
- package/dist/semantics/normalize/record-link-families.d.ts +1 -1
- package/dist/semantics/normalize/record-link-families.js +1 -1
- package/dist/semantics/normalize/record-stand-in-arms.d.ts +4 -5
- package/dist/semantics/normalize/return-bindings.d.ts +19 -9
- package/dist/semantics/normalize/return-bindings.js +49 -41
- package/dist/semantics/normalize/script-global-redefinition.d.ts +1 -1
- package/dist/semantics/normalize/script-global-redefinition.js +1 -1
- package/dist/semantics/normalize/shared-array-storage.d.ts +4 -5
- package/dist/semantics/normalize/shared-array-storage.js +7 -8
- package/dist/semantics/normalize/sloppy-absence.d.ts +6 -3
- package/dist/semantics/normalize/sloppy-absence.js +7 -3
- package/dist/semantics/normalize/source-object-prototype-absence.d.ts +7 -0
- package/dist/semantics/normalize/source-object-prototype-absence.js +19 -0
- package/dist/semantics/normalize/specialization.d.ts +10 -10
- package/dist/semantics/normalize/specialization.js +107 -112
- package/dist/semantics/normalize/specialized-source-frames.d.ts +11 -0
- package/dist/semantics/normalize/specialized-source-frames.js +41 -0
- package/dist/semantics/normalize/structural-array-element.d.ts +5 -5
- package/dist/semantics/normalize/structural-array-element.js +40 -39
- package/dist/semantics/normalize/structural-array-read.js +3 -3
- package/dist/semantics/normalize/structural-callable.d.ts +15 -1
- package/dist/semantics/normalize/structural-callable.js +35 -3
- package/dist/semantics/normalize/structural-creation-order.d.ts +2 -2
- package/dist/semantics/normalize/structural-declarations.d.ts +22 -21
- package/dist/semantics/normalize/structural-declarations.js +42 -42
- package/dist/semantics/normalize/structural-declared-body.js +10 -11
- package/dist/semantics/normalize/structural-indexed-access.js +2 -2
- package/dist/semantics/normalize/structural-instantiated-member.d.ts +9 -10
- package/dist/semantics/normalize/structural-instantiated-member.js +43 -30
- package/dist/semantics/normalize/structural-joins.d.ts +4 -16
- package/dist/semantics/normalize/structural-joins.js +5 -65
- package/dist/semantics/normalize/structural-layout-relevance.d.ts +5 -5
- package/dist/semantics/normalize/structural-layout-relevance.js +22 -23
- package/dist/semantics/normalize/structural-layout-type.d.ts +1 -1
- package/dist/semantics/normalize/structural-layout-type.js +140 -107
- package/dist/semantics/normalize/structural-local-union.d.ts +1 -1
- package/dist/semantics/normalize/structural-local-union.js +38 -12
- package/dist/semantics/normalize/structural-mutable-field.d.ts +9 -0
- package/dist/semantics/normalize/structural-mutable-field.js +152 -0
- package/dist/semantics/normalize/structural-parts.d.ts +6 -0
- package/dist/semantics/normalize/structural-parts.js +35 -32
- package/dist/semantics/normalize/structural-receiver.d.ts +3 -3
- package/dist/semantics/normalize/structural-receiver.js +12 -13
- package/dist/semantics/normalize/structural-self-reference.d.ts +12 -11
- package/dist/semantics/normalize/structural-self-reference.js +24 -25
- package/dist/semantics/normalize/structural.d.ts +13 -3
- package/dist/semantics/normalize/structural.js +400 -201
- package/dist/semantics/normalize/suppressed-write-arms.d.ts +10 -11
- package/dist/semantics/normalize/symbol-keyed-this-slots.d.ts +6 -6
- package/dist/semantics/normalize/symbol-keyed-this-slots.js +4 -4
- package/dist/semantics/normalize/unresolvable-names.d.ts +2 -3
- package/dist/semantics/normalize/unresolvable-names.js +2 -2
- package/dist/semantics/normalize/unshared-array-result.d.ts +4 -4
- package/dist/semantics/normalize/unshared-array-result.js +4 -4
- package/dist/semantics/package-sources.js +2 -3
- package/dist/semantics/program.d.ts +10 -13
- package/dist/semantics/program.js +80 -26
- package/dist/semantics/property-key.d.ts +9 -0
- package/dist/semantics/property-key.js +25 -0
- package/dist/semantics/prototype-object-class-source-transform.js +2 -2
- package/dist/semantics/prototype-reparenting.d.ts +1 -1
- package/dist/semantics/prototype-reparenting.js +1 -1
- package/dist/semantics/shared-declaration-files.d.ts +6 -1
- package/dist/semantics/shared-declaration-files.js +2 -2
- package/dist/semantics/source-transform-protocol.d.ts +26 -0
- package/dist/semantics/source-transform-protocol.js +1 -0
- package/dist/semantics/stable-checker.js +9 -13
- package/dist/semantics/subclass-member-overlay-transform.d.ts +2 -2
- package/dist/semantics/subclass-member-overlay-transform.js +89 -88
- package/dist/semantics/this-constructor-source-transform.js +2 -2
- package/dist/semantics/unchecked-guard-argument-copies.d.ts +3 -3
- package/dist/semantics/unchecked-write-member-declarations.d.ts +9 -11
- package/dist/semantics/unchecked-write-member-declarations.js +11 -13
- package/dist/semantics/uninstantiable-classes.d.ts +1 -1
- package/dist/semantics/uninstantiable-classes.js +1 -1
- package/dist/targets/cpp/balanced-units.d.ts +1 -1
- package/dist/targets/cpp/balanced-units.js +1 -1
- package/dist/targets/cpp/borrowed-arm-projections.d.ts +2 -3
- package/dist/targets/cpp/borrowed-arm-projections.js +2 -3
- package/dist/targets/cpp/borrowed-call-entry.js +3 -3
- package/dist/targets/cpp/captures.d.ts +2 -2
- package/dist/targets/cpp/captures.js +4 -4
- package/dist/targets/cpp/char-code-buffers.d.ts +1 -1
- package/dist/targets/cpp/char-code-buffers.js +4 -1
- package/dist/targets/cpp/class-layout.d.ts +7 -17
- package/dist/targets/cpp/class-layout.js +6 -13
- package/dist/targets/cpp/class-properties/computed-method-value.d.ts +1 -1
- package/dist/targets/cpp/class-properties/computed-method-value.js +5 -27
- package/dist/targets/cpp/class-properties/emit-class-properties.d.ts +49 -59
- package/dist/targets/cpp/class-properties/emit-class-properties.js +68 -232
- package/dist/targets/cpp/class-properties/native-method-read.d.ts +5 -0
- package/dist/targets/cpp/class-properties/native-method-read.js +60 -0
- package/dist/targets/cpp/class-properties/native-prototype.d.ts +3 -1
- package/dist/targets/cpp/class-properties/native-prototype.js +5 -6
- package/dist/targets/cpp/class-ref-transport.d.ts +1 -11
- package/dist/targets/cpp/class-ref-transport.js +1 -9
- package/dist/targets/cpp/conversions.js +613 -252
- package/dist/targets/cpp/coroutine-bodies.d.ts +1 -97
- package/dist/targets/cpp/coroutine-bodies.js +1 -187
- package/dist/targets/cpp/document.js +1 -1
- package/dist/targets/cpp/emit-allocation.d.ts +0 -38
- package/dist/targets/cpp/emit-allocation.js +63 -88
- package/dist/targets/cpp/emit-array-view.d.ts +7 -0
- package/dist/targets/cpp/emit-array-view.js +47 -0
- package/dist/targets/cpp/emit-arrays.d.ts +9 -52
- package/dist/targets/cpp/emit-arrays.js +177 -113
- package/dist/targets/cpp/emit-binding-reference.d.ts +10 -0
- package/dist/targets/cpp/emit-binding-reference.js +19 -1
- package/dist/targets/cpp/emit-bindings.js +19 -24
- package/dist/targets/cpp/emit-buffers.d.ts +8 -4
- package/dist/targets/cpp/emit-buffers.js +88 -47
- package/dist/targets/cpp/emit-callable-view.d.ts +6 -0
- package/dist/targets/cpp/emit-callable-view.js +133 -0
- package/dist/targets/cpp/emit-callable.d.ts +11 -1
- package/dist/targets/cpp/emit-callable.js +225 -266
- package/dist/targets/cpp/emit-carrier-members.d.ts +2 -2
- package/dist/targets/cpp/emit-carrier-members.js +42 -35
- package/dist/targets/cpp/emit-certified-conversion.d.ts +7 -0
- package/dist/targets/cpp/emit-certified-conversion.js +27 -0
- package/dist/targets/cpp/emit-context.d.ts +123 -64
- package/dist/targets/cpp/emit-context.js +147 -44
- package/dist/targets/cpp/emit-descriptor-snapshot.d.ts +10 -0
- package/dist/targets/cpp/emit-descriptor-snapshot.js +60 -0
- package/dist/targets/cpp/emit-dictionary-view.d.ts +6 -0
- package/dist/targets/cpp/emit-dictionary-view.js +102 -0
- package/dist/targets/cpp/emit-document-record-view.d.ts +3 -0
- package/dist/targets/cpp/emit-document-record-view.js +104 -0
- package/dist/targets/cpp/emit-dynamic-properties.d.ts +42 -17
- package/dist/targets/cpp/emit-dynamic-properties.js +118 -72
- package/dist/targets/cpp/emit-equality.d.ts +2 -1
- package/dist/targets/cpp/emit-equality.js +65 -45
- package/dist/targets/cpp/emit-exceptions.js +1 -1
- package/dist/targets/cpp/emit-in.js +22 -11
- package/dist/targets/cpp/emit-instanceof.js +15 -14
- package/dist/targets/cpp/emit-integers.d.ts +40 -3
- package/dist/targets/cpp/emit-integers.js +76 -5
- package/dist/targets/cpp/emit-iterable-object-view.d.ts +2 -0
- package/dist/targets/cpp/emit-iterable-object-view.js +15 -11
- package/dist/targets/cpp/emit-iterator-object-view.d.ts +2 -0
- package/dist/targets/cpp/emit-iterator-object-view.js +24 -16
- package/dist/targets/cpp/emit-iterator.d.ts +2 -0
- package/dist/targets/cpp/emit-iterator.js +115 -43
- package/dist/targets/cpp/emit-json.js +6 -6
- package/dist/targets/cpp/emit-jsx.js +2 -2
- package/dist/targets/cpp/emit-live-field-view.d.ts +26 -0
- package/dist/targets/cpp/emit-live-field-view.js +50 -0
- package/dist/targets/cpp/emit-narrowing.d.ts +60 -139
- package/dist/targets/cpp/emit-narrowing.js +694 -624
- package/dist/targets/cpp/emit-native-accessor-definition.d.ts +10 -0
- package/dist/targets/cpp/emit-native-accessor-definition.js +94 -0
- package/dist/targets/cpp/emit-native-callable-data.d.ts +23 -0
- package/dist/targets/cpp/emit-native-callable-data.js +117 -0
- package/dist/targets/cpp/emit-native-document-entry.d.ts +4 -0
- package/dist/targets/cpp/emit-native-document-entry.js +52 -0
- package/dist/targets/cpp/emit-native-field-view.d.ts +26 -0
- package/dist/targets/cpp/emit-native-field-view.js +217 -0
- package/dist/targets/cpp/emit-native-method.d.ts +16 -0
- package/dist/targets/cpp/emit-native-method.js +90 -0
- package/dist/targets/cpp/emit-native-object-data.d.ts +7 -0
- package/dist/targets/cpp/emit-native-object-data.js +66 -0
- package/dist/targets/cpp/emit-native-object-sample.d.ts +8 -0
- package/dist/targets/cpp/emit-native-object-sample.js +34 -0
- package/dist/targets/cpp/emit-native-own-assignment.d.ts +7 -0
- package/dist/targets/cpp/emit-native-own-assignment.js +119 -0
- package/dist/targets/cpp/emit-native-selection.d.ts +2 -2
- package/dist/targets/cpp/emit-native-selection.js +14 -5
- package/dist/targets/cpp/emit-number-storage.d.ts +2 -0
- package/dist/targets/cpp/emit-number-storage.js +1 -0
- package/dist/targets/cpp/emit-presence.d.ts +3 -4
- package/dist/targets/cpp/emit-presence.js +43 -21
- package/dist/targets/cpp/emit-properties.js +224 -111
- package/dist/targets/cpp/emit-protocol-iterator.d.ts +2 -0
- package/dist/targets/cpp/emit-protocol-iterator.js +45 -23
- package/dist/targets/cpp/emit-record-view.d.ts +5 -10
- package/dist/targets/cpp/emit-record-view.js +223 -269
- package/dist/targets/cpp/emit-return.js +33 -8
- package/dist/targets/cpp/emit-scopes.d.ts +2 -2
- package/dist/targets/cpp/emit-sum-widening.js +13 -5
- package/dist/targets/cpp/emit-tonumber.d.ts +1 -1
- package/dist/targets/cpp/emit-tonumber.js +3 -3
- package/dist/targets/cpp/emit-tostring.d.ts +20 -2
- package/dist/targets/cpp/emit-tostring.js +131 -28
- package/dist/targets/cpp/emit-typeof.d.ts +4 -0
- package/dist/targets/cpp/emit-typeof.js +29 -1
- package/dist/targets/cpp/emit-union-properties.d.ts +6 -23
- package/dist/targets/cpp/emit-union-properties.js +127 -235
- package/dist/targets/cpp/emit.d.ts +4 -1
- package/dist/targets/cpp/emit.js +336 -119
- package/dist/targets/cpp/error-types.d.ts +1 -3
- package/dist/targets/cpp/error-types.js +1 -2
- package/dist/targets/cpp/evaluated-once.d.ts +4 -4
- package/dist/targets/cpp/evaluated-once.js +5 -5
- package/dist/targets/cpp/function-source-reads.d.ts +2 -15
- package/dist/targets/cpp/function-source-reads.js +3 -38
- package/dist/targets/cpp/host/core-globals.d.ts +5 -0
- package/dist/targets/cpp/host/core-globals.js +10 -0
- package/dist/targets/cpp/host/emit-host-arity.js +1 -1
- package/dist/targets/cpp/host/emit-host-invoke.js +73 -23
- package/dist/targets/cpp/host/emit-host-object.d.ts +2 -1
- package/dist/targets/cpp/host/emit-host-object.js +328 -145
- package/dist/targets/cpp/host/emit-host-properties.js +4 -6
- package/dist/targets/cpp/host/emit-host-reflect.js +29 -5
- package/dist/targets/cpp/host/emit-host-value.d.ts +1 -1
- package/dist/targets/cpp/host/emit-host-value.js +2 -2
- package/dist/targets/cpp/host/host-members.d.ts +11 -0
- package/dist/targets/cpp/host/host-members.js +27 -5
- package/dist/targets/cpp/host/host-method-aliases.d.ts +1 -30
- package/dist/targets/cpp/host/host-method-aliases.js +1 -76
- package/dist/targets/cpp/host/native-protocols.js +1 -1
- package/dist/targets/cpp/host/object-protocol.d.ts +1 -1
- package/dist/targets/cpp/host/object-protocol.js +24 -24
- package/dist/targets/cpp/host-namespace-reads.d.ts +1 -83
- package/dist/targets/cpp/host-namespace-reads.js +1 -113
- package/dist/targets/cpp/manifest/capabilities.js +33 -33
- package/dist/targets/cpp/manifest.d.ts +5 -0
- package/dist/targets/cpp/manifest.js +38 -14
- package/dist/targets/cpp/native-collection-base.js +7 -6
- package/dist/targets/cpp/native-debug-source.d.ts +15 -0
- package/dist/targets/cpp/native-debug-source.js +21 -0
- package/dist/targets/cpp/native-error-base.d.ts +1 -1
- package/dist/targets/cpp/native-error-base.js +1 -1
- package/dist/targets/cpp/native-narrowing-transport.d.ts +2 -0
- package/dist/targets/cpp/native-narrowing-transport.js +25 -5
- package/dist/targets/cpp/native-view-targets.d.ts +3 -0
- package/dist/targets/cpp/native-view-targets.js +5 -0
- package/dist/targets/cpp/prototype/emit-prototype-array.d.ts +3 -33
- package/dist/targets/cpp/prototype/emit-prototype-array.js +40 -22
- package/dist/targets/cpp/prototype/emit-prototype-date.d.ts +1 -58
- package/dist/targets/cpp/prototype/emit-prototype-date.js +14 -97
- package/dist/targets/cpp/prototype/emit-prototype-error.d.ts +20 -0
- package/dist/targets/cpp/prototype/emit-prototype-error.js +2 -2
- package/dist/targets/cpp/prototype/emit-prototype-invoke.d.ts +3 -27
- package/dist/targets/cpp/prototype/emit-prototype-invoke.js +60 -52
- package/dist/targets/cpp/prototype/emit-prototype-iterator.d.ts +1 -41
- package/dist/targets/cpp/prototype/emit-prototype-iterator.js +4 -43
- package/dist/targets/cpp/prototype/emit-prototype-promise.d.ts +2 -13
- package/dist/targets/cpp/prototype/emit-prototype-promise.js +10 -58
- package/dist/targets/cpp/prototype/emit-prototype-regexp.d.ts +4 -25
- package/dist/targets/cpp/prototype/emit-prototype-regexp.js +16 -81
- package/dist/targets/cpp/prototype/emit-prototype-string.d.ts +1 -1
- package/dist/targets/cpp/prototype/emit-prototype-string.js +17 -28
- package/dist/targets/cpp/prototype/prototype-method-reads.js +4 -80
- package/dist/targets/cpp/reactive-dependencies.d.ts +12 -6
- package/dist/targets/cpp/reactive-dependencies.js +62 -42
- package/dist/targets/cpp/reactive-origins.js +12 -0
- package/dist/targets/cpp/records.d.ts +133 -14
- package/dist/targets/cpp/records.js +345 -153
- package/dist/targets/cpp/regexp-types.d.ts +1 -26
- package/dist/targets/cpp/regexp-types.js +4 -29
- package/dist/targets/cpp/segment-scopes.d.ts +30 -0
- package/dist/targets/cpp/segment-scopes.js +294 -0
- package/dist/targets/cpp/translation-unit.d.ts +21 -2
- package/dist/targets/cpp/translation-unit.js +121 -276
- package/dist/targets/cpp/types.d.ts +8 -3
- package/dist/targets/cpp/types.js +30 -6
- package/dist/targets/cpp/virtual-callees.d.ts +18 -0
- package/dist/targets/cpp/virtual-callees.js +27 -0
- package/dist/targets/cpp/virtual-methods.d.ts +7 -7
- package/dist/targets/cpp/virtual-methods.js +213 -58
- package/package.json +8 -3
- package/src/targets/cpp/runtime/gea_dictionary_view.h +204 -0
- package/src/targets/cpp/runtime/gea_document_view.h +845 -0
- package/src/targets/cpp/runtime/gea_dynamic_proxy.h +66 -23
- package/src/targets/cpp/runtime/gea_eval.h +6 -6
- package/src/targets/cpp/runtime/gea_runtime.h +7550 -1166
- package/dist/targets/cpp/direct-call-receivers.d.ts +0 -37
- package/dist/targets/cpp/direct-call-receivers.js +0 -79
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
+
import { declaredIntegerWidthOf } from '../declared-integers.js';
|
|
2
3
|
import { isAmbientDeclaration } from '../ambient.js';
|
|
3
4
|
import { transparentClassAliasDeclarationTarget, transparentConstClassAliasTarget } from '../class-alias.js';
|
|
4
5
|
import { prepareStructuralRules, structuralDisagreementsEnabled } from './structural-rules.js';
|
|
6
|
+
import { sourceAccessorDescriptorOf } from './flow/source-accessor-descriptor.js';
|
|
5
7
|
import { noSloppyAbsence, withAbsences } from './sloppy-absence.js';
|
|
6
8
|
import { emptySuppressedWriteArmCensus } from './suppressed-write-arms.js';
|
|
7
9
|
import { recordStorageFamilies } from './record-storage-families.js';
|
|
@@ -13,15 +15,16 @@ import { bivariantSlotArrayAliasTypeOf, bivariantSlotBindingTypeOf, bivariantSlo
|
|
|
13
15
|
import { emptyDeclaredMemberCensus } from './structural-declarations.js';
|
|
14
16
|
import { createLocalUnionResolver } from './structural-local-union.js';
|
|
15
17
|
import { createMutableMethodResolver } from './structural-mutable-method.js';
|
|
18
|
+
import { createMutableFieldResolver } from './structural-mutable-field.js';
|
|
16
19
|
import { structuralArrayReadAt } from './structural-array-read.js';
|
|
17
20
|
import { enclosingArgumentsFunction, implicitArgumentsSlotOf, isArgumentsObjectIdentifier } from './implicit-arguments.js';
|
|
18
|
-
import { createStructuralCallResultResolver, createStructuralConstructResultResolver } from './structural-callable.js';
|
|
21
|
+
import { createStructuralCallResultResolver, createStructuralConstructResultResolver, createStructuralOwnCallableInvocationResolver } from './structural-callable.js';
|
|
19
22
|
import { genericFunctionChoiceMembersOf, genericSourceFunctionDeclarationOf } from './generic-function-choice.js';
|
|
20
23
|
import { isPrivateNameKey } from '../model/structural-types.js';
|
|
21
24
|
import { accessorSignatureOf, constructorImplementationSignatureOf, implementationSignatureOf, inheritedConstructSignatureOf, modifierOnlyMappedSourceOf, optionalMethodSignatureOf, declaredValueTypeOf, physicalInitializerTypeOf, physicalOverloadTypeAt, physicalStringObjectTypeAt } from './structural-declarations.js';
|
|
22
25
|
import { createKeyofResolver } from './keyof.js';
|
|
23
26
|
import { constructorInstalledMemberDeclarationsOf } from './flow/source-class-data.js';
|
|
24
|
-
import { arityAdmittedSignature, arrayPredicateNarrowedElementTypeOf, functionIntersectionMemberTypeOf, impliedPatternTargetOf, isGlobalObjectInterface, isHostMethodPresenceTest, isStandardInterfaceType, isLibArrayBufferViewType, isUnusableEvidence, widestOf } from './derived-expression-type.js';
|
|
27
|
+
import { arityAdmittedSignature, arrayPredicateNarrowedElementTypeOf, functionIntersectionMemberTypeOf, impliedPatternTargetOf, isGlobalObjectInterface, isGlobalObjectMember, isHostMethodPresenceTest, isStandardInterfaceType, isLibArrayBufferViewType, isUnusableEvidence, widestOf } from './derived-expression-type.js';
|
|
25
28
|
import { createLeafKeying, literalFor, primitiveFor, symbolKeyDeclarationOf } from './structural-leaves.js';
|
|
26
29
|
import { unwrapErasedExpression } from './producers/erasure.js';
|
|
27
30
|
import { intrinsicAccessorGetterChainOf } from './intrinsic-accessor-getter.js';
|
|
@@ -34,7 +37,8 @@ import { emptyParameterBindingCensus, parameterCensusForCopy } from './parameter
|
|
|
34
37
|
import { emptyCollectionBindingCensus } from './collection-bindings.js';
|
|
35
38
|
import { bagShapeOfType, bagShapeTypeAt, emptyObjectBagCensus } from './object-bag-bindings.js';
|
|
36
39
|
import { indexedAccessMemberTypes } from './structural-indexed-access.js';
|
|
37
|
-
import { joinedCallableOf
|
|
40
|
+
import { joinedCallableOf } from './structural-joins.js';
|
|
41
|
+
import { censusFreshDictionaryStorage, dictionaryArmIndexOf } from './fresh-dictionary-storage.js';
|
|
38
42
|
import { creationOrderOf, creationOrderedProperties } from './structural-creation-order.js';
|
|
39
43
|
import { collectionMemberResultTypeAt, contextualArrayConstructTypeAt, inferredArrayElementAt, statedCollectionTypeAt, inferredCollectionTypeArgumentsAt, unstatedNeverArray } from './structural-array-element.js';
|
|
40
44
|
import { createDeclaredBodyResolver } from './structural-declared-body.js';
|
|
@@ -58,7 +62,7 @@ import { emptyCommonJsModuleRecordCensus } from './commonjs-module-record.js';
|
|
|
58
62
|
* `T`. TypeScript computes an APPARENT type for the reference so member
|
|
59
63
|
* lookups and narrowing have a concrete shape to work against, and for an
|
|
60
64
|
* unnarrowed generic that apparent type is the parameter's base constraint --
|
|
61
|
-
* `object` inside
|
|
65
|
+
* `object` inside a `json = <T extends JSONValue | {} | InvalidJSONValue>
|
|
62
66
|
* (object: T) => ... JSON.stringify(object)` reads back as the whole
|
|
63
67
|
* constraint union.
|
|
64
68
|
*
|
|
@@ -102,8 +106,9 @@ const nativeErrorNames = new Set([
|
|
|
102
106
|
'TypeError',
|
|
103
107
|
'URIError'
|
|
104
108
|
]);
|
|
105
|
-
export const createStructuralMapper = (checker, identities, table, instantiations = emptyInstantiationCensus, specializations = emptySpecializationCensus, parameters = emptyParameterBindingCensus, absent = emptyAbsentGlobalCensus, collections = emptyCollectionBindingCensus, bags = emptyObjectBagCensus, flow, families = emptyInterfaceFamilyCensus, moduleRecords = emptyCommonJsModuleRecordCensus, declaredMembers = emptyDeclaredMemberCensus, isIntrinsicDescriptorCall = () => false, standIns = emptyRecordStandInArmCensus, linkFamilies = emptyRecordLinkFamilyCensus, sloppyAbsence = noSloppyAbsence, suppressedWrites = emptySuppressedWriteArmCensus, assertedArguments = emptyAssertedArgumentArmCensus, symbolSlots = emptySymbolKeyedThisSlotCensus) => {
|
|
109
|
+
export const createStructuralMapper = (checker, identities, table, instantiations = emptyInstantiationCensus, specializations = emptySpecializationCensus, parameters = emptyParameterBindingCensus, absent = emptyAbsentGlobalCensus, collections = emptyCollectionBindingCensus, bags = emptyObjectBagCensus, flow, families = emptyInterfaceFamilyCensus, moduleRecords = emptyCommonJsModuleRecordCensus, declaredMembers = emptyDeclaredMemberCensus, isIntrinsicDescriptorCall = () => false, standIns = emptyRecordStandInArmCensus, linkFamilies = emptyRecordLinkFamilyCensus, sloppyAbsence = noSloppyAbsence, suppressedWrites = emptySuppressedWriteArmCensus, assertedArguments = emptyAssertedArgumentArmCensus, symbolSlots = emptySymbolKeyedThisSlotCensus, ordinaryOwnCallableSourceAt, accessorDescriptorAt, nativeClassAliasTypeAt) => {
|
|
106
110
|
const storageTypeOf = recordStorageFamilies(checker, flow, parameters);
|
|
111
|
+
const freshDictionaries = censusFreshDictionaryStorage(checker, flow, parameters);
|
|
107
112
|
// One disagreement list for the WHOLE mapper, for the same reason the caches
|
|
108
113
|
// below are shared: two rules answering for one node is a fact about the rule
|
|
109
114
|
// set, and a per-view list would report it once per copy that asked.
|
|
@@ -135,13 +140,13 @@ export const createStructuralMapper = (checker, identities, table, instantiation
|
|
|
135
140
|
const cached = views.get(key);
|
|
136
141
|
if (cached)
|
|
137
142
|
return cached;
|
|
138
|
-
const built = buildMapper(checker, identities.forSpecialization(path), table, instantiations, specializations, path, bindingPath, mapperFor, parameters, absent, collections, bags, flow, storageTypeOf, families, moduleRecords, declaredMembers, isIntrinsicDescriptorCall, standIns, linkFamilies, aliasRecurrence, instantiatedMembersFor(bindingPath), viewIndependentKeyOf, sharedCompleted, classCopyKeys, disagreements, sloppyAbsence, suppressedWrites, assertedArguments, symbolSlots);
|
|
143
|
+
const built = buildMapper(checker, identities.forSpecialization(path), table, instantiations, specializations, path, bindingPath, mapperFor, parameters, absent, collections, bags, flow, storageTypeOf, freshDictionaries, families, moduleRecords, declaredMembers, isIntrinsicDescriptorCall, standIns, linkFamilies, aliasRecurrence, instantiatedMembersFor(bindingPath), viewIndependentKeyOf, sharedCompleted, classCopyKeys, disagreements, sloppyAbsence, suppressedWrites, assertedArguments, symbolSlots, ordinaryOwnCallableSourceAt, accessorDescriptorAt, nativeClassAliasTypeAt);
|
|
139
144
|
views.set(key, built);
|
|
140
145
|
return built;
|
|
141
146
|
};
|
|
142
147
|
return mapperFor(rootSpecialization);
|
|
143
148
|
};
|
|
144
|
-
const buildMapper = (checker, identities, table, instantiations, specializations, path, bindingPath, mapperFor, programParameters, absent, collections, bags, flow, storageTypeOf, families, moduleRecords, declaredMembers, isIntrinsicDescriptorCall, standIns, linkFamilies, aliasRecurrence, instantiatedMembers, viewIndependentKeyOf, sharedCompleted, classCopyKeys, disagreements, sloppyAbsence, suppressedWrites, assertedArguments, symbolSlots) => {
|
|
149
|
+
const buildMapper = (checker, identities, table, instantiations, specializations, path, bindingPath, mapperFor, programParameters, absent, collections, bags, flow, storageTypeOf, freshDictionaries, families, moduleRecords, declaredMembers, isIntrinsicDescriptorCall, standIns, linkFamilies, aliasRecurrence, instantiatedMembers, viewIndependentKeyOf, sharedCompleted, classCopyKeys, disagreements, sloppyAbsence, suppressedWrites, assertedArguments, symbolSlots, ordinaryOwnCallableSourceAt, accessorDescriptorAt, nativeClassAliasTypeAt) => {
|
|
145
150
|
const { boundByPath, bindingOf: censusBindingOf, substituteTypeParameter } = createTypeParameterSubstitution(identities, instantiations, specializations, bindingPath);
|
|
146
151
|
// What a parameter holds is a fact about the COPY this view describes: a
|
|
147
152
|
// generic body's copies are called with different carriers. Scoped once,
|
|
@@ -176,11 +181,10 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
176
181
|
* steps -- what this copy binds, what the program-wide census binds, and the
|
|
177
182
|
* author's own DEFAULT -- and only the first of those reached here, so a
|
|
178
183
|
* parameter answered by either of the other two carried a `T[K]` that had
|
|
179
|
-
* nothing left to refuse with.
|
|
180
|
-
*
|
|
181
|
-
* `
|
|
182
|
-
*
|
|
183
|
-
* `Env`, and got the refusal instead.
|
|
184
|
+
* nothing left to refuse with. A `class App<E extends Env = Env, ...>` that
|
|
185
|
+
* nothing ever instantiates as `App<Something>` is the case: every
|
|
186
|
+
* `E['Bindings']` in its methods asked about a parameter whose answer is its
|
|
187
|
+
* default, `Env`, and got the refusal instead.
|
|
184
188
|
*
|
|
185
189
|
* The default is the language's own substitution, not a guess: a reference
|
|
186
190
|
* that omits the argument IS the default, and the checker has already typed
|
|
@@ -388,15 +392,15 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
388
392
|
* carrier, which is not a cell at all.
|
|
389
393
|
*
|
|
390
394
|
* The case that forced it is not a naked parameter, which is why this is not
|
|
391
|
-
* inside `resolvedObjectType`.
|
|
392
|
-
* growing INTERSECTION -- `IfAnyThenEmptyObject<E extends Env ? Env extends
|
|
393
|
-
* E ? {} : E : E> & IfAnyThenEmptyObject<E2 ...> & {}`, one arm per
|
|
394
|
-
* in the program -- because every
|
|
395
|
-
* merges the last one's. Substitution resolves `E` to that intersection
|
|
395
|
+
* inside `resolvedObjectType`. A fluent builder chain can substitute `E` with
|
|
396
|
+
* a growing INTERSECTION -- `IfAnyThenEmptyObject<E extends Env ? Env extends
|
|
397
|
+
* E ? {} : E : E> & IfAnyThenEmptyObject<E2 ...> & {}`, one arm per chained
|
|
398
|
+
* call in the program -- because every call returns a builder whose
|
|
399
|
+
* environment merges the last one's. Substitution resolves `E` to that intersection
|
|
396
400
|
* perfectly well; what cannot answer `['Bindings']` is the intersection,
|
|
397
401
|
* whose constituents are CONDITIONAL types the checker leaves deferred while
|
|
398
|
-
* `E` is generic. Its base constraint is `{}`, the environment
|
|
399
|
-
*
|
|
402
|
+
* `E` is generic. Its base constraint is `{}`, the empty environment the
|
|
403
|
+
* declaration states, and `{}` declares no `Bindings` -- so the access is
|
|
400
404
|
* `undefined`, which is what `indexedAccessMemberTypes` already answers for
|
|
401
405
|
* a missing key on a real object type.
|
|
402
406
|
*
|
|
@@ -421,8 +425,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
421
425
|
// object type that genuinely declares no such member. `{}` arrived at as
|
|
422
426
|
// the constraint of a conditional the checker could not evaluate is a
|
|
423
427
|
// different fact wearing the same shape: it is TypeScript's fallback, not
|
|
424
|
-
// the author's claim.
|
|
425
|
-
// part company -- in the copy whose object type is the
|
|
428
|
+
// the author's claim. A field `env: E['Bindings'] = {}` is where the two
|
|
429
|
+
// part company -- in the copy whose object type is the builder chain's
|
|
426
430
|
// intersection of deferred conditionals, absence would carrier the field as
|
|
427
431
|
// `undefined`, a cell that provably cannot hold the initializer written on
|
|
428
432
|
// the very same line. `unknown` is what is actually known there, and it is
|
|
@@ -461,16 +465,68 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
461
465
|
const arms = suppressedWrites.armsAt(parameter);
|
|
462
466
|
return arms === null ? null : withForeignArms(typeOf(checker.getTypeAtLocation(parameter)), arms);
|
|
463
467
|
};
|
|
468
|
+
const dictionaryStorageType = (fact) => {
|
|
469
|
+
const entries = [...new Set(fact.component.values.map(typeOf))];
|
|
470
|
+
const value = entries.length === 1 ? entries[0] : table.intern({ kind: 'union', members: entries });
|
|
471
|
+
return table.intern({
|
|
472
|
+
kind: 'object',
|
|
473
|
+
members: [],
|
|
474
|
+
membersDropped: false,
|
|
475
|
+
index: [{ key: fact.key, value, readonly: false }]
|
|
476
|
+
});
|
|
477
|
+
};
|
|
478
|
+
const replaceDictionaryArms = (type, fact) => {
|
|
479
|
+
const arms = type.isUnion() ? type.types : [type];
|
|
480
|
+
if (!arms.some((arm) => dictionaryArmIndexOf(checker, arm)?.key === fact.key))
|
|
481
|
+
return null;
|
|
482
|
+
const storage = dictionaryStorageType(fact);
|
|
483
|
+
const members = [...new Set(arms.map((arm) => (dictionaryArmIndexOf(checker, arm)?.key === fact.key ? storage : typeOf(arm))))];
|
|
484
|
+
return members.length === 1 ? members[0] : table.intern({ kind: 'union', members });
|
|
485
|
+
};
|
|
486
|
+
const indexedStorageTypeAt = (node) => {
|
|
487
|
+
if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
|
|
488
|
+
const receiverType = checker.getTypeAtLocation(node.expression);
|
|
489
|
+
const receivers = receiverType.isUnion() ? receiverType.types : [receiverType];
|
|
490
|
+
const fact = freshDictionaries.storageAt(node.expression);
|
|
491
|
+
if (fact && receivers.every((arm) => dictionaryArmIndexOf(checker, arm)?.key === fact.key)) {
|
|
492
|
+
const members = fact.component.values.map(typeOf);
|
|
493
|
+
const raw = checker.getTypeAtLocation(node);
|
|
494
|
+
const rawArms = raw.isUnion() ? raw.types : [raw];
|
|
495
|
+
if (rawArms.some((arm) => (arm.flags & ts.TypeFlags.Undefined) !== 0))
|
|
496
|
+
members.push(typeOf(checker.getUndefinedType()));
|
|
497
|
+
const unique = [...new Set(members)];
|
|
498
|
+
return unique.length === 1 ? unique[0] : table.intern({ kind: 'union', members: unique });
|
|
499
|
+
}
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
const fact = freshDictionaries.storageAt(node);
|
|
503
|
+
if (fact === null)
|
|
504
|
+
return null;
|
|
505
|
+
if (ts.isObjectLiteralExpression(node))
|
|
506
|
+
return dictionaryStorageType(fact);
|
|
507
|
+
return replaceDictionaryArms(checker.getTypeAtLocation(node), fact);
|
|
508
|
+
};
|
|
509
|
+
const indexedStorageResultAt = (node) => {
|
|
510
|
+
if (!ts.isFunctionLike(node))
|
|
511
|
+
return null;
|
|
512
|
+
const fact = freshDictionaries.resultOf(node);
|
|
513
|
+
const signature = checker.getSignatureFromDeclaration(node);
|
|
514
|
+
return fact && signature ? replaceDictionaryArms(checker.getReturnTypeOfSignature(signature), fact) : null;
|
|
515
|
+
};
|
|
516
|
+
const mutableFields = createMutableFieldResolver(checker, table, flow, (type) => typeOf(type), (node) => mapper.typeAt(node));
|
|
464
517
|
const { signatureOf, memberOf, indexesOf, tupleElementsOf } = createStructuralParts({
|
|
465
518
|
parameters,
|
|
466
519
|
checker,
|
|
467
520
|
identities,
|
|
468
521
|
typeOf: (type) => typeOf(type),
|
|
469
522
|
layoutTypeAt: (node) => layoutTypeAt(node),
|
|
470
|
-
parameterOverrideAt: (parameter) =>
|
|
523
|
+
parameterOverrideAt: (parameter) => indexedStorageTypeAt(parameter) ??
|
|
524
|
+
refusedArrayParameterTypeAt(parameter) ??
|
|
471
525
|
prototypeObjectParameterTypeAt(parameter) ??
|
|
472
526
|
bivariantSlotParameterAt(parameter) ??
|
|
473
527
|
suppressedWriteParameterAt(parameter),
|
|
528
|
+
implicitArgumentsTypeAt: (declaration, frame) => implicitArgumentsSourceTypeAt(declaration, frame),
|
|
529
|
+
resultOverrideAt: indexedStorageResultAt,
|
|
474
530
|
implicitReceiverOf,
|
|
475
531
|
declaredMemberResultOf,
|
|
476
532
|
declaredMembers,
|
|
@@ -490,6 +546,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
490
546
|
// `StructuralPartsInput.bags`.
|
|
491
547
|
bags,
|
|
492
548
|
sloppyAbsence,
|
|
549
|
+
mutableFieldStorageTypeOf: mutableFields.storageTypeOf,
|
|
493
550
|
foreignArmsOfMember: (symbol, id) => withForeignArms(id, suppressedWrites.armsOfMember(symbol))
|
|
494
551
|
});
|
|
495
552
|
const { keeperFor } = createMemberRules(identities);
|
|
@@ -508,12 +565,11 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
508
565
|
* mention of the same array got the projection too, and the array branch
|
|
509
566
|
* was never reached again.
|
|
510
567
|
*
|
|
511
|
-
* Reached that way, `
|
|
512
|
-
*
|
|
568
|
+
* Reached that way, a `Node[]` carried as a `native-record-ref`: a
|
|
569
|
+
* `const [ first, second, ... ] = nodes` asked for a
|
|
513
570
|
* `destructuring:array-pattern:native-record-ref` helper no manifest
|
|
514
|
-
* claims or should.
|
|
515
|
-
*
|
|
516
|
-
* `array-object` carriers -- an ordering leak, not a systemic
|
|
571
|
+
* claims or should. Array projections of this kind were a small minority
|
|
572
|
+
* against the honest `array-object` carriers -- an ordering leak, not a systemic
|
|
517
573
|
* misclassification, which is exactly why it survived: most arrays are
|
|
518
574
|
* reached from a position that asks the array branch first.
|
|
519
575
|
*
|
|
@@ -620,9 +676,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
620
676
|
// `Array.prototype.concat(...items: ConcatArray<T>[])` argument lands --
|
|
621
677
|
// so deriving it as a record made `a.concat(b)` refuse the rest pack it
|
|
622
678
|
// had just built (`conversion:array-object(E)->native-record-ref`), for
|
|
623
|
-
// every element type, in every program.
|
|
624
|
-
//
|
|
625
|
-
// (`tempNodes.concat(shifted)`) are the two that named it.
|
|
679
|
+
// every element type, in every program, e.g.
|
|
680
|
+
// `Object.keys(a).concat(Object.keys(b))` or `nodes.concat(shifted)`.
|
|
626
681
|
if (!reachesStandardArray(target, location, new Set()) &&
|
|
627
682
|
!isStandardInterfaceType(checker, location, 'ConcatArray', type))
|
|
628
683
|
return null;
|
|
@@ -665,7 +720,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
665
720
|
});
|
|
666
721
|
};
|
|
667
722
|
const objectShapeOf = (type, location, members = 'all', excluded) => {
|
|
668
|
-
|
|
723
|
+
// `Object.prototype`'s members are no shape's own data, whichever type
|
|
724
|
+
// carried them here -- see `isGlobalObjectMember`.
|
|
725
|
+
const ordered = creationOrderedProperties(checker, type, parameters).filter((property) => !isGlobalObjectMember(checker, property));
|
|
669
726
|
const properties = excluded ? ordered.filter((property) => !excluded(property)) : ordered;
|
|
670
727
|
const kept = members === 'all' ? properties : properties.filter(keeperFor(properties, members));
|
|
671
728
|
const stated = kept.flatMap((property) => {
|
|
@@ -824,17 +881,14 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
824
881
|
// K]: T }`, so an instantiation's own symbol answers the anonymous
|
|
825
882
|
// `__type` of that `MappedTypeNode` rather than the `TypeAliasDeclaration`
|
|
826
883
|
// -- which means a type recursing THROUGH a mapped alias has no
|
|
827
|
-
// declaration to break the cycle on, and
|
|
828
|
-
// Record<string, Node> }`
|
|
829
|
-
//
|
|
830
|
-
//
|
|
831
|
-
//
|
|
832
|
-
//
|
|
833
|
-
//
|
|
834
|
-
//
|
|
835
|
-
// `reachability.ts`'s type-only import rule) it was WORSE by two
|
|
836
|
-
// obligations as well, so there is nothing left on the other side of the
|
|
837
|
-
// trade. A cycle through a mapped alias needs `selfReferentialShapeOf` to
|
|
884
|
+
// declaration to break the cycle on, and a `class Node { #children:
|
|
885
|
+
// Record<string, Node> }` refuses as `a self-referential type of this
|
|
886
|
+
// shape is not modelled`. Routing such a type through the ALIAS instead
|
|
887
|
+
// does fix that, and it costs a whole certificate elsewhere: with the
|
|
888
|
+
// alias as the anchor, a host-bound member reached through a mapped type
|
|
889
|
+
// demands `native-boundary:__type@1`, a protocol nothing registers, and
|
|
890
|
+
// it was net WORSE in obligations as well, so there is nothing left on
|
|
891
|
+
// the other side of the trade. A cycle through a mapped alias needs `selfReferentialShapeOf` to
|
|
838
892
|
// model that shape, not a second nominal anchor for it -- which is what it
|
|
839
893
|
// now does: its dictionary case closes `Record<string, Node>` on the
|
|
840
894
|
// anchor the retry already reserved, leaving this decision untouched.
|
|
@@ -876,7 +930,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
876
930
|
// the anchor key below, folded through `layoutRelevantParameterIndices` so
|
|
877
931
|
// that two instantiations differing only in a phantom parameter share one
|
|
878
932
|
// physical layout. The copy path says nothing the arguments do not, and
|
|
879
|
-
// saying it twice is what split
|
|
933
|
+
// saying it twice is what split generic classes into a
|
|
880
934
|
// root-cited half and a copy-cited half whose members only one of the two
|
|
881
935
|
// could ever find.
|
|
882
936
|
const id = identities.declarationIdOf(declaration, rootSpecialization);
|
|
@@ -900,12 +954,12 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
900
954
|
return { kind: 'declared', declaration: id, declarationNode: declaration };
|
|
901
955
|
}
|
|
902
956
|
// A pre-`class` JavaScript CONSTRUCTOR FUNCTION's instances are nominal,
|
|
903
|
-
// and named by the function: `function
|
|
957
|
+
// and named by the function: `function Clipping( properties ) {
|
|
904
958
|
// this.uniform = uniform; ... }` gives TypeScript's own JS inference a
|
|
905
|
-
// construct signature whose return type it prints as `
|
|
959
|
+
// construct signature whose return type it prints as `Clipping`,
|
|
906
960
|
// symboled to the function declaration itself. Anchoring it here is what
|
|
907
961
|
// lets that type be SELF-REFERENTIAL, which every one of these is: the
|
|
908
|
-
// instance carries `this.setState = function (
|
|
962
|
+
// instance carries `this.setState = function ( state ) { ... }`, whose
|
|
909
963
|
// own receiver is the instance (`structural-receiver.ts`'s
|
|
910
964
|
// `jsConstructorReceiverOf`). Reached anonymously the walk collides with
|
|
911
965
|
// itself and `selfReferentialShapeOf` models no object shape with NAMED
|
|
@@ -934,9 +988,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
934
988
|
*
|
|
935
989
|
* Shared between the ordinary declared-anchor path (`translate`, below) and
|
|
936
990
|
* the self-referential retry (`typeOf`'s `selfReferential` branch): a class
|
|
937
|
-
* whose OWN type argument mentions the class again -- `
|
|
938
|
-
* where `EventMap` describes an event carrying `
|
|
939
|
-
* target,
|
|
991
|
+
* whose OWN type argument mentions the class again -- `Node<EventMap>`
|
|
992
|
+
* where `EventMap` describes an event carrying `Node<EventMap>` as its
|
|
993
|
+
* target, the usual typed event-map pattern -- cannot
|
|
940
994
|
* compute this anchor's key up front, because the key needs the argument's
|
|
941
995
|
* structural id and deriving that id is what re-enters the class. That is a
|
|
942
996
|
* genuine cycle, not an undeclared shape: the retry mechanism already
|
|
@@ -1518,7 +1572,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1518
1572
|
try {
|
|
1519
1573
|
// A declared name (class instance, class constructor, interface, type
|
|
1520
1574
|
// alias) whose OWN type argument mentions it again -- see
|
|
1521
|
-
// `buildDeclaredShape`'s docstring for the concrete
|
|
1575
|
+
// `buildDeclaredShape`'s docstring for the concrete event-map case --
|
|
1522
1576
|
// is not an anonymous cycle `selfReferentialShapeOf` needs to know a
|
|
1523
1577
|
// fourth shape for: it is one of the three shapes the ordinary
|
|
1524
1578
|
// declared-anchor path already builds, just reached through the one
|
|
@@ -1714,8 +1768,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1714
1768
|
* below compose. The image is the checker's own instantiation of a copy's
|
|
1715
1769
|
* member type (`structural-instantiated-member.ts`); the path substitution
|
|
1716
1770
|
* answers for a bare parameter a copy binds; and the recursion answers for a
|
|
1717
|
-
* parameter wrapped in one of the operators -- `NonNullable<
|
|
1718
|
-
* because `
|
|
1771
|
+
* parameter wrapped in one of the operators -- `NonNullable<T>` closes
|
|
1772
|
+
* because `T` does.
|
|
1719
1773
|
*/
|
|
1720
1774
|
const closedForm = (type) => {
|
|
1721
1775
|
const image = instantiatedMembers.through(type);
|
|
@@ -1735,8 +1789,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1735
1789
|
* while `T` is open, so it keeps the conditional unreduced -- and a
|
|
1736
1790
|
* conditional type names no structure, so everything downstream of it
|
|
1737
1791
|
* refused: the await's own result, the `const` it initializes, the `return`
|
|
1738
|
-
* that publishes it.
|
|
1739
|
-
*
|
|
1792
|
+
* that publishes it. In a library that is generic almost everywhere this
|
|
1793
|
+
* is the single largest root of refusals.
|
|
1740
1794
|
*
|
|
1741
1795
|
* Monomorphization has already closed the hole this walk is inside, so the
|
|
1742
1796
|
* reduction is not deferred any more -- only the checker's ability to spell
|
|
@@ -1757,10 +1811,10 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1757
1811
|
*
|
|
1758
1812
|
* `NonNullable` is NOT gated on `TypeFlags.Conditional`, and that is not an
|
|
1759
1813
|
* oversight: since TypeScript 4.8 it is spelled `T & {}`, so a deferred one
|
|
1760
|
-
* arrives as an INTERSECTION.
|
|
1761
|
-
* `
|
|
1762
|
-
*
|
|
1763
|
-
* it unreduced while the bare `Awaited<
|
|
1814
|
+
* arrives as an INTERSECTION. A generic method
|
|
1815
|
+
* `transform(item: NonNullable<T>): Promise<NonNullable<T>>`, awaited in
|
|
1816
|
+
* several copies, is the case -- and gating on the flag is what left
|
|
1817
|
+
* it unreduced while the bare `Awaited<T>` beside it reduced fine.
|
|
1764
1818
|
*/
|
|
1765
1819
|
const reducedOperator = (type) => {
|
|
1766
1820
|
const awaited = operatorArgument(type, 'Awaited');
|
|
@@ -1781,7 +1835,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1781
1835
|
* A DEFERRED `Parameters<F>`, laid out as the tuple of the parameters the
|
|
1782
1836
|
* closed `F` declares.
|
|
1783
1837
|
*
|
|
1784
|
-
*
|
|
1838
|
+
* A typed event emitter `Emitter<Events>` can declare helpers as
|
|
1785
1839
|
* `emitAndLog<EventKey extends keyof Events>(event: EventKey | symbol,
|
|
1786
1840
|
* ...args: Parameters<Events[EventKey]>)`. Each call site's copy binds both
|
|
1787
1841
|
* `Events` (the subclass's event map) and `EventKey` (the literal event
|
|
@@ -1871,20 +1925,20 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1871
1925
|
// `getAwaitedType` reduction below it only ever ran for a `NonNullable`,
|
|
1872
1926
|
// which since TypeScript 4.8 arrives as an INTERSECTION instead.
|
|
1873
1927
|
//
|
|
1874
|
-
//
|
|
1928
|
+
// A generic `readBody<T>` is the case:
|
|
1875
1929
|
// `Promise.resolve(fromBuffer(raw, request))` over a
|
|
1876
1930
|
// `(buf, request) => T | Promise<T>` types as
|
|
1877
1931
|
// `Promise<Awaited<T | Promise<T>>>`, and the copy that closed `T` got the
|
|
1878
|
-
// refusal rather than the reduction --
|
|
1879
|
-
//
|
|
1932
|
+
// refusal rather than the reduction -- a `promise(unresolved)` obligation
|
|
1933
|
+
// at every such site.
|
|
1880
1934
|
//
|
|
1881
1935
|
// Safe ahead of the refusal because this reads only `aliasSymbol` and
|
|
1882
1936
|
// `aliasTypeArguments`, two plain fields on the type object, and calls the
|
|
1883
1937
|
// checker only with an argument monomorphization has already CLOSED. What
|
|
1884
1938
|
// the refusal is positioned to come before is declared-alias
|
|
1885
1939
|
// NORMALIZATION further down, which asks a recursive conditional alias to
|
|
1886
|
-
// instantiate the very form it deferred --
|
|
1887
|
-
// accumulator (`IfAnyThenEmptyObject<...>`, one alias deeper per
|
|
1940
|
+
// instantiate the very form it deferred -- a fluent builder's environment
|
|
1941
|
+
// accumulator (`IfAnyThenEmptyObject<...>`, one alias deeper per chained call)
|
|
1888
1942
|
// exhausted TypeScript's stack there. That alias is neither `Awaited` nor
|
|
1889
1943
|
// `NonNullable`, so `operatorArgument` rejects it on the name and this
|
|
1890
1944
|
// line returns before any checker call.
|
|
@@ -1916,7 +1970,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1916
1970
|
// language is assignable to it, so it states nothing about what a
|
|
1917
1971
|
// particular cell holds. `derived-expression-type.ts`'s
|
|
1918
1972
|
// `annotationStatesNothing` has said exactly that for a long time, and
|
|
1919
|
-
//
|
|
1973
|
+
// JSDoc `@type {Object}` / `@return {Object}` tags reach this very
|
|
1920
1974
|
// interface -- but only the write-discovery CENSUSES consulted it, so
|
|
1921
1975
|
// this layer went on interning `Object` as a `declared` shape with a
|
|
1922
1976
|
// real body, and `representation/derive.ts` went on turning that body
|
|
@@ -1924,9 +1978,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1924
1978
|
// authorities, one saying "states nothing" and the other emitting a
|
|
1925
1979
|
// layout for it.
|
|
1926
1980
|
//
|
|
1927
|
-
// Nothing can be stored in that struct.
|
|
1928
|
-
//
|
|
1929
|
-
// node -- `boolean`, an `HTMLElement` handle, an object literal and an
|
|
1981
|
+
// Nothing can be stored in that struct. It was the target of unmet
|
|
1982
|
+
// conversion obligations whose pair simply has no node -- `boolean`, an `HTMLElement` handle, an object literal and an
|
|
1930
1983
|
// array of class instances all flowing into a cell typed `?Object` --
|
|
1931
1984
|
// and no conversion could exist for any of them, because the target
|
|
1932
1985
|
// layout was never real.
|
|
@@ -1984,10 +2037,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1984
2037
|
// `SymbolFlags.Class` alongside `Function`, `getDeclaredTypeOfSymbol`
|
|
1985
2038
|
// answers with the inferred instance type exactly as it does for a
|
|
1986
2039
|
// class -- and its declaration is a `FunctionDeclaration`, so
|
|
1987
|
-
// `isClassLike` alone said no.
|
|
1988
|
-
// this way throughout, and every `this.` inside one reached
|
|
1989
|
-
// representation as an uninstantiated parameter
|
|
1990
|
-
// diagnostics. The flag is checked rather than the syntax because the
|
|
2040
|
+
// `isClassLike` alone said no. Pre-`class` JavaScript libraries are
|
|
2041
|
+
// written this way throughout, and every `this.` inside one reached
|
|
2042
|
+
// representation as an uninstantiated parameter. The flag is checked rather than the syntax because the
|
|
1991
2043
|
// syntax is the only thing that differs.
|
|
1992
2044
|
if (symbol && declaration && (ts.isClassLike(declaration) || (symbol.flags & ts.SymbolFlags.Class) !== 0)) {
|
|
1993
2045
|
// Routed through the class's own declared type rather than interned
|
|
@@ -2027,20 +2079,20 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2027
2079
|
// base carried a naked parameter into its own field layout, which the
|
|
2028
2080
|
// deriver correctly refused ("field \"el\" carries unresolved(type
|
|
2029
2081
|
// parameter ... reached representation without monomorphization)") and
|
|
2030
|
-
// which cost
|
|
2082
|
+
// which cost a font-rendering program its whole emission.
|
|
2031
2083
|
//
|
|
2032
2084
|
// After the two bindings above on purpose: a copy that really did
|
|
2033
2085
|
// substitute something must keep what it substituted, and the default is
|
|
2034
2086
|
// only the answer when nothing did.
|
|
2035
2087
|
//
|
|
2036
|
-
// Measured cost, stated rather than hidden:
|
|
2037
|
-
//
|
|
2088
|
+
// Measured cost, stated rather than hidden: programs that reach DOM
|
|
2089
|
+
// generics gain boxed carriers, because `lib.dom`'s `E = Element`
|
|
2038
2090
|
// and `lib.es5`'s `TArrayBuffer = ArrayBuffer` resolve to types no host
|
|
2039
|
-
// table claims a carrier for. None of
|
|
2091
|
+
// table claims a carrier for. None of them compiles either way, and
|
|
2040
2092
|
// before this they were the same values counted as missing primitives
|
|
2041
2093
|
// rather than as boxes -- neither state is native, and the cure for both
|
|
2042
2094
|
// is a carrier for `Element`, not a naked type parameter. Excluding
|
|
2043
|
-
// defaults of `any` was tried and measured: it moved the number
|
|
2095
|
+
// defaults of `any` was tried and measured: it barely moved the number.
|
|
2044
2096
|
//
|
|
2045
2097
|
// The default is asked of THIS parameter, not re-typed from its
|
|
2046
2098
|
// declaration node. A method's default can name the enclosing
|
|
@@ -2049,7 +2101,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2049
2101
|
// `Promise`'s open `T` even when the receiver was `Promise<Response>`
|
|
2050
2102
|
// and the checker had already instantiated the default to `Response`.
|
|
2051
2103
|
// That open `T` reached representation through a promise method read as
|
|
2052
|
-
// a VALUE with no call to bind it --
|
|
2104
|
+
// a VALUE with no call to bind it -- an `isPromise` guard
|
|
2053
2105
|
// (`typeof (res as Promise<Response>).then === 'function'`) -- and the
|
|
2054
2106
|
// function-value carrier `(...)->promise(unresolved)` had no emitter
|
|
2055
2107
|
// recipe. `getDefaultFromTypeParameter` returns the instantiated default
|
|
@@ -2124,8 +2176,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2124
2176
|
const indexType = resolvedIndexType(access.indexType);
|
|
2125
2177
|
// `any[K]` is `any` and `unknown[K]` is an error the checker already
|
|
2126
2178
|
// reported -- neither is a member set to enumerate, and refusing it
|
|
2127
|
-
// reports a gap where the program declared one.
|
|
2128
|
-
// binds `E` to `any` in one of
|
|
2179
|
+
// reports a gap where the program declared one. A `Handler<E = any>`
|
|
2180
|
+
// binds `E` to `any` in one of a generic class's copies, so `E['Bindings']`
|
|
2129
2181
|
// there is the top type by the language's own rule, not a hole this
|
|
2130
2182
|
// layer failed to fill. Answering with the object type itself adds no
|
|
2131
2183
|
// dynamism: it IS the declared-any the program already carries.
|
|
@@ -2146,8 +2198,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2146
2198
|
}
|
|
2147
2199
|
const substituted = objectType === access.objectType && indexType === access.indexType ? null : indexedAccessMemberTypes(checker, objectType, indexType);
|
|
2148
2200
|
// The bound of the type the PROGRAM WROTE is asked before the bound of
|
|
2149
|
-
// what this copy substituted into it, and the two disagree in
|
|
2150
|
-
// favour of the first. `
|
|
2201
|
+
// what this copy substituted into it, and the two disagree in
|
|
2202
|
+
// favour of the first. A `class App<E extends Env>`'s `env: E['Bindings']`
|
|
2151
2203
|
// has `Env`'s own `Bindings?: Record<string, unknown>` as its bound
|
|
2152
2204
|
// answer -- a dictionary that may be absent, which is what the
|
|
2153
2205
|
// declaration says. The substituted intersection's bound is `{}`, which
|
|
@@ -2156,8 +2208,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2156
2208
|
// Both are upper bounds; the tighter one is not always the truer one,
|
|
2157
2209
|
// and the one the author stated outranks the one a copy produced.
|
|
2158
2210
|
// A substitution that answers pure ABSENCE steps aside for the bound, and
|
|
2159
|
-
//
|
|
2160
|
-
//
|
|
2211
|
+
// a field `env: E['Bindings'] = {}` is why. The copy that binds `E` to
|
|
2212
|
+
// an empty environment (`{}`) really does have no `Bindings` member, so absence is
|
|
2161
2213
|
// the language's own answer for a READ there -- but the field's STORAGE
|
|
2162
2214
|
// was sized by the declaration, which TypeScript checked against `E`'s
|
|
2163
2215
|
// constraint `Env`, where `Bindings?: Record<string, unknown>`. That is
|
|
@@ -2201,8 +2253,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2201
2253
|
// BESIDE a string one. A sum with an open arm is not a sum: its arms are
|
|
2202
2254
|
// not disjoint (every value is the open arm's), a `false` handed to the
|
|
2203
2255
|
// parameter matched neither arm, and a live string was ambiguous between
|
|
2204
|
-
// them at the unbox.
|
|
2205
|
-
//
|
|
2256
|
+
// them at the unbox. A JSDoc parameter documented `{?(Object|string)}`
|
|
2257
|
+
// to which some caller passes `false` is the case. `Object`
|
|
2206
2258
|
// admits every non-nullish value -- strings included -- so the union
|
|
2207
2259
|
// states nothing the open carrier does not.
|
|
2208
2260
|
const objectMember = type.types.find((member) => {
|
|
@@ -2222,8 +2274,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2222
2274
|
// `never[]` is what an EMPTY ARRAY LITERAL with no contextual type
|
|
2223
2275
|
// checks as, and it is assignable to every array type -- so beside
|
|
2224
2276
|
// another array-like arm it names no value the union does not already
|
|
2225
|
-
// hold, and no second carrier. `(path.match(/.../g) || [])`
|
|
2226
|
-
//
|
|
2277
|
+
// hold, and no second carrier. `(path.match(/.../g) || [])` is the
|
|
2278
|
+
// shape: `RegExpMatchArray | never[]`, which
|
|
2227
2279
|
// carried as a tagged union of a match result and an EMPTY STRUCT, and
|
|
2228
2280
|
// an `Array.prototype` method on that has no static receiver at all --
|
|
2229
2281
|
// the read fell back to boxing the arm and asking a dynamic
|
|
@@ -2237,8 +2289,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2237
2289
|
// Contentless means EMPTY, not merely tuple-shaped: a tuple's numeric
|
|
2238
2290
|
// index type is the union of its own elements, so a `[T, Params]` arm
|
|
2239
2291
|
// answers a real element type and is a distinct shape this must not
|
|
2240
|
-
// touch (`Result<T>`
|
|
2241
|
-
// 2-tuple). The two contentless spellings are `never[]` and the
|
|
2292
|
+
// touch (a `Result<T>` whose two arms are a 1-tuple and a 2-tuple). The two contentless spellings are `never[]` and the
|
|
2242
2293
|
// zero-length tuple `[]`, which is what `x.match(re) || []` derives:
|
|
2243
2294
|
// 13.2.4.2 gives an ArrayLiteral with no elements an Array of length 0,
|
|
2244
2295
|
// and a value with no element cannot disagree with any element type, so
|
|
@@ -2277,18 +2328,11 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2277
2328
|
const assertedArms = assertedArguments.armsOf(type);
|
|
2278
2329
|
if (assertedArms)
|
|
2279
2330
|
return remember(type, table.intern({ kind: 'union', members: [...present.map(typeOf), ...assertedArms.map(typeOf)] }));
|
|
2280
|
-
// A union of
|
|
2281
|
-
//
|
|
2282
|
-
//
|
|
2283
|
-
//
|
|
2284
|
-
|
|
2285
|
-
// union of the value types. A tagged union of two dictionaries is the
|
|
2286
|
-
// wrong shape for it, and provably so: `results[name] = []` writes an
|
|
2287
|
-
// array through a carrier whose tag says the entries are strings, which
|
|
2288
|
-
// no per-arm dispatch can make correct -- there is one object and its
|
|
2289
|
-
// tag was fixed when `{}` was allocated.
|
|
2290
|
-
const table_ = joinedIndexUnionOf(checker, table, typeOf, present);
|
|
2291
|
-
return remember(type, table_ ?? table.intern({ kind: 'union', members: present.map(typeOf) }));
|
|
2331
|
+
// A union of homogeneous tables retains the native storage of whichever
|
|
2332
|
+
// table entered it. Joining their entry types would require changing that
|
|
2333
|
+
// mutable allocation's storage and every alias; a type union supplies no
|
|
2334
|
+
// such allocation proof. Exact carrier duplicates collapse in union.ts.
|
|
2335
|
+
return remember(type, table.intern({ kind: 'union', members: present.map(typeOf) }));
|
|
2292
2336
|
}
|
|
2293
2337
|
// A family view that is not a member -- an object literal the family
|
|
2294
2338
|
// adopted, or a member through `Omit` and its kin (`interface-families.ts`'s
|
|
@@ -2298,6 +2342,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2298
2342
|
if (viewMember !== null)
|
|
2299
2343
|
return remember(type, typeOf(viewMember));
|
|
2300
2344
|
if (type.isIntersection()) {
|
|
2345
|
+
const integerWidth = declaredIntegerWidthOf(type);
|
|
2346
|
+
if (integerWidth !== null)
|
|
2347
|
+
return remember(type, table.intern({ kind: 'primitive', primitive: integerWidth }));
|
|
2301
2348
|
// The alias's own anchor, recorded beside the members rather than instead
|
|
2302
2349
|
// of them: a branded alias (`type Rgb565 = number & { readonly
|
|
2303
2350
|
// __geaRgb565: unique symbol }`) erases to its substantive member, and
|
|
@@ -2326,24 +2373,24 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2326
2373
|
return remember(type, distributed);
|
|
2327
2374
|
// The same reduction for a product with no union member, taken only
|
|
2328
2375
|
// where it closes the product to ONE member or to `never`. Narrowing a
|
|
2329
|
-
// copy's `
|
|
2330
|
-
// undefined)`, and the checker cannot reduce it while `
|
|
2331
|
-
// after substitution `
|
|
2376
|
+
// copy's `T | null` away from null gives `Awaited<T> & ({} |
|
|
2377
|
+
// undefined)`, and the checker cannot reduce it while `T` is open;
|
|
2378
|
+
// after substitution `WithKey<Chunk> & {}` stood as an intersection
|
|
2332
2379
|
// with an `unknown` member and derived a SECOND record for the one
|
|
2333
|
-
// filling. The yield slot of
|
|
2380
|
+
// filling. The yield slot of a generic cursor class's
|
|
2334
2381
|
// `[Symbol.asyncIterator]` held that record while the narrowed read held
|
|
2335
2382
|
// the filling's own, and no conversion joins two records of one type.
|
|
2336
2383
|
const collapsed = declaration === null ? collapsedIntersectionOf(members) : undefined;
|
|
2337
2384
|
if (collapsed !== undefined)
|
|
2338
2385
|
return remember(type, collapsed ?? typeOf(checker.getNeverType()));
|
|
2339
2386
|
// `Pick<D, Exclude<keyof D, K>> & { [k in K]: D[k] }` restores `D`
|
|
2340
|
-
// field for field --
|
|
2387
|
+
// field for field -- a `WithKey<Item>`, whose `_id` the
|
|
2341
2388
|
// omit drops and the intersection puts back with the same type. It is
|
|
2342
2389
|
// `D` to the language (identical properties), and a separately laid-out
|
|
2343
|
-
// record for it would give `
|
|
2344
|
-
// `
|
|
2390
|
+
// record for it would give `Cursor<WithKey<Item>>` and
|
|
2391
|
+
// `Cursor<Item>` two layouts that no conversion may join
|
|
2345
2392
|
// without breaking the objects' aliasing. Asked for a named alias too:
|
|
2346
|
-
// `
|
|
2393
|
+
// `WithKey` is one, and its name states no host carrier.
|
|
2347
2394
|
const restated = restatedDeclaredOf(type);
|
|
2348
2395
|
if (restated !== null)
|
|
2349
2396
|
return remember(type, typeOf(restated));
|
|
@@ -2365,7 +2412,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2365
2412
|
// checker reconciles `{ waitMS: number } & T` through `T`'s CONSTRAINT,
|
|
2366
2413
|
// while `members` above carry the copy's own filling of `T`. Reading
|
|
2367
2414
|
// the reconciliation there drops every member the filling has beyond
|
|
2368
|
-
// its bound (
|
|
2415
|
+
// its bound (a generic `resolveOptions<T>` lost `name` off a
|
|
2369
2416
|
// `Named & Timeouts` filling), so the substituted members stand alone.
|
|
2370
2417
|
const resolved = carriesDeferredForm(type) || type.types.some((part) => (part.flags & ts.TypeFlags.TypeParameter) !== 0)
|
|
2371
2418
|
? null
|
|
@@ -2389,12 +2436,12 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2389
2436
|
// A class or interface's own type parameter that never reaches a stored
|
|
2390
2437
|
// field -- `layoutRelevantParameterIndices`'s own question -- is folded
|
|
2391
2438
|
// to one canonical placeholder instead of its real argument. Two
|
|
2392
|
-
// instantiations that disagree ONLY on such a parameter (
|
|
2393
|
-
// `
|
|
2394
|
-
//
|
|
2439
|
+
// instantiations that disagree ONLY on such a parameter (a fluent
|
|
2440
|
+
// builder `App<E,S,BasePath>` across every distinct chained call,
|
|
2441
|
+
// `S` never stored) are the SAME physical layout, and
|
|
2395
2442
|
// keying them apart mints one specialization per call site -- the
|
|
2396
|
-
// shape of the
|
|
2397
|
-
// off. `
|
|
2443
|
+
// shape of the producer stack overflow this exists to cut
|
|
2444
|
+
// off. An `App<E,...>`'s `env: E['Bindings']` keeps `E` unerased: an
|
|
2398
2445
|
// unproven position is never folded, only one the field walk actually
|
|
2399
2446
|
// proved irrelevant.
|
|
2400
2447
|
const genericOwner = ts.isClassLike(declared.declarationNode) || ts.isInterfaceDeclaration(declared.declarationNode) ? declared.declarationNode : null;
|
|
@@ -2444,7 +2491,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2444
2491
|
// has one layout, its `any` copy, and every concrete instantiation is
|
|
2445
2492
|
// only a view of it. That copy may have no checker spelling at all, so
|
|
2446
2493
|
// its body is built from the class's own declared type read through
|
|
2447
|
-
// the copy's bindings -- `transform: (doc:
|
|
2494
|
+
// the copy's bindings -- `transform: (doc: T) => any` as
|
|
2448
2495
|
// `(doc: any) => any` -- and never from the concrete view that happened
|
|
2449
2496
|
// to reach the anchor first, which would store one view's filling.
|
|
2450
2497
|
const reinterpretedOrdinal = declared.kind === 'class-instance' && genericOwner && ts.isClassLike(genericOwner)
|
|
@@ -2656,8 +2703,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2656
2703
|
// `typeOfSymbolAt`), which is available here and strictly more truthful
|
|
2657
2704
|
// than borrowing an unrelated member's node. Every member with a
|
|
2658
2705
|
// declaration still resolves at its own, so nothing that already worked
|
|
2659
|
-
// moves; what this unblocks is
|
|
2660
|
-
// here with no member declaration anywhere
|
|
2706
|
+
// moves; what this unblocks is JSDoc-typed JavaScript, whose objects
|
|
2707
|
+
// reach here with no member declaration anywhere.
|
|
2661
2708
|
const anchorLocation = type
|
|
2662
2709
|
.getProperties()
|
|
2663
2710
|
.map((property) => identities.declarationOfSymbol(property))
|
|
@@ -2687,12 +2734,12 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2687
2734
|
// this empty shape will either fabricate a fresh, identity-unrelated empty
|
|
2688
2735
|
// struct -- breaking anything that depended on WHICH object it was, a
|
|
2689
2736
|
// WeakMap key or an `===` -- or be reinterpreted as a struct type it never
|
|
2690
|
-
// was.
|
|
2691
|
-
//
|
|
2737
|
+
// was. The measured form is a key argument to a bare `new WeakMap()`
|
|
2738
|
+
// in untyped JavaScript, where TS's
|
|
2692
2739
|
// own `K extends object = object` default filled in for inference it had
|
|
2693
2740
|
// nothing to work from. The cure is upstream -- infer the collection's type
|
|
2694
2741
|
// arguments from its uses -- NOT a carrier general enough to swallow the
|
|
2695
|
-
// question, which would box
|
|
2742
|
+
// question, which would box a hot path and hide the gap.
|
|
2696
2743
|
if (type.flags & ts.TypeFlags.NonPrimitive)
|
|
2697
2744
|
return remember(type, table.intern({ kind: 'object', members: [], index: [], membersDropped: false }));
|
|
2698
2745
|
// A SUBSTITUTION type is its base type, with a narrower constraint the
|
|
@@ -2707,7 +2754,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2707
2754
|
//
|
|
2708
2755
|
// Not any of the flags the tests above match, so without this a
|
|
2709
2756
|
// substitution falls through to the bare-flags refusal below. Measured
|
|
2710
|
-
//
|
|
2757
|
+
// at zero sites so far and kept for the reason the reduction itself
|
|
2711
2758
|
// states: a form the language erases must not be a refusal, and the one
|
|
2712
2759
|
// line costs nothing.
|
|
2713
2760
|
if (type.flags & ts.TypeFlags.Substitution)
|
|
@@ -2734,14 +2781,14 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2734
2781
|
journal?.push(type); // so an unwind can take it back -- see `typeOf`'s retry
|
|
2735
2782
|
return id;
|
|
2736
2783
|
};
|
|
2737
|
-
const layoutTypeAt = createLayoutTypeResolver(checker, parameters, absent);
|
|
2784
|
+
const layoutTypeAt = createLayoutTypeResolver(checker, parameters, absent, nativeClassAliasTypeAt);
|
|
2738
2785
|
/**
|
|
2739
2786
|
* The type at a node, with an absent host type collapsed -- and with that
|
|
2740
2787
|
* collapse followed through a member read.
|
|
2741
2788
|
*
|
|
2742
2789
|
* `substituteAbsentType` answers about the type a node was declared with, so
|
|
2743
2790
|
* it collapses the RECEIVER on its own: `canvas`, declared
|
|
2744
|
-
* `HTMLCanvasElement` by
|
|
2791
|
+
* `HTMLCanvasElement` by a library's JSDoc, is `never` on a host with no DOM.
|
|
2745
2792
|
* The member read is a different node, and the checker still answers it with
|
|
2746
2793
|
* `HTMLCanvasElement.addEventListener`'s whole overload set -- so one
|
|
2747
2794
|
* expression ends up carrying two incompatible facts: a receiver no value can
|
|
@@ -2749,8 +2796,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2749
2796
|
* member is the half that has to give. Reading a property of a value that
|
|
2750
2797
|
* cannot exist produces a value that cannot exist.
|
|
2751
2798
|
*
|
|
2752
|
-
* This is not an optimization.
|
|
2753
|
-
*
|
|
2799
|
+
* This is not an optimization. On a headless rendering target, a whole
|
|
2800
|
+
* class of violations and unresolved carriers was this one shape -- `canvas.getContext`
|
|
2754
2801
|
* (five overloads) and `canvas.addEventListener`/`removeEventListener` (two
|
|
2755
2802
|
* each) -- refused as "no primitive joining N overload signatures into one
|
|
2756
2803
|
* calling convention". That refusal was correct about the overloads and
|
|
@@ -2779,9 +2826,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2779
2826
|
* the operand of the `value != null` that follows was converted to the
|
|
2780
2827
|
* zero-field record `object` lowers to -- an `adoptProduct` that allocates
|
|
2781
2828
|
* a struct and migrates the document into an alias view -- only to test
|
|
2782
|
-
* the optional for presence.
|
|
2783
|
-
*
|
|
2784
|
-
*
|
|
2829
|
+
* the optional for presence. A serializer's `isAnyArrayBuffer(value)` guard
|
|
2830
|
+
* asks that of every object it serializes, which made the wasted allocation
|
|
2831
|
+
* a measurable share of CPU on a serialization-heavy benchmark.
|
|
2785
2832
|
*/
|
|
2786
2833
|
const narrowedOnlyToObject = (type) => {
|
|
2787
2834
|
if ((type.flags & ts.TypeFlags.NonPrimitive) !== 0)
|
|
@@ -2889,8 +2936,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2889
2936
|
* a different type with different members, and asking the wrong one is how a
|
|
2890
2937
|
* constructor ends up carried as one of its own instances.
|
|
2891
2938
|
*/
|
|
2892
|
-
const
|
|
2893
|
-
const
|
|
2939
|
+
const ordinaryOwnCallableInvocationAt = createStructuralOwnCallableInvocationResolver(checker, table, flow, signatureOf, ordinaryOwnCallableSourceAt);
|
|
2940
|
+
const localUnionAt = createLocalUnionResolver(checker, table, parameters, flow, (node) => mapper.typeAt(node), (node) => (ts.isExpression(node) ? objectDescriptorReturnTypeAt(unwrapErasedExpression(node)) : null), (node) => (ts.isExpression(node) ? (ordinaryOwnCallableInvocationAt(unwrapErasedExpression(node))?.observedResult ?? null) : null));
|
|
2941
|
+
const callResultAt = createStructuralCallResultResolver(checker, table, (node) => mapper.typeAt(node), ordinaryOwnCallableInvocationAt);
|
|
2894
2942
|
const constructResultAt = createStructuralConstructResultResolver(table, (node) => mapper.typeAt(node));
|
|
2895
2943
|
const impliedPatternArrayLiteralType = (node) => {
|
|
2896
2944
|
// A tuple, or the empty literal the checker types `never[]` against a
|
|
@@ -3081,11 +3129,11 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3081
3129
|
* an id the census, which walks that generic from its own scope, never
|
|
3082
3130
|
* publishes.
|
|
3083
3131
|
*
|
|
3084
|
-
* A SELF-instantiation (`
|
|
3132
|
+
* A SELF-instantiation (`App#clone()` naming `new App<...>` with its own
|
|
3085
3133
|
* type parameters) resolves to the identical (declaration, ordinal) pair as
|
|
3086
3134
|
* the enclosing path's own last step, since `prefixFor` is inclusive of
|
|
3087
|
-
* self-containment. Appending a second frame there composes `decl|
|
|
3088
|
-
* for a copy already named `decl|
|
|
3135
|
+
* self-containment. Appending a second frame there composes `decl|App@0.0`
|
|
3136
|
+
* for a copy already named `decl|App@0` -- the spurious-nesting shape, one
|
|
3089
3137
|
* step short -- so the enclosing path is reused unchanged when its last
|
|
3090
3138
|
* step already IS this copy.
|
|
3091
3139
|
*/
|
|
@@ -3135,10 +3183,10 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3135
3183
|
* The class copy an overloaded method's value was read off, when this view
|
|
3136
3184
|
* does not already bind that class's parameters.
|
|
3137
3185
|
*
|
|
3138
|
-
* The overloads of `
|
|
3186
|
+
* The overloads of a generic `Store<Item>.find` arrive instantiated, but the
|
|
3139
3187
|
* one IMPLEMENTATION signature the value physically carries is read off the
|
|
3140
|
-
* open declaration, so a read from outside the class
|
|
3141
|
-
* `db.
|
|
3188
|
+
* open declaration, so a read from outside the class
|
|
3189
|
+
* (`db.store<Item>(name).find(filter, options)`) left `WithKey<T>`
|
|
3142
3190
|
* and its conditionals naked. The copy whose instantiated class has this
|
|
3143
3191
|
* very member type is the receiver's; reading the value under it binds the
|
|
3144
3192
|
* implementation's class parameters exactly as the method's own body is.
|
|
@@ -3251,7 +3299,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3251
3299
|
};
|
|
3252
3300
|
/**
|
|
3253
3301
|
* The signature of a member read off a receiver the CENSUS typed and the
|
|
3254
|
-
* checker carries as `any` --
|
|
3302
|
+
* checker carries as `any` -- a method reading `this.levels`
|
|
3255
3303
|
* through a descriptor-defined field -- when the member is an overload set
|
|
3256
3304
|
* the census could not narrow to one convention: `memberTypeOf`'s
|
|
3257
3305
|
* `singleConventionAt` needs the checker's resolved signature to pick, and a
|
|
@@ -3358,6 +3406,36 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3358
3406
|
: null;
|
|
3359
3407
|
const intern = (built) => table.intern(built);
|
|
3360
3408
|
const boolId = intern({ kind: 'primitive', primitive: 'boolean' });
|
|
3409
|
+
const accessor = accessorDescriptorAt ? accessorDescriptorAt(call) : flow ? sourceAccessorDescriptorOf(checker, flow, call) : null;
|
|
3410
|
+
if (accessor !== null) {
|
|
3411
|
+
const undefinedId = intern({ kind: 'primitive', primitive: 'undefined' });
|
|
3412
|
+
const callableType = (body) => {
|
|
3413
|
+
const shape = table.get(mapper.typeAt(body)).shape;
|
|
3414
|
+
if (shape.kind !== 'signature' || shape.call.length !== 1)
|
|
3415
|
+
return null;
|
|
3416
|
+
// Reflecting a Function does not bind its original receiver. Its
|
|
3417
|
+
// public invocation view retains the source result/parameter types;
|
|
3418
|
+
// the later native callable conversion preserves the actual frame.
|
|
3419
|
+
const { implicitReceiver: _implicit, ...signature } = shape.call[0];
|
|
3420
|
+
return intern({ kind: 'signature', call: [{ ...signature, thisParameter: null }], construct: [] });
|
|
3421
|
+
};
|
|
3422
|
+
const get = accessor.getter === null ? undefinedId : callableType(accessor.getter);
|
|
3423
|
+
const set = accessor.setter === null ? undefinedId : callableType(accessor.setter);
|
|
3424
|
+
if (get !== null && set !== null) {
|
|
3425
|
+
const descriptor = intern({
|
|
3426
|
+
kind: 'object',
|
|
3427
|
+
members: [
|
|
3428
|
+
{ key: { kind: 'string', value: 'get' }, type: get, optional: false, readonly: false, accessor: null },
|
|
3429
|
+
{ key: { kind: 'string', value: 'set' }, type: set, optional: false, readonly: false, accessor: null },
|
|
3430
|
+
{ key: { kind: 'string', value: 'enumerable' }, type: boolId, optional: false, readonly: false, accessor: null },
|
|
3431
|
+
{ key: { kind: 'string', value: 'configurable' }, type: boolId, optional: false, readonly: false, accessor: null }
|
|
3432
|
+
],
|
|
3433
|
+
index: [],
|
|
3434
|
+
membersDropped: false
|
|
3435
|
+
});
|
|
3436
|
+
return intern({ kind: 'union', members: [descriptor, undefinedId] });
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3361
3439
|
// The `value` this descriptor carries for one candidate receiver shape, or
|
|
3362
3440
|
// `null` when this shape names no rendering this feature supports (a plain
|
|
3363
3441
|
// `dynamic`/`unknown` receiver, an interface flattened to `membersDropped`).
|
|
@@ -3528,14 +3606,35 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3528
3606
|
}
|
|
3529
3607
|
return null;
|
|
3530
3608
|
};
|
|
3531
|
-
const
|
|
3609
|
+
const targetShape = table.get(mapper.typeAt(target)).shape;
|
|
3610
|
+
const containsArrayDescriptor = (shape, visited = new Set()) => {
|
|
3611
|
+
if (shape.kind === 'array')
|
|
3612
|
+
return true;
|
|
3613
|
+
const children = shape.kind === 'union'
|
|
3614
|
+
? shape.members
|
|
3615
|
+
: (shape.kind === 'declared' || shape.kind === 'class-instance') && shape.body !== null
|
|
3616
|
+
? [shape.body]
|
|
3617
|
+
: [];
|
|
3618
|
+
return children.some((id) => {
|
|
3619
|
+
if (visited.has(id))
|
|
3620
|
+
return false;
|
|
3621
|
+
visited.add(id);
|
|
3622
|
+
return containsArrayDescriptor(table.get(id).shape, visited);
|
|
3623
|
+
});
|
|
3624
|
+
};
|
|
3625
|
+
const valueId = valueIdOfShape(targetShape);
|
|
3532
3626
|
if (valueId === null)
|
|
3533
3627
|
return null;
|
|
3628
|
+
// An indexed accessor descriptor omits writable. Array<T> alone does
|
|
3629
|
+
// not prove each current own index remains a data property.
|
|
3630
|
+
const writableId = containsArrayDescriptor(targetShape) && literalKey !== 'length'
|
|
3631
|
+
? unionOf([boolId, intern({ kind: 'primitive', primitive: 'undefined' })])
|
|
3632
|
+
: boolId;
|
|
3534
3633
|
const descriptor = intern({
|
|
3535
3634
|
kind: 'object',
|
|
3536
3635
|
members: [
|
|
3537
3636
|
{ key: { kind: 'string', value: 'value' }, type: valueId, optional: false, readonly: false, accessor: null },
|
|
3538
|
-
{ key: { kind: 'string', value: 'writable' }, type:
|
|
3637
|
+
{ key: { kind: 'string', value: 'writable' }, type: writableId, optional: false, readonly: false, accessor: null },
|
|
3539
3638
|
{ key: { kind: 'string', value: 'enumerable' }, type: boolId, optional: false, readonly: false, accessor: null },
|
|
3540
3639
|
{ key: { kind: 'string', value: 'configurable' }, type: boolId, optional: false, readonly: false, accessor: null }
|
|
3541
3640
|
],
|
|
@@ -3682,20 +3781,29 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3682
3781
|
// `obj.getTime` where `obj` is the prototype through a parameter) is the
|
|
3683
3782
|
// prototype's own copy of it -- the receiver-taking signature above -- not
|
|
3684
3783
|
// the instance's, which is what the checker answers for the access.
|
|
3685
|
-
const prototypeObjectMemberTypeAt = (node) => {
|
|
3784
|
+
const prototypeObjectMemberTypeAt = (node, visiting = new Set()) => {
|
|
3686
3785
|
if (!ts.isPropertyAccessExpression(node))
|
|
3687
3786
|
return null;
|
|
3688
|
-
const receiver = prototypeObjectTypeAt(node.expression) ?? prototypeObjectParameterTypeAt(node.expression);
|
|
3787
|
+
const receiver = prototypeObjectTypeAt(node.expression) ?? prototypeObjectParameterTypeAt(node.expression, visiting);
|
|
3689
3788
|
if (receiver === null)
|
|
3690
3789
|
return null;
|
|
3691
3790
|
const shape = table.get(receiver).shape;
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
const
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3791
|
+
const arms = shape.kind === 'union' ? shape.members : [receiver];
|
|
3792
|
+
const members = [];
|
|
3793
|
+
for (const arm of arms) {
|
|
3794
|
+
const declared = table.get(arm).shape;
|
|
3795
|
+
if (declared.kind !== 'declared' || declared.body === null)
|
|
3796
|
+
return null;
|
|
3797
|
+
const body = table.get(declared.body).shape;
|
|
3798
|
+
if (body.kind !== 'object')
|
|
3799
|
+
return null;
|
|
3800
|
+
const member = body.members.find((candidate) => candidate.key.kind === 'string' && candidate.key.value === node.name.text);
|
|
3801
|
+
if (!member)
|
|
3802
|
+
return null;
|
|
3803
|
+
if (!members.includes(member.type))
|
|
3804
|
+
members.push(member.type);
|
|
3805
|
+
}
|
|
3806
|
+
return members.length === 1 ? members[0] : table.intern({ kind: 'union', members });
|
|
3699
3807
|
};
|
|
3700
3808
|
// A local initialized to the prototype object or one of its methods
|
|
3701
3809
|
// (`var getTime = Date.prototype.getTime`) and never written again holds
|
|
@@ -3717,7 +3825,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3717
3825
|
return null;
|
|
3718
3826
|
const writes = flow?.writesToDeclaration(declaration) ?? null;
|
|
3719
3827
|
// Only a WHOLE-slot write re-binds the cell; `f[k] = v` on the held method
|
|
3720
|
-
// (
|
|
3828
|
+
// (a writability helper writing `length`) is a member write on
|
|
3721
3829
|
// the function object the cell keeps holding.
|
|
3722
3830
|
if (writes === null || writes.some((write) => write.slot === 'whole' && write.value !== initializer))
|
|
3723
3831
|
return null;
|
|
@@ -3762,7 +3870,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3762
3870
|
// A parameter every call site hands `X.prototype` to, and every read of it:
|
|
3763
3871
|
// the census bound it to the checker's image of the argument (the instance
|
|
3764
3872
|
// type), so it is re-asked here from the argument expressions themselves.
|
|
3765
|
-
//
|
|
3873
|
+
// Disagreeing callers retain every source arm: a checker join cannot erase
|
|
3874
|
+
// one prototype handle or a method's physical receiver from that union.
|
|
3766
3875
|
const prototypeObjectParameterTypeAt = (node, visiting = new Set()) => {
|
|
3767
3876
|
const parameter = ts.isParameter(node)
|
|
3768
3877
|
? node
|
|
@@ -3775,20 +3884,70 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3775
3884
|
if (passed === null || passed.length === 0)
|
|
3776
3885
|
return null;
|
|
3777
3886
|
visiting.add(parameter);
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3887
|
+
try {
|
|
3888
|
+
const members = [];
|
|
3889
|
+
let hasSourceArm = false;
|
|
3890
|
+
for (const argument of passed) {
|
|
3891
|
+
const own = prototypeObjectTypeAt(argument) ??
|
|
3892
|
+
prototypeObjectMemberTypeAt(argument, visiting) ??
|
|
3893
|
+
prototypeObjectLocalTypeAt(argument) ??
|
|
3894
|
+
prototypeObjectParameterTypeAt(argument, visiting);
|
|
3895
|
+
hasSourceArm ||= own !== null;
|
|
3896
|
+
const id = own ?? typeOf(layoutTypeAt(argument));
|
|
3897
|
+
const shape = table.get(id).shape;
|
|
3898
|
+
for (const arm of shape.kind === 'union' ? shape.members : [id])
|
|
3899
|
+
if (!members.includes(arm))
|
|
3900
|
+
members.push(arm);
|
|
3901
|
+
}
|
|
3902
|
+
if (!hasSourceArm)
|
|
3788
3903
|
return null;
|
|
3789
|
-
|
|
3904
|
+
return members.length === 1 ? members[0] : table.intern({ kind: 'union', members });
|
|
3905
|
+
}
|
|
3906
|
+
finally {
|
|
3907
|
+
visiting.delete(parameter);
|
|
3908
|
+
}
|
|
3909
|
+
};
|
|
3910
|
+
const resolvingArgumentSources = new Set();
|
|
3911
|
+
const implicitArgumentsSourceTypeAt = (declaration, frame) => {
|
|
3912
|
+
if (frame.sourcePositions === undefined || resolvingArgumentSources.has(declaration))
|
|
3913
|
+
return null;
|
|
3914
|
+
resolvingArgumentSources.add(declaration);
|
|
3915
|
+
try {
|
|
3916
|
+
const join = (sources) => {
|
|
3917
|
+
const members = [];
|
|
3918
|
+
for (const source of sources) {
|
|
3919
|
+
const id = mapper.typeAt(source);
|
|
3920
|
+
const shape = table.get(id).shape;
|
|
3921
|
+
for (const arm of shape.kind === 'union' ? shape.members : [id]) {
|
|
3922
|
+
const sourceShape = table.get(arm).shape;
|
|
3923
|
+
const widened = sourceShape.kind === 'literal' ? table.intern({ kind: 'primitive', primitive: sourceShape.primitive }) : arm;
|
|
3924
|
+
if (!members.includes(widened))
|
|
3925
|
+
members.push(widened);
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
if (frame.sourceUndefined) {
|
|
3929
|
+
const undefinedId = table.intern({ kind: 'primitive', primitive: 'undefined' });
|
|
3930
|
+
if (!members.includes(undefinedId))
|
|
3931
|
+
members.push(undefinedId);
|
|
3932
|
+
}
|
|
3933
|
+
return members.length === 0 ? null : members.length === 1 ? members[0] : table.intern({ kind: 'union', members });
|
|
3934
|
+
};
|
|
3935
|
+
if (frame.frame === 'array') {
|
|
3936
|
+
const element = join(frame.sourcePositions.flat());
|
|
3937
|
+
return element === null ? null : table.intern({ kind: 'array', element, readonly: false, extension: [] });
|
|
3938
|
+
}
|
|
3939
|
+
const elements = [];
|
|
3940
|
+
for (const [position] of frame.elements.entries()) {
|
|
3941
|
+
const type = join(frame.sourcePositions[position] ?? []);
|
|
3942
|
+
if (type === null)
|
|
3943
|
+
return null;
|
|
3944
|
+
elements.push({ type, optional: position >= frame.required, rest: false, variadic: false });
|
|
3945
|
+
}
|
|
3946
|
+
return table.intern({ kind: 'tuple', readonly: false, elements });
|
|
3947
|
+
}
|
|
3948
|
+
finally {
|
|
3949
|
+
resolvingArgumentSources.delete(declaration);
|
|
3790
3950
|
}
|
|
3791
|
-
return agreed;
|
|
3792
3951
|
};
|
|
3793
3952
|
// The SIGNATURE side of the `unstated-never-array` rule's parameter form.
|
|
3794
3953
|
// A parameter the collection census refused as part of an array's alias
|
|
@@ -3887,8 +4046,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3887
4046
|
* only when what it wraps is an ARRAY: those wrappers evaluate to nothing of
|
|
3888
4047
|
* their own (`producers/erasure.ts`), so `citeExpressionResult` cites the
|
|
3889
4048
|
* WRAPPED expression's result -- and the pattern that then reads that result
|
|
3890
|
-
* by index was being typed off the assertion instead.
|
|
3891
|
-
*
|
|
4049
|
+
* by index was being typed off the assertion instead. The shape is
|
|
4050
|
+
* exactly: `const [createEvents,
|
|
3892
4051
|
* options] = args as [(c: Ctx) => Events, number?]` over a rest parameter,
|
|
3893
4052
|
* whose value is one Array. `lower-destructuring.ts` refused the pair --
|
|
3894
4053
|
* 'an array binding pattern's source resolved to "array-object(...)", but its
|
|
@@ -3976,8 +4135,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3976
4135
|
* -- a type with an index signature -- or `null` when no spread does.
|
|
3977
4136
|
*
|
|
3978
4137
|
* TypeScript's spread type drops the source's index signatures once the
|
|
3979
|
-
* literal writes a key of its own (`{ ...
|
|
3980
|
-
*
|
|
4138
|
+
* literal writes a key of its own (`{ ...doc, extra }` over an
|
|
4139
|
+
* `interface Doc extends { [key: string]: any }` is a closed object
|
|
3981
4140
|
* to the checker), but `CopyDataProperties` (ECMA-262 7.3.25) copies every
|
|
3982
4141
|
* own enumerable key the source holds, so the value carries keys that closed
|
|
3983
4142
|
* type does not list. A carrier derived from that type has nowhere to put
|
|
@@ -4181,8 +4340,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4181
4340
|
*/
|
|
4182
4341
|
/**
|
|
4183
4342
|
* A reference `x instanceof Map` narrowed out of a declared union whose one
|
|
4184
|
-
* map arm is a `ReadonlyMap<K, V>` --
|
|
4185
|
-
* instanceof Map && t.size > 0`. `ReadonlyMap` is not a subtype of `Map`
|
|
4343
|
+
* map arm is a `ReadonlyMap<K, V>` -- an `isMap(t: SortSpec)` written as
|
|
4344
|
+
* `t instanceof Map && t.size > 0`. `ReadonlyMap` is not a subtype of `Map`
|
|
4186
4345
|
* (it has no `set`), so the checker narrows to a synthesized `Map<any, any>`
|
|
4187
4346
|
* that no arm of the union is, and reading the arm as that would ask for a
|
|
4188
4347
|
* boxing view of a typed map. The only arm whose runtime value can pass the
|
|
@@ -4211,7 +4370,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4211
4370
|
};
|
|
4212
4371
|
/**
|
|
4213
4372
|
* An `any` binding read where a guard narrowed it to lib's `ArrayBufferView`
|
|
4214
|
-
* --
|
|
4373
|
+
* -- `ArrayBuffer.isView(value) || value instanceof ArrayBuffer` over
|
|
4215
4374
|
* `value: any`, then `value.byteLength`. The interface leaves open WHICH view
|
|
4216
4375
|
* sits behind it, so its generated record is a carrier no typed array or
|
|
4217
4376
|
* DataView reaches: converting the box into it admits nothing and stops the
|
|
@@ -4265,6 +4424,28 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4265
4424
|
};
|
|
4266
4425
|
const mutableMethods = createMutableMethodResolver(checker, table, flow, signatureOf, (node) => mapper.typeAt(node), (node) => mapper.rawTypeAt(node));
|
|
4267
4426
|
const structuralRules = [
|
|
4427
|
+
{
|
|
4428
|
+
name: 'mutable-field-storage',
|
|
4429
|
+
forms: [ts.SyntaxKind.PropertyAccessExpression, ts.SyntaxKind.ElementAccessExpression],
|
|
4430
|
+
resolve: mutableFields.readTypeAt
|
|
4431
|
+
},
|
|
4432
|
+
{
|
|
4433
|
+
name: 'closed-fresh-indexed-storage',
|
|
4434
|
+
forms: [
|
|
4435
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
4436
|
+
ts.SyntaxKind.Parameter,
|
|
4437
|
+
ts.SyntaxKind.Identifier,
|
|
4438
|
+
ts.SyntaxKind.ObjectLiteralExpression,
|
|
4439
|
+
ts.SyntaxKind.CallExpression,
|
|
4440
|
+
ts.SyntaxKind.AsExpression,
|
|
4441
|
+
ts.SyntaxKind.TypeAssertionExpression,
|
|
4442
|
+
ts.SyntaxKind.ConditionalExpression,
|
|
4443
|
+
ts.SyntaxKind.BinaryExpression,
|
|
4444
|
+
ts.SyntaxKind.PropertyAccessExpression,
|
|
4445
|
+
ts.SyntaxKind.ElementAccessExpression
|
|
4446
|
+
],
|
|
4447
|
+
resolve: indexedStorageTypeAt
|
|
4448
|
+
},
|
|
4268
4449
|
{
|
|
4269
4450
|
// A read the checker narrowed to a bare class that may hold a record
|
|
4270
4451
|
// spread from it -- see `record-stand-in-arms.ts`.
|
|
@@ -4322,8 +4503,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4322
4503
|
},
|
|
4323
4504
|
{
|
|
4324
4505
|
// A CommonJS wrapper's `module` is not the ambient `{ exports: any }`
|
|
4325
|
-
// silhouette when the source
|
|
4326
|
-
//
|
|
4506
|
+
// silhouette when the source proves one exact native export. Keep the
|
|
4507
|
+
// record local to that source module and map the same
|
|
4327
4508
|
// expression at `module.exports` and a resolved `require` so a binding
|
|
4328
4509
|
// cannot store a function while its read asks for a dynamic record.
|
|
4329
4510
|
name: 'module-exports-record',
|
|
@@ -4400,10 +4581,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4400
4581
|
// value has no JSON form -- `undefined` itself, a function, a symbol
|
|
4401
4582
|
// (ECMA-262 25.5.2.1 step 12, SerializeJSONProperty's final
|
|
4402
4583
|
// `return undefined`). lib.d.ts declares `string` regardless, so a value
|
|
4403
|
-
// that may be one of those is typed here as it really behaves.
|
|
4404
|
-
//
|
|
4405
|
-
//
|
|
4406
|
-
// considers dead is the arm an old server's reply takes.
|
|
4584
|
+
// that may be one of those is typed here as it really behaves.
|
|
4585
|
+
// `JSON.stringify(reply.version) ?? 0`, whose `?? 0` TypeScript
|
|
4586
|
+
// considers dead, is the arm a reply missing that field takes.
|
|
4407
4587
|
name: 'json-stringify-may-be-undefined',
|
|
4408
4588
|
forms: [ts.SyntaxKind.CallExpression],
|
|
4409
4589
|
resolve: (node) => {
|
|
@@ -4468,8 +4648,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4468
4648
|
},
|
|
4469
4649
|
{
|
|
4470
4650
|
// A generic source function handed to a slot that states ONE closed
|
|
4471
|
-
// signature: `match: typeof match<Router<T>, T> = match
|
|
4472
|
-
// `
|
|
4651
|
+
// signature: `match: typeof match<Router<T>, T> = match`,
|
|
4652
|
+
// `const f: (x: number) => number = identity`.
|
|
4473
4653
|
//
|
|
4474
4654
|
// The checker's type for the name is the OPEN generic, which derives to
|
|
4475
4655
|
// `generic-function-set` -- a choice tag, not a callable -- while the
|
|
@@ -4934,9 +5114,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4934
5114
|
const narrowedMember = receiver.isIntersection() ? narrowedFamilyMemberOf(receiver) : null;
|
|
4935
5115
|
// Only a property the intersection's other parts RESTATE: one the
|
|
4936
5116
|
// family member alone names keeps the checker's flow-sensitive
|
|
4937
|
-
// answer.
|
|
4938
|
-
// absorbed partner, `interface-families.ts`) reads
|
|
4939
|
-
// `options.
|
|
5117
|
+
// answer. An `options: RequestOptions & Abortable` (an
|
|
5118
|
+
// absorbed partner, `interface-families.ts`) that reads
|
|
5119
|
+
// `options.resultKey` after a `== null` guard is the case: the
|
|
4940
5120
|
// declared `string | undefined` refused it as a computed key.
|
|
4941
5121
|
const restated = narrowedMember !== null &&
|
|
4942
5122
|
receiver.isIntersection() &&
|
|
@@ -4992,8 +5172,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4992
5172
|
const open = openSpreadResolutionOf(node);
|
|
4993
5173
|
if (open !== null || !ts.isObjectLiteralExpression(node) || node.properties.some(ts.isSpreadAssignment))
|
|
4994
5174
|
return open;
|
|
4995
|
-
// A literal holding such an object as a member value --
|
|
4996
|
-
//
|
|
5175
|
+
// A literal holding such an object as a member value -- a function
|
|
5176
|
+
// returning `{ headers, url }` where `headers`
|
|
4997
5177
|
// is `{ ...options.headers, 'Content-Type': ..., Metadata: true }`.
|
|
4998
5178
|
// The checker types the member by the same closed spread type, so the
|
|
4999
5179
|
// literal is rebuilt from its members, each asked here in turn.
|
|
@@ -5027,19 +5207,31 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5027
5207
|
},
|
|
5028
5208
|
{
|
|
5029
5209
|
// A literal the checker typed `any` only because it spreads a source it
|
|
5030
|
-
// could not close:
|
|
5031
|
-
// `{
|
|
5210
|
+
// could not close: a generic `emitWithContext<EventKey>` that builds
|
|
5211
|
+
// `{ sourceId, connectionId, ...args[0] }` with `args:
|
|
5032
5212
|
// Parameters<Events[EventKey]>`, whose element is `any` to the checker in
|
|
5033
5213
|
// the generic body -- and a spread of `any` makes the whole literal
|
|
5034
5214
|
// `any`. Every copy knows `args[0]` (the rest tuple closes per copy), so
|
|
5035
5215
|
// the literal's shape is its written members and the source's own data
|
|
5036
5216
|
// members, in `CopyDataProperties` order. Boxing it was a typed value
|
|
5037
5217
|
// lowered to the dynamic carrier for want of this answer.
|
|
5218
|
+
//
|
|
5219
|
+
// A spread of the `Object` top type is the same literal: `Object` is
|
|
5220
|
+
// interned as `any` (see `typeOf`), but the checker does not fold
|
|
5221
|
+
// `{ ...x }` over it to `any` the way it does over `any` itself -- it
|
|
5222
|
+
// copies `Object`'s prototype members, which state none of the keys
|
|
5223
|
+
// the copy creates.
|
|
5038
5224
|
name: 'object-literal-spreading-a-deferred-source',
|
|
5039
5225
|
forms: [ts.SyntaxKind.ObjectLiteralExpression],
|
|
5040
5226
|
resolve: (node) => ts.isObjectLiteralExpression(node) &&
|
|
5041
|
-
|
|
5042
|
-
node.
|
|
5227
|
+
node.properties.some(ts.isSpreadAssignment) &&
|
|
5228
|
+
((checker.getTypeAtLocation(node).flags & ts.TypeFlags.Any) !== 0 ||
|
|
5229
|
+
node.properties.some((property) => {
|
|
5230
|
+
if (!ts.isSpreadAssignment(property))
|
|
5231
|
+
return false;
|
|
5232
|
+
const source = checker.getNonNullableType(checker.getTypeAtLocation(property.expression));
|
|
5233
|
+
return isGlobalObjectInterface(checker, property.expression, source);
|
|
5234
|
+
}))
|
|
5043
5235
|
? spreadLiteralShapeOf(node)
|
|
5044
5236
|
: null
|
|
5045
5237
|
},
|
|
@@ -5159,9 +5351,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5159
5351
|
//
|
|
5160
5352
|
// Asked BEFORE the bag census, not after, because the two answer the
|
|
5161
5353
|
// same node about the same storage and the collection census is the one
|
|
5162
|
-
// that looked at this cell's own uses. `
|
|
5163
|
-
//
|
|
5164
|
-
// slot of
|
|
5354
|
+
// that looked at this cell's own uses. `let programs =
|
|
5355
|
+
// entryProperties.programs` is the shape: `programs` is a
|
|
5356
|
+
// slot of a property bag, so `bagShapeTypeAt` answers first
|
|
5165
5357
|
// with the slot's own type -- `Map<any, any> | undefined`, the checker's
|
|
5166
5358
|
// reading of the `new Map()` stored into it -- and the declaration kept
|
|
5167
5359
|
// `optional(keyed-collection(map, dynamic, dynamic))` while every read
|
|
@@ -5351,7 +5543,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5351
5543
|
// already read through them (`transparentConstClassAliasTarget`), and
|
|
5352
5544
|
// the cell answering the annotation instead asked for a conversion of a
|
|
5353
5545
|
// class constructor into a structural construct signature no class
|
|
5354
|
-
// constructor has (
|
|
5546
|
+
// constructor has (a class re-exported through such a double cast).
|
|
5355
5547
|
name: 'physical-class-alias',
|
|
5356
5548
|
forms: [ts.SyntaxKind.VariableDeclaration, ts.SyntaxKind.Identifier],
|
|
5357
5549
|
resolve: (node) => {
|
|
@@ -5468,10 +5660,15 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5468
5660
|
substituteTypeParameter,
|
|
5469
5661
|
typeOf,
|
|
5470
5662
|
typeAt,
|
|
5663
|
+
indexedStorageTypeAt,
|
|
5664
|
+
indexedStorageResultAt,
|
|
5471
5665
|
mutableMethodStorageTypeAt: mutableMethods.storageTypeAt,
|
|
5472
5666
|
mutableMethodReadTypeAt: mutableMethods.readTypeAt,
|
|
5667
|
+
mutableFieldStorageTypeOf: mutableFields.storageTypeOf,
|
|
5668
|
+
mutableFieldReadTypeAt: mutableFields.readTypeAt,
|
|
5473
5669
|
boundCallResultAt,
|
|
5474
5670
|
constructResultAt,
|
|
5671
|
+
ordinaryOwnCallableInvocationAt,
|
|
5475
5672
|
evolvingArrayMemberTypeAt,
|
|
5476
5673
|
objectDescriptorReturnTypeAt,
|
|
5477
5674
|
instanceTypeAt: (node) => {
|
|
@@ -5481,6 +5678,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5481
5678
|
return construct ? typeOf(construct.getReturnType()) : typeAt(node);
|
|
5482
5679
|
},
|
|
5483
5680
|
valueTypeAt: (node) => {
|
|
5681
|
+
const nativeClassAlias = nativeClassAliasTypeAt?.(node);
|
|
5682
|
+
if (nativeClassAlias)
|
|
5683
|
+
return typeOf(nativeClassAlias);
|
|
5484
5684
|
const localUnion = localUnionAt(node);
|
|
5485
5685
|
if (localUnion)
|
|
5486
5686
|
return localUnion;
|
|
@@ -5524,8 +5724,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5524
5724
|
// function has exactly one physical convention -- the initializer's.
|
|
5525
5725
|
// `structural-parts.ts`'s `memberOf` already asks this for a member;
|
|
5526
5726
|
// a module-level `const` is the same fact spelled at file scope, and
|
|
5527
|
-
//
|
|
5528
|
-
// case that showed the two answers apart.
|
|
5727
|
+
// `export const parseBody: ParseBody = async (...)` over an
|
|
5728
|
+
// overloaded `ParseBody` is the case that showed the two answers apart.
|
|
5529
5729
|
return typeOf(physicalInitializerTypeOf(checker, node, declared, parameters) ?? declared);
|
|
5530
5730
|
}
|
|
5531
5731
|
const layout = layoutTypeAt(node);
|
|
@@ -5539,8 +5739,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5539
5739
|
// The overload set is not always written as one. `[].map` over a UNION
|
|
5540
5740
|
// of two array types resolves to a callback parameter that is the
|
|
5541
5741
|
// INTERSECTION of the two arms' callbacks -- contravariance -- and an
|
|
5542
|
-
// intersection of callables is exactly an overload set.
|
|
5543
|
-
// `this.#matchResult[0].map(([[, route]]) => route)`
|
|
5742
|
+
// intersection of callables is exactly an overload set.
|
|
5743
|
+
// `this.#matchResult[0].map(([[, route]]) => route)` over such a union
|
|
5544
5744
|
// is that, and the arrow written there has one parameter list.
|
|
5545
5745
|
//
|
|
5546
5746
|
// Gated on the layout actually carrying more than one signature, so an
|
|
@@ -5562,18 +5762,17 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5562
5762
|
}
|
|
5563
5763
|
}
|
|
5564
5764
|
// TRIED AND MEASURED DEAD (2026-09-03): widening this `> 1` gate to
|
|
5565
|
-
// also fire on an unannotated trailing rest --
|
|
5566
|
-
// NewResponse = (...args) =>
|
|
5765
|
+
// also fire on an unannotated trailing rest -- `newResponse:
|
|
5766
|
+
// NewResponse = (...args) => ...` over an overloaded `NewResponse`, whose `layout` here is ONE
|
|
5567
5767
|
// TypeScript-joined signature (`args_0: any, args_1?: any, args_2?:
|
|
5568
5768
|
// unknown`), the checker's own collapse of a bare-rest literal against
|
|
5569
5769
|
// several overloads, done before this function runs. Preferring `own`
|
|
5570
|
-
// there is a no-op: isolated A/B
|
|
5571
|
-
// byte-identical -- `own`'s contextual type for the rest
|
|
5770
|
+
// there is a no-op: isolated A/B byte-identical -- `own`'s contextual type for the rest
|
|
5572
5771
|
// parameter is EQUALLY `any`/`unknown`-degraded by that same join, so
|
|
5573
5772
|
// `own`/`layout` are two views of one already-lossy checker answer,
|
|
5574
5773
|
// not two to disagree between. Also checked: the call-site census
|
|
5575
5774
|
// (`StructuralPartsInput.parameters`) never binds a rest parameter's
|
|
5576
|
-
// declaration either (`bound` null for every `...args
|
|
5775
|
+
// declaration either (`bound` null for every such `...args`,
|
|
5577
5776
|
// confirmed directly). The richer per-position record `abiBlockers`
|
|
5578
5777
|
// reports seeing comes from neither path -- likely the `args as
|
|
5579
5778
|
// Parameters<NewResponse>` cast at its one use site, narrowing a
|