@geastack/compiler 1.0.27 → 1.0.30
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 +293 -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 +57 -0
- package/dist/conversion/dynamic-wrapper.js +85 -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 +487 -0
- package/dist/ir/absent-class-arm.d.ts +5 -1
- package/dist/ir/absent-class-arm.js +51 -3
- 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 +72 -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 +1209 -37
- package/dist/ir/class-allocation-domain.d.ts +9 -0
- package/dist/ir/class-allocation-domain.js +158 -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/key-order-observation.js +3 -0
- 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-array-transport.js +37 -3
- 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 +50 -0
- package/dist/ir/native-field-view-domains.js +325 -0
- package/dist/ir/native-field-view-facts.d.ts +97 -0
- package/dist/ir/native-field-view-facts.js +354 -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-key-query.js +5 -2
- 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 +490 -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 +229 -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 +840 -71
- package/dist/ir/shake.d.ts +3 -0
- package/dist/ir/shake.js +39 -15
- 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 +7 -3
- package/dist/representation/host-templates.js +13 -5
- 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/any-cast-member-call.d.ts +36 -0
- package/dist/semantics/normalize/any-cast-member-call.js +55 -0
- 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 +459 -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 +755 -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 +34 -0
- package/dist/semantics/normalize/fresh-dictionary-storage.js +637 -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 +68 -62
- 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/boundary.js +3 -22
- package/dist/semantics/normalize/producers/cited-value-type.d.ts +19 -0
- package/dist/semantics/normalize/producers/cited-value-type.js +38 -0
- package/dist/semantics/normalize/producers/class-lifecycle.js +52 -7
- package/dist/semantics/normalize/producers/computations.js +59 -14
- 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 +210 -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 +96 -42
- 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-any-binding-consumer.d.ts +34 -0
- package/dist/semantics/normalize/structural-any-binding-consumer.js +208 -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 +52 -43
- 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 +15 -3
- package/dist/semantics/normalize/structural.js +440 -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 +633 -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 +715 -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 +235 -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 +136 -237
- 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 +329 -146
- 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 +7587 -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';
|
|
@@ -12,16 +14,19 @@ import { emptyRecordLinkFamilyCensus } from './record-link-families.js';
|
|
|
12
14
|
import { bivariantSlotArrayAliasTypeOf, bivariantSlotBindingTypeOf, bivariantSlotElementTypeOf, bivariantSlotParameterTypeOf, bivariantSlotReadTypeOf } from './bivariant-slot-parameter.js';
|
|
13
15
|
import { emptyDeclaredMemberCensus } from './structural-declarations.js';
|
|
14
16
|
import { createLocalUnionResolver } from './structural-local-union.js';
|
|
17
|
+
import { createAnyBindingConsumerLayout } from './structural-any-binding-consumer.js';
|
|
18
|
+
import { anyCastMemberCallOf } from './any-cast-member-call.js';
|
|
15
19
|
import { createMutableMethodResolver } from './structural-mutable-method.js';
|
|
20
|
+
import { createMutableFieldResolver } from './structural-mutable-field.js';
|
|
16
21
|
import { structuralArrayReadAt } from './structural-array-read.js';
|
|
17
22
|
import { enclosingArgumentsFunction, implicitArgumentsSlotOf, isArgumentsObjectIdentifier } from './implicit-arguments.js';
|
|
18
|
-
import { createStructuralCallResultResolver, createStructuralConstructResultResolver } from './structural-callable.js';
|
|
23
|
+
import { createStructuralCallResultResolver, createStructuralConstructResultResolver, createStructuralOwnCallableInvocationResolver } from './structural-callable.js';
|
|
19
24
|
import { genericFunctionChoiceMembersOf, genericSourceFunctionDeclarationOf } from './generic-function-choice.js';
|
|
20
25
|
import { isPrivateNameKey } from '../model/structural-types.js';
|
|
21
26
|
import { accessorSignatureOf, constructorImplementationSignatureOf, implementationSignatureOf, inheritedConstructSignatureOf, modifierOnlyMappedSourceOf, optionalMethodSignatureOf, declaredValueTypeOf, physicalInitializerTypeOf, physicalOverloadTypeAt, physicalStringObjectTypeAt } from './structural-declarations.js';
|
|
22
27
|
import { createKeyofResolver } from './keyof.js';
|
|
23
28
|
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';
|
|
29
|
+
import { arityAdmittedSignature, arrayPredicateNarrowedElementTypeOf, functionIntersectionMemberTypeOf, impliedPatternTargetOf, isGlobalObjectInterface, isGlobalObjectMember, isHostMethodPresenceTest, isStandardInterfaceType, isLibArrayBufferViewType, isUnusableEvidence, widestOf } from './derived-expression-type.js';
|
|
25
30
|
import { createLeafKeying, literalFor, primitiveFor, symbolKeyDeclarationOf } from './structural-leaves.js';
|
|
26
31
|
import { unwrapErasedExpression } from './producers/erasure.js';
|
|
27
32
|
import { intrinsicAccessorGetterChainOf } from './intrinsic-accessor-getter.js';
|
|
@@ -34,7 +39,8 @@ import { emptyParameterBindingCensus, parameterCensusForCopy } from './parameter
|
|
|
34
39
|
import { emptyCollectionBindingCensus } from './collection-bindings.js';
|
|
35
40
|
import { bagShapeOfType, bagShapeTypeAt, emptyObjectBagCensus } from './object-bag-bindings.js';
|
|
36
41
|
import { indexedAccessMemberTypes } from './structural-indexed-access.js';
|
|
37
|
-
import { joinedCallableOf
|
|
42
|
+
import { joinedCallableOf } from './structural-joins.js';
|
|
43
|
+
import { censusFreshDictionaryStorage, isNullPrototypeCreate, dictionaryArmIndexOf } from './fresh-dictionary-storage.js';
|
|
38
44
|
import { creationOrderOf, creationOrderedProperties } from './structural-creation-order.js';
|
|
39
45
|
import { collectionMemberResultTypeAt, contextualArrayConstructTypeAt, inferredArrayElementAt, statedCollectionTypeAt, inferredCollectionTypeArgumentsAt, unstatedNeverArray } from './structural-array-element.js';
|
|
40
46
|
import { createDeclaredBodyResolver } from './structural-declared-body.js';
|
|
@@ -58,7 +64,7 @@ import { emptyCommonJsModuleRecordCensus } from './commonjs-module-record.js';
|
|
|
58
64
|
* `T`. TypeScript computes an APPARENT type for the reference so member
|
|
59
65
|
* lookups and narrowing have a concrete shape to work against, and for an
|
|
60
66
|
* unnarrowed generic that apparent type is the parameter's base constraint --
|
|
61
|
-
* `object` inside
|
|
67
|
+
* `object` inside a `json = <T extends JSONValue | {} | InvalidJSONValue>
|
|
62
68
|
* (object: T) => ... JSON.stringify(object)` reads back as the whole
|
|
63
69
|
* constraint union.
|
|
64
70
|
*
|
|
@@ -102,8 +108,9 @@ const nativeErrorNames = new Set([
|
|
|
102
108
|
'TypeError',
|
|
103
109
|
'URIError'
|
|
104
110
|
]);
|
|
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) => {
|
|
111
|
+
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
112
|
const storageTypeOf = recordStorageFamilies(checker, flow, parameters);
|
|
113
|
+
const freshDictionaries = censusFreshDictionaryStorage(checker, flow, parameters);
|
|
107
114
|
// One disagreement list for the WHOLE mapper, for the same reason the caches
|
|
108
115
|
// below are shared: two rules answering for one node is a fact about the rule
|
|
109
116
|
// set, and a per-view list would report it once per copy that asked.
|
|
@@ -135,13 +142,13 @@ export const createStructuralMapper = (checker, identities, table, instantiation
|
|
|
135
142
|
const cached = views.get(key);
|
|
136
143
|
if (cached)
|
|
137
144
|
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);
|
|
145
|
+
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
146
|
views.set(key, built);
|
|
140
147
|
return built;
|
|
141
148
|
};
|
|
142
149
|
return mapperFor(rootSpecialization);
|
|
143
150
|
};
|
|
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) => {
|
|
151
|
+
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
152
|
const { boundByPath, bindingOf: censusBindingOf, substituteTypeParameter } = createTypeParameterSubstitution(identities, instantiations, specializations, bindingPath);
|
|
146
153
|
// What a parameter holds is a fact about the COPY this view describes: a
|
|
147
154
|
// generic body's copies are called with different carriers. Scoped once,
|
|
@@ -176,11 +183,10 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
176
183
|
* steps -- what this copy binds, what the program-wide census binds, and the
|
|
177
184
|
* author's own DEFAULT -- and only the first of those reached here, so a
|
|
178
185
|
* 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.
|
|
186
|
+
* nothing left to refuse with. A `class App<E extends Env = Env, ...>` that
|
|
187
|
+
* nothing ever instantiates as `App<Something>` is the case: every
|
|
188
|
+
* `E['Bindings']` in its methods asked about a parameter whose answer is its
|
|
189
|
+
* default, `Env`, and got the refusal instead.
|
|
184
190
|
*
|
|
185
191
|
* The default is the language's own substitution, not a guess: a reference
|
|
186
192
|
* that omits the argument IS the default, and the checker has already typed
|
|
@@ -388,15 +394,15 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
388
394
|
* carrier, which is not a cell at all.
|
|
389
395
|
*
|
|
390
396
|
* 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
|
|
397
|
+
* inside `resolvedObjectType`. A fluent builder chain can substitute `E` with
|
|
398
|
+
* a growing INTERSECTION -- `IfAnyThenEmptyObject<E extends Env ? Env extends
|
|
399
|
+
* E ? {} : E : E> & IfAnyThenEmptyObject<E2 ...> & {}`, one arm per chained
|
|
400
|
+
* call in the program -- because every call returns a builder whose
|
|
401
|
+
* environment merges the last one's. Substitution resolves `E` to that intersection
|
|
396
402
|
* perfectly well; what cannot answer `['Bindings']` is the intersection,
|
|
397
403
|
* whose constituents are CONDITIONAL types the checker leaves deferred while
|
|
398
|
-
* `E` is generic. Its base constraint is `{}`, the environment
|
|
399
|
-
*
|
|
404
|
+
* `E` is generic. Its base constraint is `{}`, the empty environment the
|
|
405
|
+
* declaration states, and `{}` declares no `Bindings` -- so the access is
|
|
400
406
|
* `undefined`, which is what `indexedAccessMemberTypes` already answers for
|
|
401
407
|
* a missing key on a real object type.
|
|
402
408
|
*
|
|
@@ -421,8 +427,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
421
427
|
// object type that genuinely declares no such member. `{}` arrived at as
|
|
422
428
|
// the constraint of a conditional the checker could not evaluate is a
|
|
423
429
|
// 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
|
|
430
|
+
// the author's claim. A field `env: E['Bindings'] = {}` is where the two
|
|
431
|
+
// part company -- in the copy whose object type is the builder chain's
|
|
426
432
|
// intersection of deferred conditionals, absence would carrier the field as
|
|
427
433
|
// `undefined`, a cell that provably cannot hold the initializer written on
|
|
428
434
|
// the very same line. `unknown` is what is actually known there, and it is
|
|
@@ -461,16 +467,68 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
461
467
|
const arms = suppressedWrites.armsAt(parameter);
|
|
462
468
|
return arms === null ? null : withForeignArms(typeOf(checker.getTypeAtLocation(parameter)), arms);
|
|
463
469
|
};
|
|
470
|
+
const dictionaryStorageType = (fact) => {
|
|
471
|
+
const entries = [...new Set(fact.component.values.map(typeOf))];
|
|
472
|
+
const value = entries.length === 1 ? entries[0] : table.intern({ kind: 'union', members: entries });
|
|
473
|
+
return table.intern({
|
|
474
|
+
kind: 'object',
|
|
475
|
+
members: [],
|
|
476
|
+
membersDropped: false,
|
|
477
|
+
index: [{ key: fact.key, value, readonly: false }]
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
const replaceDictionaryArms = (type, fact) => {
|
|
481
|
+
const arms = type.isUnion() ? type.types : [type];
|
|
482
|
+
if (!arms.some((arm) => dictionaryArmIndexOf(checker, arm)?.key === fact.key))
|
|
483
|
+
return null;
|
|
484
|
+
const storage = dictionaryStorageType(fact);
|
|
485
|
+
const members = [...new Set(arms.map((arm) => (dictionaryArmIndexOf(checker, arm)?.key === fact.key ? storage : typeOf(arm))))];
|
|
486
|
+
return members.length === 1 ? members[0] : table.intern({ kind: 'union', members });
|
|
487
|
+
};
|
|
488
|
+
const indexedStorageTypeAt = (node) => {
|
|
489
|
+
if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
|
|
490
|
+
const receiverType = checker.getTypeAtLocation(node.expression);
|
|
491
|
+
const receivers = receiverType.isUnion() ? receiverType.types : [receiverType];
|
|
492
|
+
const fact = freshDictionaries.storageAt(node.expression);
|
|
493
|
+
if (fact && receivers.every((arm) => dictionaryArmIndexOf(checker, arm)?.key === fact.key)) {
|
|
494
|
+
const members = fact.component.values.map(typeOf);
|
|
495
|
+
const raw = checker.getTypeAtLocation(node);
|
|
496
|
+
const rawArms = raw.isUnion() ? raw.types : [raw];
|
|
497
|
+
if (rawArms.some((arm) => (arm.flags & ts.TypeFlags.Undefined) !== 0))
|
|
498
|
+
members.push(typeOf(checker.getUndefinedType()));
|
|
499
|
+
const unique = [...new Set(members)];
|
|
500
|
+
return unique.length === 1 ? unique[0] : table.intern({ kind: 'union', members: unique });
|
|
501
|
+
}
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
const fact = freshDictionaries.storageAt(node);
|
|
505
|
+
if (fact === null)
|
|
506
|
+
return null;
|
|
507
|
+
if (ts.isObjectLiteralExpression(node) || (ts.isCallExpression(node) && isNullPrototypeCreate(checker, node)))
|
|
508
|
+
return dictionaryStorageType(fact);
|
|
509
|
+
return replaceDictionaryArms(checker.getTypeAtLocation(node), fact);
|
|
510
|
+
};
|
|
511
|
+
const indexedStorageResultAt = (node) => {
|
|
512
|
+
if (!ts.isFunctionLike(node))
|
|
513
|
+
return null;
|
|
514
|
+
const fact = freshDictionaries.resultOf(node);
|
|
515
|
+
const signature = checker.getSignatureFromDeclaration(node);
|
|
516
|
+
return fact && signature ? replaceDictionaryArms(checker.getReturnTypeOfSignature(signature), fact) : null;
|
|
517
|
+
};
|
|
518
|
+
const mutableFields = createMutableFieldResolver(checker, table, flow, (type) => typeOf(type), (node) => mapper.typeAt(node));
|
|
464
519
|
const { signatureOf, memberOf, indexesOf, tupleElementsOf } = createStructuralParts({
|
|
465
520
|
parameters,
|
|
466
521
|
checker,
|
|
467
522
|
identities,
|
|
468
523
|
typeOf: (type) => typeOf(type),
|
|
469
524
|
layoutTypeAt: (node) => layoutTypeAt(node),
|
|
470
|
-
parameterOverrideAt: (parameter) =>
|
|
525
|
+
parameterOverrideAt: (parameter) => indexedStorageTypeAt(parameter) ??
|
|
526
|
+
refusedArrayParameterTypeAt(parameter) ??
|
|
471
527
|
prototypeObjectParameterTypeAt(parameter) ??
|
|
472
528
|
bivariantSlotParameterAt(parameter) ??
|
|
473
529
|
suppressedWriteParameterAt(parameter),
|
|
530
|
+
implicitArgumentsTypeAt: (declaration, frame) => implicitArgumentsSourceTypeAt(declaration, frame),
|
|
531
|
+
resultOverrideAt: indexedStorageResultAt,
|
|
474
532
|
implicitReceiverOf,
|
|
475
533
|
declaredMemberResultOf,
|
|
476
534
|
declaredMembers,
|
|
@@ -490,6 +548,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
490
548
|
// `StructuralPartsInput.bags`.
|
|
491
549
|
bags,
|
|
492
550
|
sloppyAbsence,
|
|
551
|
+
mutableFieldStorageTypeOf: mutableFields.storageTypeOf,
|
|
493
552
|
foreignArmsOfMember: (symbol, id) => withForeignArms(id, suppressedWrites.armsOfMember(symbol))
|
|
494
553
|
});
|
|
495
554
|
const { keeperFor } = createMemberRules(identities);
|
|
@@ -508,12 +567,11 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
508
567
|
* mention of the same array got the projection too, and the array branch
|
|
509
568
|
* was never reached again.
|
|
510
569
|
*
|
|
511
|
-
* Reached that way, `
|
|
512
|
-
*
|
|
570
|
+
* Reached that way, a `Node[]` carried as a `native-record-ref`: a
|
|
571
|
+
* `const [ first, second, ... ] = nodes` asked for a
|
|
513
572
|
* `destructuring:array-pattern:native-record-ref` helper no manifest
|
|
514
|
-
* claims or should.
|
|
515
|
-
*
|
|
516
|
-
* `array-object` carriers -- an ordering leak, not a systemic
|
|
573
|
+
* claims or should. Array projections of this kind were a small minority
|
|
574
|
+
* against the honest `array-object` carriers -- an ordering leak, not a systemic
|
|
517
575
|
* misclassification, which is exactly why it survived: most arrays are
|
|
518
576
|
* reached from a position that asks the array branch first.
|
|
519
577
|
*
|
|
@@ -620,9 +678,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
620
678
|
// `Array.prototype.concat(...items: ConcatArray<T>[])` argument lands --
|
|
621
679
|
// so deriving it as a record made `a.concat(b)` refuse the rest pack it
|
|
622
680
|
// 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.
|
|
681
|
+
// every element type, in every program, e.g.
|
|
682
|
+
// `Object.keys(a).concat(Object.keys(b))` or `nodes.concat(shifted)`.
|
|
626
683
|
if (!reachesStandardArray(target, location, new Set()) &&
|
|
627
684
|
!isStandardInterfaceType(checker, location, 'ConcatArray', type))
|
|
628
685
|
return null;
|
|
@@ -665,7 +722,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
665
722
|
});
|
|
666
723
|
};
|
|
667
724
|
const objectShapeOf = (type, location, members = 'all', excluded) => {
|
|
668
|
-
|
|
725
|
+
// `Object.prototype`'s members are no shape's own data, whichever type
|
|
726
|
+
// carried them here -- see `isGlobalObjectMember`.
|
|
727
|
+
const ordered = creationOrderedProperties(checker, type, parameters).filter((property) => !isGlobalObjectMember(checker, property));
|
|
669
728
|
const properties = excluded ? ordered.filter((property) => !excluded(property)) : ordered;
|
|
670
729
|
const kept = members === 'all' ? properties : properties.filter(keeperFor(properties, members));
|
|
671
730
|
const stated = kept.flatMap((property) => {
|
|
@@ -824,17 +883,14 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
824
883
|
// K]: T }`, so an instantiation's own symbol answers the anonymous
|
|
825
884
|
// `__type` of that `MappedTypeNode` rather than the `TypeAliasDeclaration`
|
|
826
885
|
// -- 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
|
|
886
|
+
// declaration to break the cycle on, and a `class Node { #children:
|
|
887
|
+
// Record<string, Node> }` refuses as `a self-referential type of this
|
|
888
|
+
// shape is not modelled`. Routing such a type through the ALIAS instead
|
|
889
|
+
// does fix that, and it costs a whole certificate elsewhere: with the
|
|
890
|
+
// alias as the anchor, a host-bound member reached through a mapped type
|
|
891
|
+
// demands `native-boundary:__type@1`, a protocol nothing registers, and
|
|
892
|
+
// it was net WORSE in obligations as well, so there is nothing left on
|
|
893
|
+
// the other side of the trade. A cycle through a mapped alias needs `selfReferentialShapeOf` to
|
|
838
894
|
// model that shape, not a second nominal anchor for it -- which is what it
|
|
839
895
|
// now does: its dictionary case closes `Record<string, Node>` on the
|
|
840
896
|
// anchor the retry already reserved, leaving this decision untouched.
|
|
@@ -876,7 +932,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
876
932
|
// the anchor key below, folded through `layoutRelevantParameterIndices` so
|
|
877
933
|
// that two instantiations differing only in a phantom parameter share one
|
|
878
934
|
// physical layout. The copy path says nothing the arguments do not, and
|
|
879
|
-
// saying it twice is what split
|
|
935
|
+
// saying it twice is what split generic classes into a
|
|
880
936
|
// root-cited half and a copy-cited half whose members only one of the two
|
|
881
937
|
// could ever find.
|
|
882
938
|
const id = identities.declarationIdOf(declaration, rootSpecialization);
|
|
@@ -900,12 +956,12 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
900
956
|
return { kind: 'declared', declaration: id, declarationNode: declaration };
|
|
901
957
|
}
|
|
902
958
|
// A pre-`class` JavaScript CONSTRUCTOR FUNCTION's instances are nominal,
|
|
903
|
-
// and named by the function: `function
|
|
959
|
+
// and named by the function: `function Clipping( properties ) {
|
|
904
960
|
// this.uniform = uniform; ... }` gives TypeScript's own JS inference a
|
|
905
|
-
// construct signature whose return type it prints as `
|
|
961
|
+
// construct signature whose return type it prints as `Clipping`,
|
|
906
962
|
// symboled to the function declaration itself. Anchoring it here is what
|
|
907
963
|
// lets that type be SELF-REFERENTIAL, which every one of these is: the
|
|
908
|
-
// instance carries `this.setState = function (
|
|
964
|
+
// instance carries `this.setState = function ( state ) { ... }`, whose
|
|
909
965
|
// own receiver is the instance (`structural-receiver.ts`'s
|
|
910
966
|
// `jsConstructorReceiverOf`). Reached anonymously the walk collides with
|
|
911
967
|
// itself and `selfReferentialShapeOf` models no object shape with NAMED
|
|
@@ -934,9 +990,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
934
990
|
*
|
|
935
991
|
* Shared between the ordinary declared-anchor path (`translate`, below) and
|
|
936
992
|
* 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,
|
|
993
|
+
* whose OWN type argument mentions the class again -- `Node<EventMap>`
|
|
994
|
+
* where `EventMap` describes an event carrying `Node<EventMap>` as its
|
|
995
|
+
* target, the usual typed event-map pattern -- cannot
|
|
940
996
|
* compute this anchor's key up front, because the key needs the argument's
|
|
941
997
|
* structural id and deriving that id is what re-enters the class. That is a
|
|
942
998
|
* genuine cycle, not an undeclared shape: the retry mechanism already
|
|
@@ -1518,7 +1574,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1518
1574
|
try {
|
|
1519
1575
|
// A declared name (class instance, class constructor, interface, type
|
|
1520
1576
|
// alias) whose OWN type argument mentions it again -- see
|
|
1521
|
-
// `buildDeclaredShape`'s docstring for the concrete
|
|
1577
|
+
// `buildDeclaredShape`'s docstring for the concrete event-map case --
|
|
1522
1578
|
// is not an anonymous cycle `selfReferentialShapeOf` needs to know a
|
|
1523
1579
|
// fourth shape for: it is one of the three shapes the ordinary
|
|
1524
1580
|
// declared-anchor path already builds, just reached through the one
|
|
@@ -1714,8 +1770,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1714
1770
|
* below compose. The image is the checker's own instantiation of a copy's
|
|
1715
1771
|
* member type (`structural-instantiated-member.ts`); the path substitution
|
|
1716
1772
|
* 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 `
|
|
1773
|
+
* parameter wrapped in one of the operators -- `NonNullable<T>` closes
|
|
1774
|
+
* because `T` does.
|
|
1719
1775
|
*/
|
|
1720
1776
|
const closedForm = (type) => {
|
|
1721
1777
|
const image = instantiatedMembers.through(type);
|
|
@@ -1735,8 +1791,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1735
1791
|
* while `T` is open, so it keeps the conditional unreduced -- and a
|
|
1736
1792
|
* conditional type names no structure, so everything downstream of it
|
|
1737
1793
|
* refused: the await's own result, the `const` it initializes, the `return`
|
|
1738
|
-
* that publishes it.
|
|
1739
|
-
*
|
|
1794
|
+
* that publishes it. In a library that is generic almost everywhere this
|
|
1795
|
+
* is the single largest root of refusals.
|
|
1740
1796
|
*
|
|
1741
1797
|
* Monomorphization has already closed the hole this walk is inside, so the
|
|
1742
1798
|
* reduction is not deferred any more -- only the checker's ability to spell
|
|
@@ -1757,10 +1813,10 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1757
1813
|
*
|
|
1758
1814
|
* `NonNullable` is NOT gated on `TypeFlags.Conditional`, and that is not an
|
|
1759
1815
|
* 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<
|
|
1816
|
+
* arrives as an INTERSECTION. A generic method
|
|
1817
|
+
* `transform(item: NonNullable<T>): Promise<NonNullable<T>>`, awaited in
|
|
1818
|
+
* several copies, is the case -- and gating on the flag is what left
|
|
1819
|
+
* it unreduced while the bare `Awaited<T>` beside it reduced fine.
|
|
1764
1820
|
*/
|
|
1765
1821
|
const reducedOperator = (type) => {
|
|
1766
1822
|
const awaited = operatorArgument(type, 'Awaited');
|
|
@@ -1781,7 +1837,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1781
1837
|
* A DEFERRED `Parameters<F>`, laid out as the tuple of the parameters the
|
|
1782
1838
|
* closed `F` declares.
|
|
1783
1839
|
*
|
|
1784
|
-
*
|
|
1840
|
+
* A typed event emitter `Emitter<Events>` can declare helpers as
|
|
1785
1841
|
* `emitAndLog<EventKey extends keyof Events>(event: EventKey | symbol,
|
|
1786
1842
|
* ...args: Parameters<Events[EventKey]>)`. Each call site's copy binds both
|
|
1787
1843
|
* `Events` (the subclass's event map) and `EventKey` (the literal event
|
|
@@ -1871,20 +1927,20 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1871
1927
|
// `getAwaitedType` reduction below it only ever ran for a `NonNullable`,
|
|
1872
1928
|
// which since TypeScript 4.8 arrives as an INTERSECTION instead.
|
|
1873
1929
|
//
|
|
1874
|
-
//
|
|
1930
|
+
// A generic `readBody<T>` is the case:
|
|
1875
1931
|
// `Promise.resolve(fromBuffer(raw, request))` over a
|
|
1876
1932
|
// `(buf, request) => T | Promise<T>` types as
|
|
1877
1933
|
// `Promise<Awaited<T | Promise<T>>>`, and the copy that closed `T` got the
|
|
1878
|
-
// refusal rather than the reduction --
|
|
1879
|
-
//
|
|
1934
|
+
// refusal rather than the reduction -- a `promise(unresolved)` obligation
|
|
1935
|
+
// at every such site.
|
|
1880
1936
|
//
|
|
1881
1937
|
// Safe ahead of the refusal because this reads only `aliasSymbol` and
|
|
1882
1938
|
// `aliasTypeArguments`, two plain fields on the type object, and calls the
|
|
1883
1939
|
// checker only with an argument monomorphization has already CLOSED. What
|
|
1884
1940
|
// the refusal is positioned to come before is declared-alias
|
|
1885
1941
|
// NORMALIZATION further down, which asks a recursive conditional alias to
|
|
1886
|
-
// instantiate the very form it deferred --
|
|
1887
|
-
// accumulator (`IfAnyThenEmptyObject<...>`, one alias deeper per
|
|
1942
|
+
// instantiate the very form it deferred -- a fluent builder's environment
|
|
1943
|
+
// accumulator (`IfAnyThenEmptyObject<...>`, one alias deeper per chained call)
|
|
1888
1944
|
// exhausted TypeScript's stack there. That alias is neither `Awaited` nor
|
|
1889
1945
|
// `NonNullable`, so `operatorArgument` rejects it on the name and this
|
|
1890
1946
|
// line returns before any checker call.
|
|
@@ -1916,7 +1972,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1916
1972
|
// language is assignable to it, so it states nothing about what a
|
|
1917
1973
|
// particular cell holds. `derived-expression-type.ts`'s
|
|
1918
1974
|
// `annotationStatesNothing` has said exactly that for a long time, and
|
|
1919
|
-
//
|
|
1975
|
+
// JSDoc `@type {Object}` / `@return {Object}` tags reach this very
|
|
1920
1976
|
// interface -- but only the write-discovery CENSUSES consulted it, so
|
|
1921
1977
|
// this layer went on interning `Object` as a `declared` shape with a
|
|
1922
1978
|
// real body, and `representation/derive.ts` went on turning that body
|
|
@@ -1924,9 +1980,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1924
1980
|
// authorities, one saying "states nothing" and the other emitting a
|
|
1925
1981
|
// layout for it.
|
|
1926
1982
|
//
|
|
1927
|
-
// Nothing can be stored in that struct.
|
|
1928
|
-
//
|
|
1929
|
-
// node -- `boolean`, an `HTMLElement` handle, an object literal and an
|
|
1983
|
+
// Nothing can be stored in that struct. It was the target of unmet
|
|
1984
|
+
// conversion obligations whose pair simply has no node -- `boolean`, an `HTMLElement` handle, an object literal and an
|
|
1930
1985
|
// array of class instances all flowing into a cell typed `?Object` --
|
|
1931
1986
|
// and no conversion could exist for any of them, because the target
|
|
1932
1987
|
// layout was never real.
|
|
@@ -1984,10 +2039,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
1984
2039
|
// `SymbolFlags.Class` alongside `Function`, `getDeclaredTypeOfSymbol`
|
|
1985
2040
|
// answers with the inferred instance type exactly as it does for a
|
|
1986
2041
|
// 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
|
|
2042
|
+
// `isClassLike` alone said no. Pre-`class` JavaScript libraries are
|
|
2043
|
+
// written this way throughout, and every `this.` inside one reached
|
|
2044
|
+
// representation as an uninstantiated parameter. The flag is checked rather than the syntax because the
|
|
1991
2045
|
// syntax is the only thing that differs.
|
|
1992
2046
|
if (symbol && declaration && (ts.isClassLike(declaration) || (symbol.flags & ts.SymbolFlags.Class) !== 0)) {
|
|
1993
2047
|
// Routed through the class's own declared type rather than interned
|
|
@@ -2027,20 +2081,20 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2027
2081
|
// base carried a naked parameter into its own field layout, which the
|
|
2028
2082
|
// deriver correctly refused ("field \"el\" carries unresolved(type
|
|
2029
2083
|
// parameter ... reached representation without monomorphization)") and
|
|
2030
|
-
// which cost
|
|
2084
|
+
// which cost a font-rendering program its whole emission.
|
|
2031
2085
|
//
|
|
2032
2086
|
// After the two bindings above on purpose: a copy that really did
|
|
2033
2087
|
// substitute something must keep what it substituted, and the default is
|
|
2034
2088
|
// only the answer when nothing did.
|
|
2035
2089
|
//
|
|
2036
|
-
// Measured cost, stated rather than hidden:
|
|
2037
|
-
//
|
|
2090
|
+
// Measured cost, stated rather than hidden: programs that reach DOM
|
|
2091
|
+
// generics gain boxed carriers, because `lib.dom`'s `E = Element`
|
|
2038
2092
|
// and `lib.es5`'s `TArrayBuffer = ArrayBuffer` resolve to types no host
|
|
2039
|
-
// table claims a carrier for. None of
|
|
2093
|
+
// table claims a carrier for. None of them compiles either way, and
|
|
2040
2094
|
// before this they were the same values counted as missing primitives
|
|
2041
2095
|
// rather than as boxes -- neither state is native, and the cure for both
|
|
2042
2096
|
// is a carrier for `Element`, not a naked type parameter. Excluding
|
|
2043
|
-
// defaults of `any` was tried and measured: it moved the number
|
|
2097
|
+
// defaults of `any` was tried and measured: it barely moved the number.
|
|
2044
2098
|
//
|
|
2045
2099
|
// The default is asked of THIS parameter, not re-typed from its
|
|
2046
2100
|
// declaration node. A method's default can name the enclosing
|
|
@@ -2049,7 +2103,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2049
2103
|
// `Promise`'s open `T` even when the receiver was `Promise<Response>`
|
|
2050
2104
|
// and the checker had already instantiated the default to `Response`.
|
|
2051
2105
|
// That open `T` reached representation through a promise method read as
|
|
2052
|
-
// a VALUE with no call to bind it --
|
|
2106
|
+
// a VALUE with no call to bind it -- an `isPromise` guard
|
|
2053
2107
|
// (`typeof (res as Promise<Response>).then === 'function'`) -- and the
|
|
2054
2108
|
// function-value carrier `(...)->promise(unresolved)` had no emitter
|
|
2055
2109
|
// recipe. `getDefaultFromTypeParameter` returns the instantiated default
|
|
@@ -2124,8 +2178,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2124
2178
|
const indexType = resolvedIndexType(access.indexType);
|
|
2125
2179
|
// `any[K]` is `any` and `unknown[K]` is an error the checker already
|
|
2126
2180
|
// 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
|
|
2181
|
+
// reports a gap where the program declared one. A `Handler<E = any>`
|
|
2182
|
+
// binds `E` to `any` in one of a generic class's copies, so `E['Bindings']`
|
|
2129
2183
|
// there is the top type by the language's own rule, not a hole this
|
|
2130
2184
|
// layer failed to fill. Answering with the object type itself adds no
|
|
2131
2185
|
// dynamism: it IS the declared-any the program already carries.
|
|
@@ -2146,8 +2200,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2146
2200
|
}
|
|
2147
2201
|
const substituted = objectType === access.objectType && indexType === access.indexType ? null : indexedAccessMemberTypes(checker, objectType, indexType);
|
|
2148
2202
|
// 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. `
|
|
2203
|
+
// what this copy substituted into it, and the two disagree in
|
|
2204
|
+
// favour of the first. A `class App<E extends Env>`'s `env: E['Bindings']`
|
|
2151
2205
|
// has `Env`'s own `Bindings?: Record<string, unknown>` as its bound
|
|
2152
2206
|
// answer -- a dictionary that may be absent, which is what the
|
|
2153
2207
|
// declaration says. The substituted intersection's bound is `{}`, which
|
|
@@ -2156,8 +2210,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2156
2210
|
// Both are upper bounds; the tighter one is not always the truer one,
|
|
2157
2211
|
// and the one the author stated outranks the one a copy produced.
|
|
2158
2212
|
// A substitution that answers pure ABSENCE steps aside for the bound, and
|
|
2159
|
-
//
|
|
2160
|
-
//
|
|
2213
|
+
// a field `env: E['Bindings'] = {}` is why. The copy that binds `E` to
|
|
2214
|
+
// an empty environment (`{}`) really does have no `Bindings` member, so absence is
|
|
2161
2215
|
// the language's own answer for a READ there -- but the field's STORAGE
|
|
2162
2216
|
// was sized by the declaration, which TypeScript checked against `E`'s
|
|
2163
2217
|
// constraint `Env`, where `Bindings?: Record<string, unknown>`. That is
|
|
@@ -2201,8 +2255,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2201
2255
|
// BESIDE a string one. A sum with an open arm is not a sum: its arms are
|
|
2202
2256
|
// not disjoint (every value is the open arm's), a `false` handed to the
|
|
2203
2257
|
// parameter matched neither arm, and a live string was ambiguous between
|
|
2204
|
-
// them at the unbox.
|
|
2205
|
-
//
|
|
2258
|
+
// them at the unbox. A JSDoc parameter documented `{?(Object|string)}`
|
|
2259
|
+
// to which some caller passes `false` is the case. `Object`
|
|
2206
2260
|
// admits every non-nullish value -- strings included -- so the union
|
|
2207
2261
|
// states nothing the open carrier does not.
|
|
2208
2262
|
const objectMember = type.types.find((member) => {
|
|
@@ -2222,8 +2276,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2222
2276
|
// `never[]` is what an EMPTY ARRAY LITERAL with no contextual type
|
|
2223
2277
|
// checks as, and it is assignable to every array type -- so beside
|
|
2224
2278
|
// another array-like arm it names no value the union does not already
|
|
2225
|
-
// hold, and no second carrier. `(path.match(/.../g) || [])`
|
|
2226
|
-
//
|
|
2279
|
+
// hold, and no second carrier. `(path.match(/.../g) || [])` is the
|
|
2280
|
+
// shape: `RegExpMatchArray | never[]`, which
|
|
2227
2281
|
// carried as a tagged union of a match result and an EMPTY STRUCT, and
|
|
2228
2282
|
// an `Array.prototype` method on that has no static receiver at all --
|
|
2229
2283
|
// the read fell back to boxing the arm and asking a dynamic
|
|
@@ -2237,8 +2291,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2237
2291
|
// Contentless means EMPTY, not merely tuple-shaped: a tuple's numeric
|
|
2238
2292
|
// index type is the union of its own elements, so a `[T, Params]` arm
|
|
2239
2293
|
// 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
|
|
2294
|
+
// touch (a `Result<T>` whose two arms are a 1-tuple and a 2-tuple). The two contentless spellings are `never[]` and the
|
|
2242
2295
|
// zero-length tuple `[]`, which is what `x.match(re) || []` derives:
|
|
2243
2296
|
// 13.2.4.2 gives an ArrayLiteral with no elements an Array of length 0,
|
|
2244
2297
|
// and a value with no element cannot disagree with any element type, so
|
|
@@ -2277,18 +2330,11 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2277
2330
|
const assertedArms = assertedArguments.armsOf(type);
|
|
2278
2331
|
if (assertedArms)
|
|
2279
2332
|
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) }));
|
|
2333
|
+
// A union of homogeneous tables retains the native storage of whichever
|
|
2334
|
+
// table entered it. Joining their entry types would require changing that
|
|
2335
|
+
// mutable allocation's storage and every alias; a type union supplies no
|
|
2336
|
+
// such allocation proof. Exact carrier duplicates collapse in union.ts.
|
|
2337
|
+
return remember(type, table.intern({ kind: 'union', members: present.map(typeOf) }));
|
|
2292
2338
|
}
|
|
2293
2339
|
// A family view that is not a member -- an object literal the family
|
|
2294
2340
|
// adopted, or a member through `Omit` and its kin (`interface-families.ts`'s
|
|
@@ -2298,6 +2344,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2298
2344
|
if (viewMember !== null)
|
|
2299
2345
|
return remember(type, typeOf(viewMember));
|
|
2300
2346
|
if (type.isIntersection()) {
|
|
2347
|
+
const integerWidth = declaredIntegerWidthOf(type);
|
|
2348
|
+
if (integerWidth !== null)
|
|
2349
|
+
return remember(type, table.intern({ kind: 'primitive', primitive: integerWidth }));
|
|
2301
2350
|
// The alias's own anchor, recorded beside the members rather than instead
|
|
2302
2351
|
// of them: a branded alias (`type Rgb565 = number & { readonly
|
|
2303
2352
|
// __geaRgb565: unique symbol }`) erases to its substantive member, and
|
|
@@ -2326,24 +2375,24 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2326
2375
|
return remember(type, distributed);
|
|
2327
2376
|
// The same reduction for a product with no union member, taken only
|
|
2328
2377
|
// 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 `
|
|
2378
|
+
// copy's `T | null` away from null gives `Awaited<T> & ({} |
|
|
2379
|
+
// undefined)`, and the checker cannot reduce it while `T` is open;
|
|
2380
|
+
// after substitution `WithKey<Chunk> & {}` stood as an intersection
|
|
2332
2381
|
// with an `unknown` member and derived a SECOND record for the one
|
|
2333
|
-
// filling. The yield slot of
|
|
2382
|
+
// filling. The yield slot of a generic cursor class's
|
|
2334
2383
|
// `[Symbol.asyncIterator]` held that record while the narrowed read held
|
|
2335
2384
|
// the filling's own, and no conversion joins two records of one type.
|
|
2336
2385
|
const collapsed = declaration === null ? collapsedIntersectionOf(members) : undefined;
|
|
2337
2386
|
if (collapsed !== undefined)
|
|
2338
2387
|
return remember(type, collapsed ?? typeOf(checker.getNeverType()));
|
|
2339
2388
|
// `Pick<D, Exclude<keyof D, K>> & { [k in K]: D[k] }` restores `D`
|
|
2340
|
-
// field for field --
|
|
2389
|
+
// field for field -- a `WithKey<Item>`, whose `_id` the
|
|
2341
2390
|
// omit drops and the intersection puts back with the same type. It is
|
|
2342
2391
|
// `D` to the language (identical properties), and a separately laid-out
|
|
2343
|
-
// record for it would give `
|
|
2344
|
-
// `
|
|
2392
|
+
// record for it would give `Cursor<WithKey<Item>>` and
|
|
2393
|
+
// `Cursor<Item>` two layouts that no conversion may join
|
|
2345
2394
|
// without breaking the objects' aliasing. Asked for a named alias too:
|
|
2346
|
-
// `
|
|
2395
|
+
// `WithKey` is one, and its name states no host carrier.
|
|
2347
2396
|
const restated = restatedDeclaredOf(type);
|
|
2348
2397
|
if (restated !== null)
|
|
2349
2398
|
return remember(type, typeOf(restated));
|
|
@@ -2365,7 +2414,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2365
2414
|
// checker reconciles `{ waitMS: number } & T` through `T`'s CONSTRAINT,
|
|
2366
2415
|
// while `members` above carry the copy's own filling of `T`. Reading
|
|
2367
2416
|
// the reconciliation there drops every member the filling has beyond
|
|
2368
|
-
// its bound (
|
|
2417
|
+
// its bound (a generic `resolveOptions<T>` lost `name` off a
|
|
2369
2418
|
// `Named & Timeouts` filling), so the substituted members stand alone.
|
|
2370
2419
|
const resolved = carriesDeferredForm(type) || type.types.some((part) => (part.flags & ts.TypeFlags.TypeParameter) !== 0)
|
|
2371
2420
|
? null
|
|
@@ -2389,12 +2438,12 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2389
2438
|
// A class or interface's own type parameter that never reaches a stored
|
|
2390
2439
|
// field -- `layoutRelevantParameterIndices`'s own question -- is folded
|
|
2391
2440
|
// to one canonical placeholder instead of its real argument. Two
|
|
2392
|
-
// instantiations that disagree ONLY on such a parameter (
|
|
2393
|
-
// `
|
|
2394
|
-
//
|
|
2441
|
+
// instantiations that disagree ONLY on such a parameter (a fluent
|
|
2442
|
+
// builder `App<E,S,BasePath>` across every distinct chained call,
|
|
2443
|
+
// `S` never stored) are the SAME physical layout, and
|
|
2395
2444
|
// keying them apart mints one specialization per call site -- the
|
|
2396
|
-
// shape of the
|
|
2397
|
-
// off. `
|
|
2445
|
+
// shape of the producer stack overflow this exists to cut
|
|
2446
|
+
// off. An `App<E,...>`'s `env: E['Bindings']` keeps `E` unerased: an
|
|
2398
2447
|
// unproven position is never folded, only one the field walk actually
|
|
2399
2448
|
// proved irrelevant.
|
|
2400
2449
|
const genericOwner = ts.isClassLike(declared.declarationNode) || ts.isInterfaceDeclaration(declared.declarationNode) ? declared.declarationNode : null;
|
|
@@ -2444,7 +2493,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2444
2493
|
// has one layout, its `any` copy, and every concrete instantiation is
|
|
2445
2494
|
// only a view of it. That copy may have no checker spelling at all, so
|
|
2446
2495
|
// its body is built from the class's own declared type read through
|
|
2447
|
-
// the copy's bindings -- `transform: (doc:
|
|
2496
|
+
// the copy's bindings -- `transform: (doc: T) => any` as
|
|
2448
2497
|
// `(doc: any) => any` -- and never from the concrete view that happened
|
|
2449
2498
|
// to reach the anchor first, which would store one view's filling.
|
|
2450
2499
|
const reinterpretedOrdinal = declared.kind === 'class-instance' && genericOwner && ts.isClassLike(genericOwner)
|
|
@@ -2656,8 +2705,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2656
2705
|
// `typeOfSymbolAt`), which is available here and strictly more truthful
|
|
2657
2706
|
// than borrowing an unrelated member's node. Every member with a
|
|
2658
2707
|
// declaration still resolves at its own, so nothing that already worked
|
|
2659
|
-
// moves; what this unblocks is
|
|
2660
|
-
// here with no member declaration anywhere
|
|
2708
|
+
// moves; what this unblocks is JSDoc-typed JavaScript, whose objects
|
|
2709
|
+
// reach here with no member declaration anywhere.
|
|
2661
2710
|
const anchorLocation = type
|
|
2662
2711
|
.getProperties()
|
|
2663
2712
|
.map((property) => identities.declarationOfSymbol(property))
|
|
@@ -2687,12 +2736,12 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2687
2736
|
// this empty shape will either fabricate a fresh, identity-unrelated empty
|
|
2688
2737
|
// struct -- breaking anything that depended on WHICH object it was, a
|
|
2689
2738
|
// WeakMap key or an `===` -- or be reinterpreted as a struct type it never
|
|
2690
|
-
// was.
|
|
2691
|
-
//
|
|
2739
|
+
// was. The measured form is a key argument to a bare `new WeakMap()`
|
|
2740
|
+
// in untyped JavaScript, where TS's
|
|
2692
2741
|
// own `K extends object = object` default filled in for inference it had
|
|
2693
2742
|
// nothing to work from. The cure is upstream -- infer the collection's type
|
|
2694
2743
|
// arguments from its uses -- NOT a carrier general enough to swallow the
|
|
2695
|
-
// question, which would box
|
|
2744
|
+
// question, which would box a hot path and hide the gap.
|
|
2696
2745
|
if (type.flags & ts.TypeFlags.NonPrimitive)
|
|
2697
2746
|
return remember(type, table.intern({ kind: 'object', members: [], index: [], membersDropped: false }));
|
|
2698
2747
|
// A SUBSTITUTION type is its base type, with a narrower constraint the
|
|
@@ -2707,7 +2756,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2707
2756
|
//
|
|
2708
2757
|
// Not any of the flags the tests above match, so without this a
|
|
2709
2758
|
// substitution falls through to the bare-flags refusal below. Measured
|
|
2710
|
-
//
|
|
2759
|
+
// at zero sites so far and kept for the reason the reduction itself
|
|
2711
2760
|
// states: a form the language erases must not be a refusal, and the one
|
|
2712
2761
|
// line costs nothing.
|
|
2713
2762
|
if (type.flags & ts.TypeFlags.Substitution)
|
|
@@ -2734,14 +2783,14 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2734
2783
|
journal?.push(type); // so an unwind can take it back -- see `typeOf`'s retry
|
|
2735
2784
|
return id;
|
|
2736
2785
|
};
|
|
2737
|
-
const layoutTypeAt = createLayoutTypeResolver(checker, parameters, absent);
|
|
2786
|
+
const layoutTypeAt = createLayoutTypeResolver(checker, parameters, absent, nativeClassAliasTypeAt);
|
|
2738
2787
|
/**
|
|
2739
2788
|
* The type at a node, with an absent host type collapsed -- and with that
|
|
2740
2789
|
* collapse followed through a member read.
|
|
2741
2790
|
*
|
|
2742
2791
|
* `substituteAbsentType` answers about the type a node was declared with, so
|
|
2743
2792
|
* it collapses the RECEIVER on its own: `canvas`, declared
|
|
2744
|
-
* `HTMLCanvasElement` by
|
|
2793
|
+
* `HTMLCanvasElement` by a library's JSDoc, is `never` on a host with no DOM.
|
|
2745
2794
|
* The member read is a different node, and the checker still answers it with
|
|
2746
2795
|
* `HTMLCanvasElement.addEventListener`'s whole overload set -- so one
|
|
2747
2796
|
* expression ends up carrying two incompatible facts: a receiver no value can
|
|
@@ -2749,8 +2798,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2749
2798
|
* member is the half that has to give. Reading a property of a value that
|
|
2750
2799
|
* cannot exist produces a value that cannot exist.
|
|
2751
2800
|
*
|
|
2752
|
-
* This is not an optimization.
|
|
2753
|
-
*
|
|
2801
|
+
* This is not an optimization. On a headless rendering target, a whole
|
|
2802
|
+
* class of violations and unresolved carriers was this one shape -- `canvas.getContext`
|
|
2754
2803
|
* (five overloads) and `canvas.addEventListener`/`removeEventListener` (two
|
|
2755
2804
|
* each) -- refused as "no primitive joining N overload signatures into one
|
|
2756
2805
|
* calling convention". That refusal was correct about the overloads and
|
|
@@ -2779,9 +2828,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2779
2828
|
* the operand of the `value != null` that follows was converted to the
|
|
2780
2829
|
* zero-field record `object` lowers to -- an `adoptProduct` that allocates
|
|
2781
2830
|
* a struct and migrates the document into an alias view -- only to test
|
|
2782
|
-
* the optional for presence.
|
|
2783
|
-
*
|
|
2784
|
-
*
|
|
2831
|
+
* the optional for presence. A serializer's `isAnyArrayBuffer(value)` guard
|
|
2832
|
+
* asks that of every object it serializes, which made the wasted allocation
|
|
2833
|
+
* a measurable share of CPU on a serialization-heavy benchmark.
|
|
2785
2834
|
*/
|
|
2786
2835
|
const narrowedOnlyToObject = (type) => {
|
|
2787
2836
|
if ((type.flags & ts.TypeFlags.NonPrimitive) !== 0)
|
|
@@ -2889,8 +2938,16 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
2889
2938
|
* a different type with different members, and asking the wrong one is how a
|
|
2890
2939
|
* constructor ends up carried as one of its own instances.
|
|
2891
2940
|
*/
|
|
2892
|
-
const
|
|
2893
|
-
const
|
|
2941
|
+
const ordinaryOwnCallableInvocationAt = createStructuralOwnCallableInvocationResolver(checker, table, flow, signatureOf, ordinaryOwnCallableSourceAt);
|
|
2942
|
+
const anyBindingConsumerLayoutAt = createAnyBindingConsumerLayout({
|
|
2943
|
+
checker,
|
|
2944
|
+
identities,
|
|
2945
|
+
specializations,
|
|
2946
|
+
flow,
|
|
2947
|
+
layoutAt: (copy, type) => mapperFor(copy).typeOf(type)
|
|
2948
|
+
});
|
|
2949
|
+
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));
|
|
2950
|
+
const callResultAt = createStructuralCallResultResolver(checker, table, (node) => mapper.typeAt(node), ordinaryOwnCallableInvocationAt);
|
|
2894
2951
|
const constructResultAt = createStructuralConstructResultResolver(table, (node) => mapper.typeAt(node));
|
|
2895
2952
|
const impliedPatternArrayLiteralType = (node) => {
|
|
2896
2953
|
// A tuple, or the empty literal the checker types `never[]` against a
|
|
@@ -3081,11 +3138,11 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3081
3138
|
* an id the census, which walks that generic from its own scope, never
|
|
3082
3139
|
* publishes.
|
|
3083
3140
|
*
|
|
3084
|
-
* A SELF-instantiation (`
|
|
3141
|
+
* A SELF-instantiation (`App#clone()` naming `new App<...>` with its own
|
|
3085
3142
|
* type parameters) resolves to the identical (declaration, ordinal) pair as
|
|
3086
3143
|
* 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|
|
|
3144
|
+
* self-containment. Appending a second frame there composes `decl|App@0.0`
|
|
3145
|
+
* for a copy already named `decl|App@0` -- the spurious-nesting shape, one
|
|
3089
3146
|
* step short -- so the enclosing path is reused unchanged when its last
|
|
3090
3147
|
* step already IS this copy.
|
|
3091
3148
|
*/
|
|
@@ -3135,10 +3192,10 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3135
3192
|
* The class copy an overloaded method's value was read off, when this view
|
|
3136
3193
|
* does not already bind that class's parameters.
|
|
3137
3194
|
*
|
|
3138
|
-
* The overloads of `
|
|
3195
|
+
* The overloads of a generic `Store<Item>.find` arrive instantiated, but the
|
|
3139
3196
|
* one IMPLEMENTATION signature the value physically carries is read off the
|
|
3140
|
-
* open declaration, so a read from outside the class
|
|
3141
|
-
* `db.
|
|
3197
|
+
* open declaration, so a read from outside the class
|
|
3198
|
+
* (`db.store<Item>(name).find(filter, options)`) left `WithKey<T>`
|
|
3142
3199
|
* and its conditionals naked. The copy whose instantiated class has this
|
|
3143
3200
|
* very member type is the receiver's; reading the value under it binds the
|
|
3144
3201
|
* implementation's class parameters exactly as the method's own body is.
|
|
@@ -3251,7 +3308,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3251
3308
|
};
|
|
3252
3309
|
/**
|
|
3253
3310
|
* The signature of a member read off a receiver the CENSUS typed and the
|
|
3254
|
-
* checker carries as `any` --
|
|
3311
|
+
* checker carries as `any` -- a method reading `this.levels`
|
|
3255
3312
|
* through a descriptor-defined field -- when the member is an overload set
|
|
3256
3313
|
* the census could not narrow to one convention: `memberTypeOf`'s
|
|
3257
3314
|
* `singleConventionAt` needs the checker's resolved signature to pick, and a
|
|
@@ -3358,6 +3415,36 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3358
3415
|
: null;
|
|
3359
3416
|
const intern = (built) => table.intern(built);
|
|
3360
3417
|
const boolId = intern({ kind: 'primitive', primitive: 'boolean' });
|
|
3418
|
+
const accessor = accessorDescriptorAt ? accessorDescriptorAt(call) : flow ? sourceAccessorDescriptorOf(checker, flow, call) : null;
|
|
3419
|
+
if (accessor !== null) {
|
|
3420
|
+
const undefinedId = intern({ kind: 'primitive', primitive: 'undefined' });
|
|
3421
|
+
const callableType = (body) => {
|
|
3422
|
+
const shape = table.get(mapper.typeAt(body)).shape;
|
|
3423
|
+
if (shape.kind !== 'signature' || shape.call.length !== 1)
|
|
3424
|
+
return null;
|
|
3425
|
+
// Reflecting a Function does not bind its original receiver. Its
|
|
3426
|
+
// public invocation view retains the source result/parameter types;
|
|
3427
|
+
// the later native callable conversion preserves the actual frame.
|
|
3428
|
+
const { implicitReceiver: _implicit, ...signature } = shape.call[0];
|
|
3429
|
+
return intern({ kind: 'signature', call: [{ ...signature, thisParameter: null }], construct: [] });
|
|
3430
|
+
};
|
|
3431
|
+
const get = accessor.getter === null ? undefinedId : callableType(accessor.getter);
|
|
3432
|
+
const set = accessor.setter === null ? undefinedId : callableType(accessor.setter);
|
|
3433
|
+
if (get !== null && set !== null) {
|
|
3434
|
+
const descriptor = intern({
|
|
3435
|
+
kind: 'object',
|
|
3436
|
+
members: [
|
|
3437
|
+
{ key: { kind: 'string', value: 'get' }, type: get, optional: false, readonly: false, accessor: null },
|
|
3438
|
+
{ key: { kind: 'string', value: 'set' }, type: set, optional: false, readonly: false, accessor: null },
|
|
3439
|
+
{ key: { kind: 'string', value: 'enumerable' }, type: boolId, optional: false, readonly: false, accessor: null },
|
|
3440
|
+
{ key: { kind: 'string', value: 'configurable' }, type: boolId, optional: false, readonly: false, accessor: null }
|
|
3441
|
+
],
|
|
3442
|
+
index: [],
|
|
3443
|
+
membersDropped: false
|
|
3444
|
+
});
|
|
3445
|
+
return intern({ kind: 'union', members: [descriptor, undefinedId] });
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3361
3448
|
// The `value` this descriptor carries for one candidate receiver shape, or
|
|
3362
3449
|
// `null` when this shape names no rendering this feature supports (a plain
|
|
3363
3450
|
// `dynamic`/`unknown` receiver, an interface flattened to `membersDropped`).
|
|
@@ -3528,14 +3615,35 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3528
3615
|
}
|
|
3529
3616
|
return null;
|
|
3530
3617
|
};
|
|
3531
|
-
const
|
|
3618
|
+
const targetShape = table.get(mapper.typeAt(target)).shape;
|
|
3619
|
+
const containsArrayDescriptor = (shape, visited = new Set()) => {
|
|
3620
|
+
if (shape.kind === 'array')
|
|
3621
|
+
return true;
|
|
3622
|
+
const children = shape.kind === 'union'
|
|
3623
|
+
? shape.members
|
|
3624
|
+
: (shape.kind === 'declared' || shape.kind === 'class-instance') && shape.body !== null
|
|
3625
|
+
? [shape.body]
|
|
3626
|
+
: [];
|
|
3627
|
+
return children.some((id) => {
|
|
3628
|
+
if (visited.has(id))
|
|
3629
|
+
return false;
|
|
3630
|
+
visited.add(id);
|
|
3631
|
+
return containsArrayDescriptor(table.get(id).shape, visited);
|
|
3632
|
+
});
|
|
3633
|
+
};
|
|
3634
|
+
const valueId = valueIdOfShape(targetShape);
|
|
3532
3635
|
if (valueId === null)
|
|
3533
3636
|
return null;
|
|
3637
|
+
// An indexed accessor descriptor omits writable. Array<T> alone does
|
|
3638
|
+
// not prove each current own index remains a data property.
|
|
3639
|
+
const writableId = containsArrayDescriptor(targetShape) && literalKey !== 'length'
|
|
3640
|
+
? unionOf([boolId, intern({ kind: 'primitive', primitive: 'undefined' })])
|
|
3641
|
+
: boolId;
|
|
3534
3642
|
const descriptor = intern({
|
|
3535
3643
|
kind: 'object',
|
|
3536
3644
|
members: [
|
|
3537
3645
|
{ key: { kind: 'string', value: 'value' }, type: valueId, optional: false, readonly: false, accessor: null },
|
|
3538
|
-
{ key: { kind: 'string', value: 'writable' }, type:
|
|
3646
|
+
{ key: { kind: 'string', value: 'writable' }, type: writableId, optional: false, readonly: false, accessor: null },
|
|
3539
3647
|
{ key: { kind: 'string', value: 'enumerable' }, type: boolId, optional: false, readonly: false, accessor: null },
|
|
3540
3648
|
{ key: { kind: 'string', value: 'configurable' }, type: boolId, optional: false, readonly: false, accessor: null }
|
|
3541
3649
|
],
|
|
@@ -3682,20 +3790,29 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3682
3790
|
// `obj.getTime` where `obj` is the prototype through a parameter) is the
|
|
3683
3791
|
// prototype's own copy of it -- the receiver-taking signature above -- not
|
|
3684
3792
|
// the instance's, which is what the checker answers for the access.
|
|
3685
|
-
const prototypeObjectMemberTypeAt = (node) => {
|
|
3793
|
+
const prototypeObjectMemberTypeAt = (node, visiting = new Set()) => {
|
|
3686
3794
|
if (!ts.isPropertyAccessExpression(node))
|
|
3687
3795
|
return null;
|
|
3688
|
-
const receiver = prototypeObjectTypeAt(node.expression) ?? prototypeObjectParameterTypeAt(node.expression);
|
|
3796
|
+
const receiver = prototypeObjectTypeAt(node.expression) ?? prototypeObjectParameterTypeAt(node.expression, visiting);
|
|
3689
3797
|
if (receiver === null)
|
|
3690
3798
|
return null;
|
|
3691
3799
|
const shape = table.get(receiver).shape;
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
const
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3800
|
+
const arms = shape.kind === 'union' ? shape.members : [receiver];
|
|
3801
|
+
const members = [];
|
|
3802
|
+
for (const arm of arms) {
|
|
3803
|
+
const declared = table.get(arm).shape;
|
|
3804
|
+
if (declared.kind !== 'declared' || declared.body === null)
|
|
3805
|
+
return null;
|
|
3806
|
+
const body = table.get(declared.body).shape;
|
|
3807
|
+
if (body.kind !== 'object')
|
|
3808
|
+
return null;
|
|
3809
|
+
const member = body.members.find((candidate) => candidate.key.kind === 'string' && candidate.key.value === node.name.text);
|
|
3810
|
+
if (!member)
|
|
3811
|
+
return null;
|
|
3812
|
+
if (!members.includes(member.type))
|
|
3813
|
+
members.push(member.type);
|
|
3814
|
+
}
|
|
3815
|
+
return members.length === 1 ? members[0] : table.intern({ kind: 'union', members });
|
|
3699
3816
|
};
|
|
3700
3817
|
// A local initialized to the prototype object or one of its methods
|
|
3701
3818
|
// (`var getTime = Date.prototype.getTime`) and never written again holds
|
|
@@ -3717,7 +3834,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3717
3834
|
return null;
|
|
3718
3835
|
const writes = flow?.writesToDeclaration(declaration) ?? null;
|
|
3719
3836
|
// Only a WHOLE-slot write re-binds the cell; `f[k] = v` on the held method
|
|
3720
|
-
// (
|
|
3837
|
+
// (a writability helper writing `length`) is a member write on
|
|
3721
3838
|
// the function object the cell keeps holding.
|
|
3722
3839
|
if (writes === null || writes.some((write) => write.slot === 'whole' && write.value !== initializer))
|
|
3723
3840
|
return null;
|
|
@@ -3762,7 +3879,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3762
3879
|
// A parameter every call site hands `X.prototype` to, and every read of it:
|
|
3763
3880
|
// the census bound it to the checker's image of the argument (the instance
|
|
3764
3881
|
// type), so it is re-asked here from the argument expressions themselves.
|
|
3765
|
-
//
|
|
3882
|
+
// Disagreeing callers retain every source arm: a checker join cannot erase
|
|
3883
|
+
// one prototype handle or a method's physical receiver from that union.
|
|
3766
3884
|
const prototypeObjectParameterTypeAt = (node, visiting = new Set()) => {
|
|
3767
3885
|
const parameter = ts.isParameter(node)
|
|
3768
3886
|
? node
|
|
@@ -3775,20 +3893,70 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3775
3893
|
if (passed === null || passed.length === 0)
|
|
3776
3894
|
return null;
|
|
3777
3895
|
visiting.add(parameter);
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3896
|
+
try {
|
|
3897
|
+
const members = [];
|
|
3898
|
+
let hasSourceArm = false;
|
|
3899
|
+
for (const argument of passed) {
|
|
3900
|
+
const own = prototypeObjectTypeAt(argument) ??
|
|
3901
|
+
prototypeObjectMemberTypeAt(argument, visiting) ??
|
|
3902
|
+
prototypeObjectLocalTypeAt(argument) ??
|
|
3903
|
+
prototypeObjectParameterTypeAt(argument, visiting);
|
|
3904
|
+
hasSourceArm ||= own !== null;
|
|
3905
|
+
const id = own ?? typeOf(layoutTypeAt(argument));
|
|
3906
|
+
const shape = table.get(id).shape;
|
|
3907
|
+
for (const arm of shape.kind === 'union' ? shape.members : [id])
|
|
3908
|
+
if (!members.includes(arm))
|
|
3909
|
+
members.push(arm);
|
|
3910
|
+
}
|
|
3911
|
+
if (!hasSourceArm)
|
|
3788
3912
|
return null;
|
|
3789
|
-
|
|
3913
|
+
return members.length === 1 ? members[0] : table.intern({ kind: 'union', members });
|
|
3914
|
+
}
|
|
3915
|
+
finally {
|
|
3916
|
+
visiting.delete(parameter);
|
|
3917
|
+
}
|
|
3918
|
+
};
|
|
3919
|
+
const resolvingArgumentSources = new Set();
|
|
3920
|
+
const implicitArgumentsSourceTypeAt = (declaration, frame) => {
|
|
3921
|
+
if (frame.sourcePositions === undefined || resolvingArgumentSources.has(declaration))
|
|
3922
|
+
return null;
|
|
3923
|
+
resolvingArgumentSources.add(declaration);
|
|
3924
|
+
try {
|
|
3925
|
+
const join = (sources) => {
|
|
3926
|
+
const members = [];
|
|
3927
|
+
for (const source of sources) {
|
|
3928
|
+
const id = mapper.typeAt(source);
|
|
3929
|
+
const shape = table.get(id).shape;
|
|
3930
|
+
for (const arm of shape.kind === 'union' ? shape.members : [id]) {
|
|
3931
|
+
const sourceShape = table.get(arm).shape;
|
|
3932
|
+
const widened = sourceShape.kind === 'literal' ? table.intern({ kind: 'primitive', primitive: sourceShape.primitive }) : arm;
|
|
3933
|
+
if (!members.includes(widened))
|
|
3934
|
+
members.push(widened);
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
if (frame.sourceUndefined) {
|
|
3938
|
+
const undefinedId = table.intern({ kind: 'primitive', primitive: 'undefined' });
|
|
3939
|
+
if (!members.includes(undefinedId))
|
|
3940
|
+
members.push(undefinedId);
|
|
3941
|
+
}
|
|
3942
|
+
return members.length === 0 ? null : members.length === 1 ? members[0] : table.intern({ kind: 'union', members });
|
|
3943
|
+
};
|
|
3944
|
+
if (frame.frame === 'array') {
|
|
3945
|
+
const element = join(frame.sourcePositions.flat());
|
|
3946
|
+
return element === null ? null : table.intern({ kind: 'array', element, readonly: false, extension: [] });
|
|
3947
|
+
}
|
|
3948
|
+
const elements = [];
|
|
3949
|
+
for (const [position] of frame.elements.entries()) {
|
|
3950
|
+
const type = join(frame.sourcePositions[position] ?? []);
|
|
3951
|
+
if (type === null)
|
|
3952
|
+
return null;
|
|
3953
|
+
elements.push({ type, optional: position >= frame.required, rest: false, variadic: false });
|
|
3954
|
+
}
|
|
3955
|
+
return table.intern({ kind: 'tuple', readonly: false, elements });
|
|
3956
|
+
}
|
|
3957
|
+
finally {
|
|
3958
|
+
resolvingArgumentSources.delete(declaration);
|
|
3790
3959
|
}
|
|
3791
|
-
return agreed;
|
|
3792
3960
|
};
|
|
3793
3961
|
// The SIGNATURE side of the `unstated-never-array` rule's parameter form.
|
|
3794
3962
|
// A parameter the collection census refused as part of an array's alias
|
|
@@ -3887,8 +4055,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3887
4055
|
* only when what it wraps is an ARRAY: those wrappers evaluate to nothing of
|
|
3888
4056
|
* their own (`producers/erasure.ts`), so `citeExpressionResult` cites the
|
|
3889
4057
|
* WRAPPED expression's result -- and the pattern that then reads that result
|
|
3890
|
-
* by index was being typed off the assertion instead.
|
|
3891
|
-
*
|
|
4058
|
+
* by index was being typed off the assertion instead. The shape is
|
|
4059
|
+
* exactly: `const [createEvents,
|
|
3892
4060
|
* options] = args as [(c: Ctx) => Events, number?]` over a rest parameter,
|
|
3893
4061
|
* whose value is one Array. `lower-destructuring.ts` refused the pair --
|
|
3894
4062
|
* 'an array binding pattern's source resolved to "array-object(...)", but its
|
|
@@ -3976,8 +4144,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
3976
4144
|
* -- a type with an index signature -- or `null` when no spread does.
|
|
3977
4145
|
*
|
|
3978
4146
|
* TypeScript's spread type drops the source's index signatures once the
|
|
3979
|
-
* literal writes a key of its own (`{ ...
|
|
3980
|
-
*
|
|
4147
|
+
* literal writes a key of its own (`{ ...doc, extra }` over an
|
|
4148
|
+
* `interface Doc extends { [key: string]: any }` is a closed object
|
|
3981
4149
|
* to the checker), but `CopyDataProperties` (ECMA-262 7.3.25) copies every
|
|
3982
4150
|
* own enumerable key the source holds, so the value carries keys that closed
|
|
3983
4151
|
* type does not list. A carrier derived from that type has nowhere to put
|
|
@@ -4181,8 +4349,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4181
4349
|
*/
|
|
4182
4350
|
/**
|
|
4183
4351
|
* 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`
|
|
4352
|
+
* map arm is a `ReadonlyMap<K, V>` -- an `isMap(t: SortSpec)` written as
|
|
4353
|
+
* `t instanceof Map && t.size > 0`. `ReadonlyMap` is not a subtype of `Map`
|
|
4186
4354
|
* (it has no `set`), so the checker narrows to a synthesized `Map<any, any>`
|
|
4187
4355
|
* that no arm of the union is, and reading the arm as that would ask for a
|
|
4188
4356
|
* boxing view of a typed map. The only arm whose runtime value can pass the
|
|
@@ -4211,7 +4379,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4211
4379
|
};
|
|
4212
4380
|
/**
|
|
4213
4381
|
* An `any` binding read where a guard narrowed it to lib's `ArrayBufferView`
|
|
4214
|
-
* --
|
|
4382
|
+
* -- `ArrayBuffer.isView(value) || value instanceof ArrayBuffer` over
|
|
4215
4383
|
* `value: any`, then `value.byteLength`. The interface leaves open WHICH view
|
|
4216
4384
|
* sits behind it, so its generated record is a carrier no typed array or
|
|
4217
4385
|
* DataView reaches: converting the box into it admits nothing and stops the
|
|
@@ -4265,6 +4433,39 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4265
4433
|
};
|
|
4266
4434
|
const mutableMethods = createMutableMethodResolver(checker, table, flow, signatureOf, (node) => mapper.typeAt(node), (node) => mapper.rawTypeAt(node));
|
|
4267
4435
|
const structuralRules = [
|
|
4436
|
+
{
|
|
4437
|
+
name: 'stated-any-binding-at-consumer-layout',
|
|
4438
|
+
forms: [
|
|
4439
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
4440
|
+
ts.SyntaxKind.Identifier,
|
|
4441
|
+
ts.SyntaxKind.ArrayLiteralExpression,
|
|
4442
|
+
ts.SyntaxKind.ObjectLiteralExpression,
|
|
4443
|
+
ts.SyntaxKind.CallExpression
|
|
4444
|
+
],
|
|
4445
|
+
resolve: (node) => anyBindingConsumerLayoutAt(node)
|
|
4446
|
+
},
|
|
4447
|
+
{
|
|
4448
|
+
name: 'mutable-field-storage',
|
|
4449
|
+
forms: [ts.SyntaxKind.PropertyAccessExpression, ts.SyntaxKind.ElementAccessExpression],
|
|
4450
|
+
resolve: mutableFields.readTypeAt
|
|
4451
|
+
},
|
|
4452
|
+
{
|
|
4453
|
+
name: 'closed-fresh-indexed-storage',
|
|
4454
|
+
forms: [
|
|
4455
|
+
ts.SyntaxKind.VariableDeclaration,
|
|
4456
|
+
ts.SyntaxKind.Parameter,
|
|
4457
|
+
ts.SyntaxKind.Identifier,
|
|
4458
|
+
ts.SyntaxKind.ObjectLiteralExpression,
|
|
4459
|
+
ts.SyntaxKind.CallExpression,
|
|
4460
|
+
ts.SyntaxKind.AsExpression,
|
|
4461
|
+
ts.SyntaxKind.TypeAssertionExpression,
|
|
4462
|
+
ts.SyntaxKind.ConditionalExpression,
|
|
4463
|
+
ts.SyntaxKind.BinaryExpression,
|
|
4464
|
+
ts.SyntaxKind.PropertyAccessExpression,
|
|
4465
|
+
ts.SyntaxKind.ElementAccessExpression
|
|
4466
|
+
],
|
|
4467
|
+
resolve: indexedStorageTypeAt
|
|
4468
|
+
},
|
|
4268
4469
|
{
|
|
4269
4470
|
// A read the checker narrowed to a bare class that may hold a record
|
|
4270
4471
|
// spread from it -- see `record-stand-in-arms.ts`.
|
|
@@ -4289,6 +4490,25 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4289
4490
|
: table.intern({ kind: 'union', members: [typeOf(standIn), ...recordIds] });
|
|
4290
4491
|
}
|
|
4291
4492
|
},
|
|
4493
|
+
{
|
|
4494
|
+
// `(this as any).buildAllMatchers()` into a stated slot: see `any-cast-member-call.ts`.
|
|
4495
|
+
name: 'any-cast-member-call',
|
|
4496
|
+
forms: [ts.SyntaxKind.PropertyAccessExpression, ts.SyntaxKind.CallExpression],
|
|
4497
|
+
resolve: (node) => {
|
|
4498
|
+
const found = anyCastMemberCallOf(checker, node);
|
|
4499
|
+
if (found === null)
|
|
4500
|
+
return null;
|
|
4501
|
+
const result = typeOf(found.stated);
|
|
4502
|
+
if (ts.isCallExpression(node))
|
|
4503
|
+
return result;
|
|
4504
|
+
const callable = table.intern({
|
|
4505
|
+
kind: 'signature',
|
|
4506
|
+
call: [{ parameters: [], minimumArity: 0, thisParameter: mapper.typeAt(found.receiver), result }],
|
|
4507
|
+
construct: []
|
|
4508
|
+
});
|
|
4509
|
+
return table.intern({ kind: 'union', members: [callable, typeOf(checker.getUndefinedType())] });
|
|
4510
|
+
}
|
|
4511
|
+
},
|
|
4292
4512
|
{
|
|
4293
4513
|
// `buf.equals && buf.equals(x)`: see `isHostMethodPresenceTest`.
|
|
4294
4514
|
name: 'host-method-presence-test',
|
|
@@ -4322,8 +4542,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4322
4542
|
},
|
|
4323
4543
|
{
|
|
4324
4544
|
// A CommonJS wrapper's `module` is not the ambient `{ exports: any }`
|
|
4325
|
-
// silhouette when the source
|
|
4326
|
-
//
|
|
4545
|
+
// silhouette when the source proves one exact native export. Keep the
|
|
4546
|
+
// record local to that source module and map the same
|
|
4327
4547
|
// expression at `module.exports` and a resolved `require` so a binding
|
|
4328
4548
|
// cannot store a function while its read asks for a dynamic record.
|
|
4329
4549
|
name: 'module-exports-record',
|
|
@@ -4400,10 +4620,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4400
4620
|
// value has no JSON form -- `undefined` itself, a function, a symbol
|
|
4401
4621
|
// (ECMA-262 25.5.2.1 step 12, SerializeJSONProperty's final
|
|
4402
4622
|
// `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.
|
|
4623
|
+
// that may be one of those is typed here as it really behaves.
|
|
4624
|
+
// `JSON.stringify(reply.version) ?? 0`, whose `?? 0` TypeScript
|
|
4625
|
+
// considers dead, is the arm a reply missing that field takes.
|
|
4407
4626
|
name: 'json-stringify-may-be-undefined',
|
|
4408
4627
|
forms: [ts.SyntaxKind.CallExpression],
|
|
4409
4628
|
resolve: (node) => {
|
|
@@ -4468,8 +4687,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4468
4687
|
},
|
|
4469
4688
|
{
|
|
4470
4689
|
// A generic source function handed to a slot that states ONE closed
|
|
4471
|
-
// signature: `match: typeof match<Router<T>, T> = match
|
|
4472
|
-
// `
|
|
4690
|
+
// signature: `match: typeof match<Router<T>, T> = match`,
|
|
4691
|
+
// `const f: (x: number) => number = identity`.
|
|
4473
4692
|
//
|
|
4474
4693
|
// The checker's type for the name is the OPEN generic, which derives to
|
|
4475
4694
|
// `generic-function-set` -- a choice tag, not a callable -- while the
|
|
@@ -4934,9 +5153,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4934
5153
|
const narrowedMember = receiver.isIntersection() ? narrowedFamilyMemberOf(receiver) : null;
|
|
4935
5154
|
// Only a property the intersection's other parts RESTATE: one the
|
|
4936
5155
|
// family member alone names keeps the checker's flow-sensitive
|
|
4937
|
-
// answer.
|
|
4938
|
-
// absorbed partner, `interface-families.ts`) reads
|
|
4939
|
-
// `options.
|
|
5156
|
+
// answer. An `options: RequestOptions & Abortable` (an
|
|
5157
|
+
// absorbed partner, `interface-families.ts`) that reads
|
|
5158
|
+
// `options.resultKey` after a `== null` guard is the case: the
|
|
4940
5159
|
// declared `string | undefined` refused it as a computed key.
|
|
4941
5160
|
const restated = narrowedMember !== null &&
|
|
4942
5161
|
receiver.isIntersection() &&
|
|
@@ -4992,8 +5211,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
4992
5211
|
const open = openSpreadResolutionOf(node);
|
|
4993
5212
|
if (open !== null || !ts.isObjectLiteralExpression(node) || node.properties.some(ts.isSpreadAssignment))
|
|
4994
5213
|
return open;
|
|
4995
|
-
// A literal holding such an object as a member value --
|
|
4996
|
-
//
|
|
5214
|
+
// A literal holding such an object as a member value -- a function
|
|
5215
|
+
// returning `{ headers, url }` where `headers`
|
|
4997
5216
|
// is `{ ...options.headers, 'Content-Type': ..., Metadata: true }`.
|
|
4998
5217
|
// The checker types the member by the same closed spread type, so the
|
|
4999
5218
|
// literal is rebuilt from its members, each asked here in turn.
|
|
@@ -5027,19 +5246,31 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5027
5246
|
},
|
|
5028
5247
|
{
|
|
5029
5248
|
// A literal the checker typed `any` only because it spreads a source it
|
|
5030
|
-
// could not close:
|
|
5031
|
-
// `{
|
|
5249
|
+
// could not close: a generic `emitWithContext<EventKey>` that builds
|
|
5250
|
+
// `{ sourceId, connectionId, ...args[0] }` with `args:
|
|
5032
5251
|
// Parameters<Events[EventKey]>`, whose element is `any` to the checker in
|
|
5033
5252
|
// the generic body -- and a spread of `any` makes the whole literal
|
|
5034
5253
|
// `any`. Every copy knows `args[0]` (the rest tuple closes per copy), so
|
|
5035
5254
|
// the literal's shape is its written members and the source's own data
|
|
5036
5255
|
// members, in `CopyDataProperties` order. Boxing it was a typed value
|
|
5037
5256
|
// lowered to the dynamic carrier for want of this answer.
|
|
5257
|
+
//
|
|
5258
|
+
// A spread of the `Object` top type is the same literal: `Object` is
|
|
5259
|
+
// interned as `any` (see `typeOf`), but the checker does not fold
|
|
5260
|
+
// `{ ...x }` over it to `any` the way it does over `any` itself -- it
|
|
5261
|
+
// copies `Object`'s prototype members, which state none of the keys
|
|
5262
|
+
// the copy creates.
|
|
5038
5263
|
name: 'object-literal-spreading-a-deferred-source',
|
|
5039
5264
|
forms: [ts.SyntaxKind.ObjectLiteralExpression],
|
|
5040
5265
|
resolve: (node) => ts.isObjectLiteralExpression(node) &&
|
|
5041
|
-
|
|
5042
|
-
node.
|
|
5266
|
+
node.properties.some(ts.isSpreadAssignment) &&
|
|
5267
|
+
((checker.getTypeAtLocation(node).flags & ts.TypeFlags.Any) !== 0 ||
|
|
5268
|
+
node.properties.some((property) => {
|
|
5269
|
+
if (!ts.isSpreadAssignment(property))
|
|
5270
|
+
return false;
|
|
5271
|
+
const source = checker.getNonNullableType(checker.getTypeAtLocation(property.expression));
|
|
5272
|
+
return isGlobalObjectInterface(checker, property.expression, source);
|
|
5273
|
+
}))
|
|
5043
5274
|
? spreadLiteralShapeOf(node)
|
|
5044
5275
|
: null
|
|
5045
5276
|
},
|
|
@@ -5159,9 +5390,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5159
5390
|
//
|
|
5160
5391
|
// Asked BEFORE the bag census, not after, because the two answer the
|
|
5161
5392
|
// 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
|
|
5393
|
+
// that looked at this cell's own uses. `let programs =
|
|
5394
|
+
// entryProperties.programs` is the shape: `programs` is a
|
|
5395
|
+
// slot of a property bag, so `bagShapeTypeAt` answers first
|
|
5165
5396
|
// with the slot's own type -- `Map<any, any> | undefined`, the checker's
|
|
5166
5397
|
// reading of the `new Map()` stored into it -- and the declaration kept
|
|
5167
5398
|
// `optional(keyed-collection(map, dynamic, dynamic))` while every read
|
|
@@ -5351,7 +5582,7 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5351
5582
|
// already read through them (`transparentConstClassAliasTarget`), and
|
|
5352
5583
|
// the cell answering the annotation instead asked for a conversion of a
|
|
5353
5584
|
// class constructor into a structural construct signature no class
|
|
5354
|
-
// constructor has (
|
|
5585
|
+
// constructor has (a class re-exported through such a double cast).
|
|
5355
5586
|
name: 'physical-class-alias',
|
|
5356
5587
|
forms: [ts.SyntaxKind.VariableDeclaration, ts.SyntaxKind.Identifier],
|
|
5357
5588
|
resolve: (node) => {
|
|
@@ -5468,10 +5699,16 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5468
5699
|
substituteTypeParameter,
|
|
5469
5700
|
typeOf,
|
|
5470
5701
|
typeAt,
|
|
5702
|
+
indexedStorageTypeAt,
|
|
5703
|
+
indexedStorageResultAt,
|
|
5704
|
+
statedAnyBindingLayoutAt: anyBindingConsumerLayoutAt,
|
|
5471
5705
|
mutableMethodStorageTypeAt: mutableMethods.storageTypeAt,
|
|
5472
5706
|
mutableMethodReadTypeAt: mutableMethods.readTypeAt,
|
|
5707
|
+
mutableFieldStorageTypeOf: mutableFields.storageTypeOf,
|
|
5708
|
+
mutableFieldReadTypeAt: mutableFields.readTypeAt,
|
|
5473
5709
|
boundCallResultAt,
|
|
5474
5710
|
constructResultAt,
|
|
5711
|
+
ordinaryOwnCallableInvocationAt,
|
|
5475
5712
|
evolvingArrayMemberTypeAt,
|
|
5476
5713
|
objectDescriptorReturnTypeAt,
|
|
5477
5714
|
instanceTypeAt: (node) => {
|
|
@@ -5481,6 +5718,9 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5481
5718
|
return construct ? typeOf(construct.getReturnType()) : typeAt(node);
|
|
5482
5719
|
},
|
|
5483
5720
|
valueTypeAt: (node) => {
|
|
5721
|
+
const nativeClassAlias = nativeClassAliasTypeAt?.(node);
|
|
5722
|
+
if (nativeClassAlias)
|
|
5723
|
+
return typeOf(nativeClassAlias);
|
|
5484
5724
|
const localUnion = localUnionAt(node);
|
|
5485
5725
|
if (localUnion)
|
|
5486
5726
|
return localUnion;
|
|
@@ -5524,8 +5764,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5524
5764
|
// function has exactly one physical convention -- the initializer's.
|
|
5525
5765
|
// `structural-parts.ts`'s `memberOf` already asks this for a member;
|
|
5526
5766
|
// a module-level `const` is the same fact spelled at file scope, and
|
|
5527
|
-
//
|
|
5528
|
-
// case that showed the two answers apart.
|
|
5767
|
+
// `export const parseBody: ParseBody = async (...)` over an
|
|
5768
|
+
// overloaded `ParseBody` is the case that showed the two answers apart.
|
|
5529
5769
|
return typeOf(physicalInitializerTypeOf(checker, node, declared, parameters) ?? declared);
|
|
5530
5770
|
}
|
|
5531
5771
|
const layout = layoutTypeAt(node);
|
|
@@ -5539,8 +5779,8 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5539
5779
|
// The overload set is not always written as one. `[].map` over a UNION
|
|
5540
5780
|
// of two array types resolves to a callback parameter that is the
|
|
5541
5781
|
// 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)`
|
|
5782
|
+
// intersection of callables is exactly an overload set.
|
|
5783
|
+
// `this.#matchResult[0].map(([[, route]]) => route)` over such a union
|
|
5544
5784
|
// is that, and the arrow written there has one parameter list.
|
|
5545
5785
|
//
|
|
5546
5786
|
// Gated on the layout actually carrying more than one signature, so an
|
|
@@ -5562,18 +5802,17 @@ const buildMapper = (checker, identities, table, instantiations, specializations
|
|
|
5562
5802
|
}
|
|
5563
5803
|
}
|
|
5564
5804
|
// TRIED AND MEASURED DEAD (2026-09-03): widening this `> 1` gate to
|
|
5565
|
-
// also fire on an unannotated trailing rest --
|
|
5566
|
-
// NewResponse = (...args) =>
|
|
5805
|
+
// also fire on an unannotated trailing rest -- `newResponse:
|
|
5806
|
+
// NewResponse = (...args) => ...` over an overloaded `NewResponse`, whose `layout` here is ONE
|
|
5567
5807
|
// TypeScript-joined signature (`args_0: any, args_1?: any, args_2?:
|
|
5568
5808
|
// unknown`), the checker's own collapse of a bare-rest literal against
|
|
5569
5809
|
// 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
|
|
5810
|
+
// there is a no-op: isolated A/B byte-identical -- `own`'s contextual type for the rest
|
|
5572
5811
|
// parameter is EQUALLY `any`/`unknown`-degraded by that same join, so
|
|
5573
5812
|
// `own`/`layout` are two views of one already-lossy checker answer,
|
|
5574
5813
|
// not two to disagree between. Also checked: the call-site census
|
|
5575
5814
|
// (`StructuralPartsInput.parameters`) never binds a rest parameter's
|
|
5576
|
-
// declaration either (`bound` null for every `...args
|
|
5815
|
+
// declaration either (`bound` null for every such `...args`,
|
|
5577
5816
|
// confirmed directly). The richer per-position record `abiBlockers`
|
|
5578
5817
|
// reports seeing comes from neither path -- likely the `args as
|
|
5579
5818
|
// Parameters<NewResponse>` cast at its one use site, narrowing a
|