diff --git a/compiler/forget/src/HIR/HIR.ts b/compiler/forget/src/HIR/HIR.ts index 1ad7607ec8..3ed1cc4a2f 100644 --- a/compiler/forget/src/HIR/HIR.ts +++ b/compiler/forget/src/HIR/HIR.ts @@ -455,8 +455,6 @@ export type Type = export type PrimitiveType = { kind: "Primitive" }; export type FunctionType = { kind: "Function"; - argTypes: Array; - returnType: Type; }; export type ObjectType = { kind: "Object"; properties: Map }; export type PropType = { kind: "Prop"; objectType: Type; name: string }; @@ -531,22 +529,5 @@ function propTypeEquals(tA: Type, tB: Type): boolean { } function funcTypeEquals(tA: Type, tB: Type): boolean { - if (tA.kind === "Function" && tB.kind === "Function") { - if (tA.returnType !== tB.returnType) { - return false; - } - - if (tA.argTypes.length !== tB.argTypes.length) { - return false; - } - - for (let i = 0; i < tA.argTypes.length; i++) { - if (!typeVarEquals(tA.argTypes[i], tB.argTypes[i])) { - return false; - } - } - - return true; - } - return false; + return tA.kind === "Function" && tB.kind === "Function"; } diff --git a/compiler/forget/src/HIR/InferTypes.ts b/compiler/forget/src/HIR/InferTypes.ts index 83173b4783..c5e4374e1e 100644 --- a/compiler/forget/src/HIR/InferTypes.ts +++ b/compiler/forget/src/HIR/InferTypes.ts @@ -132,20 +132,17 @@ function generateTypeEquation( break; } - // TODO(gsn): This is potentially unsafe if we're modeling JavaScript as - // these should be PolyTypes. Modeling PolyTypes seems overkill for Forget - // as we're super conservative anyway. Should we not model function - // application? case "CallExpression": { const argTypes = value.args.map((a) => a.identifier.type); + // TODO(gsn): Handle method calls separately + if (value.callee.memberPath !== null) { + break; + } + equations.push({ left: value.callee.identifier.type, - right: { - kind: "Function", - argTypes, - returnType: left ?? makeType(), - }, + right: { kind: "Function" }, }); break; @@ -231,14 +228,6 @@ class Unifier { this.bindVariableTo(tB, tA); return; } - - if (tA.kind === "Function" && tB.kind === "Function") { - const len = Math.min(tA.argTypes.length, tB.argTypes.length); - for (let i = 0; i < len; i++) { - this.unify(tA.argTypes[i], tB.argTypes[i]); - } - this.unify(tA.returnType, tB.returnType); - } } bindVariableTo(v: TypeVar, type: Type): void { @@ -291,13 +280,6 @@ class Unifier { return this.occursCheck(v, this.substitutions.get(type.name)!); } - if (type.kind === "Function") { - return ( - this.occursCheck(v, type.returnType) || - type.argTypes.some((a) => this.occursCheck(v, a)) - ); - } - if (type.kind === "Object") { return [...type.properties.values()].some((p) => this.occursCheck(v, p)); } @@ -322,14 +304,6 @@ class Unifier { } } - if (type.kind === "Function") { - return { - kind: "Function", - argTypes: type.argTypes.map((a) => this.get(a)), - returnType: this.get(type.returnType), - }; - } - return type; } diff --git a/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md b/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md index 6789d5df9f..f8b8b37698 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/_bug_conditional-break-labeled.expect.md @@ -24,7 +24,7 @@ function Component(props) { ``` bb0: - [1] Const mutate a$4_@0:TFunction[1:7] = Array [] + [1] Const mutate a$4_@0[1:7] = Array [] [2] Call mutate a$4_@0.push(read props$3.a) [3] If (read props$3.b) then:bb1 else:bb2 fallthrough=bb2 bb2: @@ -34,7 +34,7 @@ bb2: bb1: predecessor blocks: bb0 bb2 [6] Call mutate a$4_@0.push(read props$3.d) - [7] Return freeze a$4_@0:TFunction + [7] Return freeze a$4_@0 ``` ## Reactive Scopes @@ -44,11 +44,11 @@ function Component( props, ) { scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.d, read props$3.c] out=[] { - [1] Const mutate a$4_@0:TFunction[1:7] = Array [] + [1] Const mutate a$4_@0[1:7] = Array [] [2] Call mutate a$4_@0.push(read props$3.a) if (read props$3.b) { [6] Call mutate a$4_@0.push(read props$3.d) - return freeze a$4_@0:TFunction + return freeze a$4_@0 } [4] Call mutate a$4_@0.push(read props$3.c) } diff --git a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md index 7befef4675..ec62da2830 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/call.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/call.expect.md @@ -42,14 +42,14 @@ function foo$0() {} ``` bb0: - [1] Const mutate a$10_@0:TObject[1:7] = Array [] + [1] Const mutate a$10_@0[1:7] = Array [] [2] Const mutate b$11_@0:TObject[1:7] = Object { } - [3] Call mutate foo$4:TFunction(mutate a$10_@0:TObject, mutate b$11_@0:TObject) + [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject) [4] Const mutate $12:TPrimitive = "div" - [5] Const mutate _$13_@1 = JSX + [5] Const mutate _$13_@1 = JSX [6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject) [7] Const mutate $14:TPrimitive = "div" - [8] Const mutate t5$15_@2 = JSX + [8] Const mutate t5$15_@2 = JSX [9] Return read t5$15_@2 ``` @@ -60,18 +60,18 @@ function Component( props, ) { scope @0 [1:7] deps=[] out=[a$10_@0, b$11_@0] { - [1] Const mutate a$10_@0:TObject[1:7] = Array [] + [1] Const mutate a$10_@0[1:7] = Array [] [2] Const mutate b$11_@0:TObject[1:7] = Object { } - [3] Call mutate foo$4:TFunction(mutate a$10_@0:TObject, mutate b$11_@0:TObject) + [3] Call mutate foo$4:TFunction(mutate a$10_@0, mutate b$11_@0:TObject) [4] Const mutate $12:TPrimitive = "div" - scope @1 [5:6] deps=[freeze a$10_@0:TObject] out=[] { - [5] Const mutate _$13_@1 = JSX + scope @1 [5:6] deps=[freeze a$10_@0] out=[] { + [5] Const mutate _$13_@1 = JSX } [6] Call mutate foo$4:TFunction(mutate b$11_@0:TObject) } [7] Const mutate $14:TPrimitive = "div" - scope @2 [8:9] deps=[read a$10_@0:TObject, freeze b$11_@0:TObject] out=[$15_@2] { - [8] Const mutate $15_@2 = JSX + scope @2 [8:9] deps=[read a$10_@0, freeze b$11_@0:TObject] out=[$15_@2] { + [8] Const mutate $15_@2 = JSX } return read $15_@2 } diff --git a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md index 474b21088a..a4086e669d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/component.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/component.expect.md @@ -37,8 +37,8 @@ function Component(props) { bb0: [1] Const mutate items$30:TProp = read props$29.items [2] Const mutate maxItems$31:TProp = read props$29.maxItems - [3] Const mutate renderedItems$32_@0:TFunction[3:33] = Array [] - [4] Const mutate seen$33_@0:TFunction[3:33] = New mutate Set$6() + [3] Const mutate renderedItems$32_@0:TPrimitive[3:33] = Array [] + [4] Const mutate seen$33_@0[3:33] = New mutate Set$6() [5] Const mutate $34:TPrimitive = 0 [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$8.max(read $34:TPrimitive, read maxItems$31:TProp) [7] For init=bb3 test=bb1 loop=bb5 update=bb4 fallthrough=bb2 @@ -98,7 +98,7 @@ bb2: [38] Const mutate t7$71_@4 = JSX {freeze count$66:TProp}{read $70} [39] Const mutate $72 = "\n " [40] Const mutate $73 = "\n " - [41] Const mutate t10$74_@5 = JSX {read $68}{read t7$71_@4}{read $72}{freeze renderedItems$32_@0:TFunction}{read $73} + [41] Const mutate t10$74_@5 = JSX {read $68}{read t7$71_@4}{read $72}{freeze renderedItems$32_@0:TPrimitive}{read $73} [42] Return read t10$74_@5 ``` @@ -111,8 +111,8 @@ function Component( [1] Const mutate items$30:TProp = read props$29.items [2] Const mutate maxItems$31:TProp = read props$29.maxItems scope @0 [3:33] deps=[read maxItems$31:TProp, read items$30.length, read items$30] out=[renderedItems$32_@0] { - [3] Const mutate renderedItems$32_@0:TFunction[3:33] = Array [] - [4] Const mutate seen$33_@0:TFunction[3:33] = New mutate Set$6() + [3] Const mutate renderedItems$32_@0:TPrimitive[3:33] = Array [] + [4] Const mutate seen$33_@0[3:33] = New mutate Set$6() [5] Const mutate $34:TPrimitive = 0 scope @2 [6:7] deps=[read maxItems$31:TProp] out=[max$35_@2] { [6] Const mutate max$35_@2:TPrimitive = Call mutate Math$8.max(read $34:TPrimitive, read maxItems$31:TProp) @@ -159,8 +159,8 @@ function Component( } [39] Const mutate $72 = "\n " [40] Const mutate $73 = "\n " - scope @5 [41:42] deps=[read $71_@4, freeze renderedItems$32_@0:TFunction] out=[$74_@5] { - [41] Const mutate $74_@5 = JSX {read $68}{read $71_@4}{read $72}{freeze renderedItems$32_@0:TFunction}{read $73} + scope @5 [41:42] deps=[read $71_@4, freeze renderedItems$32_@0:TPrimitive] out=[$74_@5] { + [41] Const mutate $74_@5 = JSX {read $68}{read $71_@4}{read $72}{freeze renderedItems$32_@0:TPrimitive}{read $73} } return read $74_@5 } diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md index b4e0ae00a0..408ec8b06f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-break.expect.md @@ -78,7 +78,7 @@ function Component(props) { ``` bb0: - [1] Const mutate a_DEBUG$5_@0:TFunction[1:7] = Array [] + [1] Const mutate a_DEBUG$5_@0[1:7] = Array [] [2] Call mutate a_DEBUG$5_@0.push(read props$4.a) [3] If (read props$4.b) then:bb2 else:bb1 fallthrough=bb1 bb2: @@ -88,7 +88,7 @@ bb2: bb1: predecessor blocks: bb0 [6] Call mutate a_DEBUG$5_@0.push(read props$4.d) - [7] Return freeze a_DEBUG$5_@0:TFunction + [7] Return freeze a_DEBUG$5_@0 ``` ## Reactive Scopes @@ -98,7 +98,7 @@ function Component( props, ) { scope @0 [1:7] deps=[read props$4.a, read props$4.b, read props$4.d] out=[a_DEBUG$5_@0] { - [1] Const mutate a_DEBUG$5_@0:TFunction[1:7] = Array [] + [1] Const mutate a_DEBUG$5_@0[1:7] = Array [] [2] Call mutate a_DEBUG$5_@0.push(read props$4.a) if (read props$4.b) { [4] Const mutate $6:TPrimitive = null @@ -106,7 +106,7 @@ function Component( } [6] Call mutate a_DEBUG$5_@0.push(read props$4.d) } - return freeze a_DEBUG$5_@0:TFunction + return freeze a_DEBUG$5_@0 } ``` @@ -145,7 +145,7 @@ function Component$0(props$4) { ``` bb0: - [1] Const mutate a$4_@0:TFunction[1:7] = Array [] + [1] Const mutate a$4_@0[1:7] = Array [] [2] Call mutate a$4_@0.push(read props$3.a) [3] If (read props$3.b) then:bb2 else:bb1 fallthrough=bb1 bb2: @@ -155,7 +155,7 @@ bb2: bb1: predecessor blocks: bb2 bb0 [6] Call mutate a$4_@0.push(read props$3.d) - [7] Return freeze a$4_@0:TFunction + [7] Return freeze a$4_@0 ``` ## Reactive Scopes @@ -165,14 +165,14 @@ function Component( props, ) { scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] out=[a$4_@0] { - [1] Const mutate a$4_@0:TFunction[1:7] = Array [] + [1] Const mutate a$4_@0[1:7] = Array [] [2] Call mutate a$4_@0.push(read props$3.a) if (read props$3.b) { [4] Call mutate a$4_@0.push(read props$3.c) } [6] Call mutate a$4_@0.push(read props$3.d) } - return freeze a$4_@0:TFunction + return freeze a$4_@0 } ``` @@ -213,7 +213,7 @@ function Component$0(props$3) { ``` bb0: - [1] Const mutate a$5_@0:TFunction[1:8] = Array [] + [1] Const mutate a$5_@0[1:8] = Array [] [2] Call mutate a$5_@0.push(read props$4.a) [3] If (read props$4.b) then:bb2 else:bb1 fallthrough=bb1 bb2: @@ -224,7 +224,7 @@ bb2: bb1: predecessor blocks: bb0 [7] Call mutate a$5_@0.push(read props$4.d) - [8] Return freeze a$5_@0:TFunction + [8] Return freeze a$5_@0 ``` ## Reactive Scopes @@ -234,7 +234,7 @@ function Component( props, ) { scope @0 [1:8] deps=[read props$4.a, read props$4.b, read props$4.c, read props$4.d] out=[a$5_@0] { - [1] Const mutate a$5_@0:TFunction[1:8] = Array [] + [1] Const mutate a$5_@0[1:8] = Array [] [2] Call mutate a$5_@0.push(read props$4.a) if (read props$4.b) { [4] Call mutate a$5_@0.push(read props$4.c) @@ -243,7 +243,7 @@ function Component( } [7] Call mutate a$5_@0.push(read props$4.d) } - return freeze a$5_@0:TFunction + return freeze a$5_@0 } ``` @@ -285,17 +285,17 @@ function Component$0(props$4) { ``` bb0: - [1] Const mutate a$4_@0:TFunction[1:7] = Array [] + [1] Const mutate a$4_@0[1:7] = Array [] [2] Call mutate a$4_@0.push(read props$3.a) [3] If (read props$3.b) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 [4] Call mutate a$4_@0.push(read props$3.c) - [5] Return freeze a$4_@0:TFunction + [5] Return freeze a$4_@0 bb1: predecessor blocks: bb0 [6] Call mutate a$4_@0.push(read props$3.d) - [7] Return freeze a$4_@0:TFunction + [7] Return freeze a$4_@0 ``` ## Reactive Scopes @@ -305,15 +305,15 @@ function Component( props, ) { scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.c, read props$3.d] out=[a$4_@0] { - [1] Const mutate a$4_@0:TFunction[1:7] = Array [] + [1] Const mutate a$4_@0[1:7] = Array [] [2] Call mutate a$4_@0.push(read props$3.a) if (read props$3.b) { [4] Call mutate a$4_@0.push(read props$3.c) - return freeze a$4_@0:TFunction + return freeze a$4_@0 } [6] Call mutate a$4_@0.push(read props$3.d) } - return freeze a$4_@0:TFunction + return freeze a$4_@0 } ``` @@ -355,7 +355,7 @@ function Component$0(props$3) { ``` bb0: - [1] Const mutate a$4_@0:TFunction[1:7] = Array [] + [1] Const mutate a$4_@0[1:7] = Array [] [2] Call mutate a$4_@0.push(read props$3.a) [3] If (read props$3.b) then:bb1 else:bb2 fallthrough=bb2 bb2: @@ -365,7 +365,7 @@ bb2: bb1: predecessor blocks: bb0 bb2 [6] Call mutate a$4_@0.push(read props$3.d) - [7] Return freeze a$4_@0:TFunction + [7] Return freeze a$4_@0 ``` ## Reactive Scopes @@ -375,11 +375,11 @@ function Component( props, ) { scope @0 [1:7] deps=[read props$3.a, read props$3.b, read props$3.d, read props$3.c] out=[] { - [1] Const mutate a$4_@0:TFunction[1:7] = Array [] + [1] Const mutate a$4_@0[1:7] = Array [] [2] Call mutate a$4_@0.push(read props$3.a) if (read props$3.b) { [6] Call mutate a$4_@0.push(read props$3.d) - return freeze a$4_@0:TFunction + return freeze a$4_@0 } [4] Call mutate a$4_@0.push(read props$3.c) } diff --git a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md index 7f5d039411..4ac13e8503 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/conditional-on-mutable.expect.md @@ -35,9 +35,9 @@ function mayMutate() {} ``` bb0: - [1] Const mutate a$7_@0:TFunction[1:9] = Array [] - [2] Const mutate b$8_@0:TFunction[1:9] = Array [] - [3] If (read b$8_@0:TFunction) then:bb2 else:bb1 fallthrough=bb1 + [1] Const mutate a$7_@0[1:9] = Array [] + [2] Const mutate b$8_@0[1:9] = Array [] + [3] If (read b$8_@0) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 [4] Call mutate a$7_@0.push(read props$6.p0) @@ -51,7 +51,7 @@ bb4: [8] Goto bb3 bb3: predecessor blocks: bb4 bb1 - [9] Const mutate t6$16_@2 = JSX + [9] Const mutate t6$16_@2 = JSX [10] Return read t6$16_@2 ``` @@ -62,17 +62,17 @@ function Component( props, ) { scope @0 [1:9] deps=[read props$6.p0, read props$6.p1, read props$6.p2] out=[a$7_@0] { - [1] Const mutate a$7_@0:TFunction[1:9] = Array [] - [2] Const mutate b$8_@0:TFunction[1:9] = Array [] - if (read b$8_@0:TFunction) { + [1] Const mutate a$7_@0[1:9] = Array [] + [2] Const mutate b$8_@0[1:9] = Array [] + if (read b$8_@0) { [4] Call mutate a$7_@0.push(read props$6.p0) } if (read props$6.p1) { [7] Call mutate b$8_@0.push(read props$6.p2) } } - scope @2 [9:10] deps=[freeze a$7_@0:TFunction, freeze b$8_@0:TFunction] out=[$16_@2] { - [9] Const mutate $16_@2 = JSX + scope @2 [9:10] deps=[freeze a$7_@0, freeze b$8_@0] out=[$16_@2] { + [9] Const mutate $16_@2 = JSX } return read $16_@2 } @@ -129,9 +129,9 @@ function Component$0(props$6) { ``` bb0: - [1] Const mutate a$9_@0:TFunction[1:10] = Array [] - [2] Const mutate b$10_@0:TFunction[1:10] = Array [] - [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0:TFunction) + [1] Const mutate a$9_@0[1:10] = Array [] + [2] Const mutate b$10_@0[1:10] = Array [] + [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0) [4] If (read $11_@0) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 @@ -146,7 +146,7 @@ bb4: [9] Goto bb3 bb3: predecessor blocks: bb4 bb1 - [10] Const mutate t6$19_@2 = JSX + [10] Const mutate t6$19_@2 = JSX [11] Return read t6$19_@2 ``` @@ -157,9 +157,9 @@ function Component( props, ) { scope @0 [1:10] deps=[read props$8.p0, read props$8.p1, read props$8.p2] out=[a$9_@0] { - [1] Const mutate a$9_@0:TFunction[1:10] = Array [] - [2] Const mutate b$10_@0:TFunction[1:10] = Array [] - [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0:TFunction) + [1] Const mutate a$9_@0[1:10] = Array [] + [2] Const mutate b$10_@0[1:10] = Array [] + [3] Const mutate $11_@0[1:10] = Call mutate mayMutate$4:TFunction(mutate b$10_@0) if (read $11_@0) { [5] Call mutate a$9_@0.push(read props$8.p0) } @@ -167,8 +167,8 @@ function Component( [8] Call mutate b$10_@0.push(read props$8.p2) } } - scope @2 [10:11] deps=[freeze a$9_@0:TFunction, freeze b$10_@0:TFunction] out=[$19_@2] { - [10] Const mutate $19_@2 = JSX + scope @2 [10:11] deps=[freeze a$9_@0, freeze b$10_@0] out=[$19_@2] { + [10] Const mutate $19_@2 = JSX } return read $19_@2 } diff --git a/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md b/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md index b9c400127b..6a8fcd8bec 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/dependencies-outputs.expect.md @@ -22,22 +22,22 @@ function foo(a, b) { ``` bb0: - [1] Const mutate x$8_@0:TFunction[1:3] = Array [] + [1] Const mutate x$8_@0[1:3] = Array [] [2] Call mutate x$8_@0.push(read a$6) [3] Const mutate $9:TPrimitive = "div" - [4] JSX {freeze x$8_@0:TFunction} - [5] Const mutate y$10_@1:TFunction[5:12] = Array [] + [4] JSX {freeze x$8_@0} + [5] Const mutate y$10_@1[5:12] = Array [] [6] If (read x$8_@0.length) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [7] Call mutate y$10_@1.push(read x$8_@0:TFunction) + [7] Call mutate y$10_@1.push(read x$8_@0) [8] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [9] If (read b$7:TFunction) then:bb4 else:bb3 fallthrough=bb3 + [9] If (read b$7) then:bb4 else:bb3 fallthrough=bb3 bb4: predecessor blocks: bb1 - [10] Call mutate y$10_@1.push(read b$7:TFunction) + [10] Call mutate y$10_@1.push(read b$7) [11] Goto bb3 bb3: predecessor blocks: bb4 bb1 @@ -52,18 +52,18 @@ function foo( b, ) { scope @0 [1:3] deps=[read a$6] out=[x$8_@0] { - [1] Const mutate x$8_@0:TFunction[1:3] = Array [] + [1] Const mutate x$8_@0[1:3] = Array [] [2] Call mutate x$8_@0.push(read a$6) } [3] Const mutate $9:TPrimitive = "div" - [4] JSX {freeze x$8_@0:TFunction} - scope @1 [5:12] deps=[read x$8_@0:TFunction, read b$7:TFunction] out=[] { - [5] Const mutate y$10_@1:TFunction[5:12] = Array [] + [4] JSX {freeze x$8_@0} + scope @1 [5:12] deps=[read x$8_@0, read b$7] out=[] { + [5] Const mutate y$10_@1[5:12] = Array [] if (read x$8_@0.length) { - [7] Call mutate y$10_@1.push(read x$8_@0:TFunction) + [7] Call mutate y$10_@1.push(read x$8_@0) } - if (read b$7:TFunction) { - [10] Call mutate y$10_@1.push(read b$7:TFunction) + if (read b$7) { + [10] Call mutate y$10_@1.push(read b$7) } } return diff --git a/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md b/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md index 41848763ae..08bfa271c2 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/dependencies.expect.md @@ -24,9 +24,9 @@ function foo(x, y, z) { ``` bb0: - [1] Const mutate items$9_@0:TFunction[1:10] = Array [read z$8] + [1] Const mutate items$9_@0[1:10] = Array [read z$8] [2] Call mutate items$9_@0.push(read x$6) - [3] Const mutate items2$10_@1:TFunction[3:7] = Array [] + [3] Const mutate items2$10_@1[3:7] = Array [] [4] If (read x$6) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 @@ -41,7 +41,7 @@ bb4: [9] Goto bb3 bb3: predecessor blocks: bb4 bb1 - [10] Return freeze items2$10_@1:TFunction + [10] Return freeze items2$10_@1 ``` ## Reactive Scopes @@ -53,10 +53,10 @@ function foo( z, ) { scope @0 [1:10] deps=[read z$8, read x$6, read y$7] out=[] { - [1] Const mutate items$9_@0:TFunction[1:10] = Array [read z$8] + [1] Const mutate items$9_@0[1:10] = Array [read z$8] [2] Call mutate items$9_@0.push(read x$6) scope @1 [3:7] deps=[read x$6, read y$7] out=[items2$10_@1] { - [3] Const mutate items2$10_@1:TFunction[3:7] = Array [] + [3] Const mutate items2$10_@1[3:7] = Array [] if (read x$6) { [5] Call mutate items2$10_@1.push(read y$7) } @@ -65,7 +65,7 @@ function foo( [8] Call mutate items$9_@0.push(read x$6) } } - return freeze items2$10_@1:TFunction + return freeze items2$10_@1 } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md index e23268703c..c7f6eca50b 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/extend-scopes-if.expect.md @@ -23,7 +23,7 @@ function foo(a, b, c) { ``` bb0: - [1] Const mutate x$10_@0:TFunction[1:8] = Array [] + [1] Const mutate x$10_@0[1:8] = Array [] [2] If (read a$7) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 @@ -57,7 +57,7 @@ function foo( c, ) { scope @0 [1:8] deps=[read a$7, read b$8, read c$9] out=[] { - [1] Const mutate x$10_@0:TFunction[1:8] = Array [] + [1] Const mutate x$10_@0[1:8] = Array [] if (read a$7) { if (read b$8) { if (read c$9) { diff --git a/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md index fa1c4915eb..acee1dbbae 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/inverted-if.expect.md @@ -18,7 +18,7 @@ function foo(a, b, c) { ``` bb0: - [1] Const mutate y$8_@0:TFunction[1:6] = Array [] + [1] Const mutate y$8_@0[1:6] = Array [] [2] If (read a$5) then:bb3 else:bb1 fallthrough=bb1 bb3: predecessor blocks: bb0 @@ -41,7 +41,7 @@ function foo( c, ) { scope @0 [1:6] deps=[read a$5, read b$6, read c$7] out=[] { - [1] Const mutate y$8_@0:TFunction[1:6] = Array [] + [1] Const mutate y$8_@0[1:6] = Array [] if (read a$5) { if (read b$6) { [4] Call mutate y$8_@0.push(read c$7) diff --git a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md index f52bbbc11b..2ad5900810 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/mutable-lifetime-loops.expect.md @@ -94,7 +94,7 @@ function cond$0(x$2) {} bb0: [1] Let mutate a$18_@0[1:23] = Object { } [2] Let mutate b$20_@0[1:23] = Object { } - [3] Let mutate c$22_@0:TPrimitive[1:23] = Object { } + [3] Let mutate c$22_@0[1:23] = Object { } [4] Let mutate d$24_@0[1:23] = Object { } [5] While test=bb1 loop=bb3 fallthrough=bb2 bb1: @@ -105,8 +105,8 @@ bb3: predecessor blocks: bb1 [8] Const mutate z$19_@0[1:23] = read a$18_@0 [9] Reassign mutate a$18_@0[1:23] = read b$20_@0 - [10] Reassign mutate b$20_@0[1:23] = read c$22_@0:TPrimitive - [11] Reassign mutate c$22_@0:TPrimitive[1:23] = read d$24_@0 + [10] Reassign mutate b$20_@0[1:23] = read c$22_@0 + [11] Reassign mutate c$22_@0[1:23] = read d$24_@0 [12] Reassign mutate d$24_@0[1:23] = read z$19_@0 [13] Call mutate mutate$7:TFunction(mutate a$18_@0, mutate b$20_@0) [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$18_@0) @@ -122,7 +122,7 @@ bb7: [18] If (read b$20_@0) then:bb9 else:bb9 fallthrough=bb9 bb9: predecessor blocks: bb7 - [19] If (read c$22_@0:TPrimitive) then:bb11 else:bb11 fallthrough=bb11 + [19] If (read c$22_@0) then:bb11 else:bb11 fallthrough=bb11 bb11: predecessor blocks: bb9 [20] If (read d$24_@0) then:bb13 else:bb13 fallthrough=bb13 @@ -142,7 +142,7 @@ function Component( scope @0 [1:23] deps=[] out=[] { [1] Let mutate a$18_@0[1:23] = Object { } [2] Let mutate b$20_@0[1:23] = Object { } - [3] Let mutate c$22_@0:TPrimitive[1:23] = Object { } + [3] Let mutate c$22_@0[1:23] = Object { } [4] Let mutate d$24_@0[1:23] = Object { } while ( [6] Const mutate $17:TPrimitive = true @@ -150,8 +150,8 @@ function Component( ) { [8] Const mutate z$19_@0[1:23] = read a$18_@0 [9] Reassign mutate a$18_@0[1:23] = read b$20_@0 - [10] Reassign mutate b$20_@0[1:23] = read c$22_@0:TPrimitive - [11] Reassign mutate c$22_@0:TPrimitive[1:23] = read d$24_@0 + [10] Reassign mutate b$20_@0[1:23] = read c$22_@0 + [11] Reassign mutate c$22_@0[1:23] = read d$24_@0 [12] Reassign mutate d$24_@0[1:23] = read z$19_@0 [13] Call mutate mutate$7:TFunction(mutate a$18_@0, mutate b$20_@0) [14] Const mutate $29_@0[1:23] = Call mutate cond$8:TFunction(mutate a$18_@0) @@ -163,7 +163,7 @@ function Component( } if (read b$20_@0) { } - if (read c$22_@0:TPrimitive) { + if (read c$22_@0) { } if (read d$24_@0) { } diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md index 50ec72a315..0b8e7cc94f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved-by-terminal.expect.md @@ -19,9 +19,9 @@ function foo(a, b, c) { ``` bb0: - [1] Const mutate x$9_@0:TFunction[1:6] = Array [] - [2] Const mutate y$10_@0:TFunction[1:6] = Array [] - [3] If (read x$9_@0:TFunction) then:bb1 else:bb1 fallthrough=bb1 + [1] Const mutate x$9_@0[1:6] = Array [] + [2] Const mutate y$10_@0[1:6] = Array [] + [3] If (read x$9_@0) then:bb1 else:bb1 fallthrough=bb1 bb1: predecessor blocks: bb0 [4] Call mutate y$10_@0.push(read a$6) @@ -38,9 +38,9 @@ function foo( c, ) { scope @0 [1:6] deps=[read a$6, read b$7] out=[] { - [1] Const mutate x$9_@0:TFunction[1:6] = Array [] - [2] Const mutate y$10_@0:TFunction[1:6] = Array [] - if (read x$9_@0:TFunction) { + [1] Const mutate x$9_@0[1:6] = Array [] + [2] Const mutate y$10_@0[1:6] = Array [] + if (read x$9_@0) { } [4] Call mutate y$10_@0.push(read a$6) [5] Call mutate x$9_@0.push(read b$7) diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md index 0bd8257fe4..036f6504cd 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-interleaved.expect.md @@ -15,8 +15,8 @@ function foo(a, b) { ``` bb0: - [1] Const mutate x$7_@0:TFunction[1:5] = Array [] - [2] Const mutate y$8_@0:TFunction[1:5] = Array [] + [1] Const mutate x$7_@0[1:5] = Array [] + [2] Const mutate y$8_@0[1:5] = Array [] [3] Call mutate x$7_@0.push(read a$5) [4] Call mutate y$8_@0.push(read b$6) [5] Return @@ -30,8 +30,8 @@ function foo( b, ) { scope @0 [1:5] deps=[read a$5, read b$6] out=[] { - [1] Const mutate x$7_@0:TFunction[1:5] = Array [] - [2] Const mutate y$8_@0:TFunction[1:5] = Array [] + [1] Const mutate x$7_@0[1:5] = Array [] + [2] Const mutate y$8_@0[1:5] = Array [] [3] Call mutate x$7_@0.push(read a$5) [4] Call mutate y$8_@0.push(read b$6) } diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md index 285117121f..9964de234d 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowed.expect.md @@ -15,8 +15,8 @@ function foo(a, b) { ``` bb0: - [1] Const mutate x$7_@0:TFunction[1:5] = Array [] - [2] Const mutate y$8_@1:TFunction[2:4] = Array [] + [1] Const mutate x$7_@0[1:5] = Array [] + [2] Const mutate y$8_@1[2:4] = Array [] [3] Call mutate y$8_@1.push(read b$6) [4] Call mutate x$7_@0.push(read a$5) [5] Return @@ -30,9 +30,9 @@ function foo( b, ) { scope @0 [1:5] deps=[read b$6, read a$5] out=[] { - [1] Const mutate x$7_@0:TFunction[1:5] = Array [] + [1] Const mutate x$7_@0[1:5] = Array [] scope @1 [2:4] deps=[read b$6] out=[] { - [2] Const mutate y$8_@1:TFunction[2:4] = Array [] + [2] Const mutate y$8_@1[2:4] = Array [] [3] Call mutate y$8_@1.push(read b$6) } [4] Call mutate x$7_@0.push(read a$5) diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md index d55cd424a0..55326469ea 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-shadowing-within-block.expect.md @@ -21,11 +21,11 @@ function foo(a, b, c) { ``` bb0: - [1] Const mutate x$11_@0:TFunction[1:11] = Array [] + [1] Const mutate x$11_@0[1:11] = Array [] [2] If (read a$8) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [3] Const mutate y$12_@1:TFunction[3:7] = Array [] + [3] Const mutate y$12_@1[3:7] = Array [] [4] If (read b$9) then:bb4 else:bb3 fallthrough=bb3 bb4: predecessor blocks: bb2 @@ -34,12 +34,12 @@ bb4: bb3: predecessor blocks: bb4 bb2 [7] Const mutate $13:TPrimitive = "div" - [8] Const mutate t8$15_@2 = JSX {freeze y$12_@1:TFunction} + [8] Const mutate t8$15_@2 = JSX {freeze y$12_@1} [9] Call mutate x$11_@0.push(read t8$15_@2) [10] Goto bb1 bb1: predecessor blocks: bb3 bb0 - [11] Return freeze x$11_@0:TFunction + [11] Return freeze x$11_@0 ``` ## Reactive Scopes @@ -51,22 +51,22 @@ function foo( c, ) { scope @0 [1:11] deps=[read a$8, read b$9, read c$10] out=[x$11_@0] { - [1] Const mutate x$11_@0:TFunction[1:11] = Array [] + [1] Const mutate x$11_@0[1:11] = Array [] if (read a$8) { scope @1 [3:7] deps=[read b$9, read c$10] out=[y$12_@1] { - [3] Const mutate y$12_@1:TFunction[3:7] = Array [] + [3] Const mutate y$12_@1[3:7] = Array [] if (read b$9) { [5] Call mutate y$12_@1.push(read c$10) } } [7] Const mutate $13:TPrimitive = "div" - scope @2 [8:9] deps=[freeze y$12_@1:TFunction] out=[$15_@2] { - [8] Const mutate $15_@2 = JSX {freeze y$12_@1:TFunction} + scope @2 [8:9] deps=[freeze y$12_@1] out=[$15_@2] { + [8] Const mutate $15_@2 = JSX {freeze y$12_@1} } [9] Call mutate x$11_@0.push(read $15_@2) } } - return freeze x$11_@0:TFunction + return freeze x$11_@0 } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md index 9969ac9b97..223fe2b9b1 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-while.expect.md @@ -17,8 +17,8 @@ function foo(a, b, c) { ``` bb0: - [1] Const mutate x$9_@0:TFunction[1:8] = Array [] - [2] Const mutate y$10_@0:TFunction[1:8] = Array [] + [1] Const mutate x$9_@0[1:8] = Array [] + [2] Const mutate y$10_@0[1:8] = Array [] [3] While test=bb1 loop=bb3 fallthrough=bb2 bb1: predecessor blocks: bb0 bb3 @@ -42,8 +42,8 @@ function foo( c, ) { scope @0 [1:8] deps=[read c$8, read b$7, read a$6] out=[] { - [1] Const mutate x$9_@0:TFunction[1:8] = Array [] - [2] Const mutate y$10_@0:TFunction[1:8] = Array [] + [1] Const mutate x$9_@0[1:8] = Array [] + [2] Const mutate y$10_@0[1:8] = Array [] while ( read c$8 ) { diff --git a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md index 1bca98e145..2fe44aa306 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/overlapping-scopes-within-block.expect.md @@ -21,11 +21,11 @@ function foo(a, b, c) { ``` bb0: - [1] Const mutate x$9_@0:TFunction[1:9] = Array [] + [1] Const mutate x$9_@0[1:9] = Array [] [2] If (read a$6) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [3] Const mutate y$10_@0:TFunction[1:9] = Array [] + [3] Const mutate y$10_@0[1:9] = Array [] [4] If (read b$7) then:bb4 else:bb3 fallthrough=bb3 bb4: predecessor blocks: bb2 @@ -33,11 +33,11 @@ bb4: [6] Goto bb3 bb3: predecessor blocks: bb4 bb2 - [7] Call mutate x$9_@0.push(mutate y$10_@0:TFunction) + [7] Call mutate x$9_@0.push(mutate y$10_@0) [8] Goto bb1 bb1: predecessor blocks: bb3 bb0 - [9] Return freeze x$9_@0:TFunction + [9] Return freeze x$9_@0 ``` ## Reactive Scopes @@ -49,16 +49,16 @@ function foo( c, ) { scope @0 [1:9] deps=[read a$6, read b$7, read c$8] out=[x$9_@0] { - [1] Const mutate x$9_@0:TFunction[1:9] = Array [] + [1] Const mutate x$9_@0[1:9] = Array [] if (read a$6) { - [3] Const mutate y$10_@0:TFunction[1:9] = Array [] + [3] Const mutate y$10_@0[1:9] = Array [] if (read b$7) { [5] Call mutate y$10_@0.push(read c$8) } - [7] Call mutate x$9_@0.push(mutate y$10_@0:TFunction) + [7] Call mutate x$9_@0.push(mutate y$10_@0) } } - return freeze x$9_@0:TFunction + return freeze x$9_@0 } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md index 6e068a6436..0836998d40 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scope-grouping.expect.md @@ -19,10 +19,10 @@ function foo() { ``` bb0: [1] Const mutate x$4_@0:TObject[1:6] = Object { } - [2] Const mutate y$5_@1:TFunction[2:5] = Array [] + [2] Const mutate y$5_@1[2:5] = Array [] [3] Const mutate z$6_@1:TObject[2:5] = Object { } [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject) - [5] Reassign mutate x$4_@0.y[1:6] = read y$5_@1:TFunction + [5] Reassign mutate x$4_@0.y[1:6] = read y$5_@1 [6] Return freeze x$4_@0:TObject ``` @@ -34,11 +34,11 @@ function foo( scope @0 [1:6] deps=[] out=[x$4_@0] { [1] Const mutate x$4_@0:TObject[1:6] = Object { } scope @1 [2:5] deps=[] out=[y$5_@1] { - [2] Const mutate y$5_@1:TFunction[2:5] = Array [] + [2] Const mutate y$5_@1[2:5] = Array [] [3] Const mutate z$6_@1:TObject[2:5] = Object { } [4] Call mutate y$5_@1.push(mutate z$6_@1:TObject) } - [5] Reassign mutate x$4_@0.y[1:6] = read y$5_@1:TFunction + [5] Reassign mutate x$4_@0.y[1:6] = read y$5_@1 } return freeze x$4_@0:TObject } diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md index f8877a4aae..527c8fc99f 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes-if.expect.md @@ -20,14 +20,14 @@ function foo(a, b, c) { ``` bb0: - [1] Const mutate x$11_@0:TFunction[1:11] = Array [] + [1] Const mutate x$11_@0[1:11] = Array [] [2] If (read a$8) then:bb2 else:bb3 fallthrough=bb1 bb2: predecessor blocks: bb0 - [3] Const mutate y$12_@1:TFunction[3:5] = Array [] + [3] Const mutate y$12_@1[3:5] = Array [] [4] Call mutate y$12_@1.push(read b$9) [5] Const mutate $13:TPrimitive = "div" - [6] Const mutate t7$14_@2 = JSX {freeze y$12_@1:TFunction} + [6] Const mutate t7$14_@2 = JSX {freeze y$12_@1} [7] Call mutate x$11_@0.push(read t7$14_@2) [8] Goto bb1 bb3: @@ -36,7 +36,7 @@ bb3: [10] Goto bb1 bb1: predecessor blocks: bb2 bb3 - [11] Return freeze x$11_@0:TFunction + [11] Return freeze x$11_@0 ``` ## Reactive Scopes @@ -48,22 +48,22 @@ function foo( c, ) { scope @0 [1:11] deps=[read a$8, read b$9, read c$10] out=[x$11_@0] { - [1] Const mutate x$11_@0:TFunction[1:11] = Array [] + [1] Const mutate x$11_@0[1:11] = Array [] if (read a$8) { scope @1 [3:5] deps=[read b$9] out=[y$12_@1] { - [3] Const mutate y$12_@1:TFunction[3:5] = Array [] + [3] Const mutate y$12_@1[3:5] = Array [] [4] Call mutate y$12_@1.push(read b$9) } [5] Const mutate $13:TPrimitive = "div" - scope @2 [6:7] deps=[freeze y$12_@1:TFunction] out=[$14_@2] { - [6] Const mutate $14_@2 = JSX {freeze y$12_@1:TFunction} + scope @2 [6:7] deps=[freeze y$12_@1] out=[$14_@2] { + [6] Const mutate $14_@2 = JSX {freeze y$12_@1} } [7] Call mutate x$11_@0.push(read $14_@2) } else { [9] Call mutate x$11_@0.push(read c$10) } } - return freeze x$11_@0:TFunction + return freeze x$11_@0 } ``` diff --git a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md index 66c819ef55..c08e0b62da 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reactive-scopes.expect.md @@ -19,7 +19,7 @@ function f(a, b) { ``` bb0: - [1] Const mutate x$10_@0:TFunction[1:8] = Array [] + [1] Const mutate x$10_@0[1:8] = Array [] [2] Const mutate $11:TPrimitive = 1 [3] Const mutate $12:TPrimitive = Binary read a$8.length === read $11:TPrimitive [4] If (read $12:TPrimitive) then:bb2 else:bb1 fallthrough=bb1 @@ -33,7 +33,7 @@ bb4: bb1: predecessor blocks: bb4 bb2 bb0 [8] Const mutate $13:TPrimitive = "div" - [9] Const mutate t4$15_@1 = JSX {freeze x$10_@0:TFunction} + [9] Const mutate t4$15_@1 = JSX {freeze x$10_@0} [10] Return read t4$15_@1 ``` @@ -45,7 +45,7 @@ function f( b, ) { scope @0 [1:8] deps=[read a$8.length, read b$9] out=[x$10_@0] { - [1] Const mutate x$10_@0:TFunction[1:8] = Array [] + [1] Const mutate x$10_@0[1:8] = Array [] [2] Const mutate $11:TPrimitive = 1 [3] Const mutate $12:TPrimitive = Binary read a$8.length === read $11:TPrimitive if (read $12:TPrimitive) { @@ -55,8 +55,8 @@ function f( } } [8] Const mutate $13:TPrimitive = "div" - scope @1 [9:10] deps=[freeze x$10_@0:TFunction] out=[$15_@1] { - [9] Const mutate $15_@1 = JSX {freeze x$10_@0:TFunction} + scope @1 [9:10] deps=[freeze x$10_@0] out=[$15_@1] { + [9] Const mutate $15_@1 = JSX {freeze x$10_@0} } return read $15_@1 } diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md index 003eec98b9..65bf827851 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment-conditional.expect.md @@ -23,19 +23,19 @@ function Component(props) { ``` bb0: - [1] Let mutate x$7_@0:TFunction[1:7] = Array [] + [1] Let mutate x$7_@0[1:7] = Array [] [2] Call mutate x$7_@0.push(read props$6.p0) - [3] Const mutate y$8:TFunction = read x$7_@0:TFunction + [3] Const mutate y$8 = read x$7_@0 [4] If (read props$6.p1) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 - [5] Reassign mutate x$7_@0:TFunction[1:7] = Array [] + [5] Reassign mutate x$7_@0[1:7] = Array [] [6] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [7] Const mutate _$12_@1 = JSX + [7] Const mutate _$12_@1 = JSX [8] Call read y$8.push(read props$6.p2) - [9] Const mutate t6$15_@2 = JSX + [9] Const mutate t6$15_@2 = JSX [10] Return read t6$15_@2 ``` @@ -46,19 +46,19 @@ function Component( props, ) { scope @0 [1:7] deps=[read props$6.p0, read props$6.p1] out=[x$7_@0] { - [1] Let mutate x$7_@0:TFunction[1:7] = Array [] + [1] Let mutate x$7_@0[1:7] = Array [] [2] Call mutate x$7_@0.push(read props$6.p0) - [3] Const mutate y$8:TFunction = read x$7_@0:TFunction + [3] Const mutate y$8 = read x$7_@0 if (read props$6.p1) { - [5] Reassign mutate x$7_@0:TFunction[1:7] = Array [] + [5] Reassign mutate x$7_@0[1:7] = Array [] } } - scope @1 [7:8] deps=[freeze x$7_@0:TFunction] out=[] { - [7] Const mutate _$12_@1 = JSX + scope @1 [7:8] deps=[freeze x$7_@0] out=[] { + [7] Const mutate _$12_@1 = JSX } [8] Call read y$8.push(read props$6.p2) - scope @2 [9:10] deps=[read x$7_@0:TFunction, read y$8:TFunction] out=[$15_@2] { - [9] Const mutate $15_@2 = JSX + scope @2 [9:10] deps=[read x$7_@0, read y$8] out=[$15_@2] { + [9] Const mutate $15_@2 = JSX } return read $15_@2 } diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md index ee81bf0ae9..210e2b7348 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment-separate-scopes.expect.md @@ -34,7 +34,7 @@ function foo(a, b, c) { ``` bb0: - [1] Const mutate x$16_@0:TFunction[1:5] = Array [] + [1] Const mutate x$16_@0[1:5] = Array [] [2] If (read a$13) then:bb2 else:bb1 fallthrough=bb1 bb2: predecessor blocks: bb0 @@ -43,21 +43,21 @@ bb2: bb1: predecessor blocks: bb2 bb0 [5] Const mutate $17:TPrimitive = "div" - [6] Const mutate y$19_@1 = JSX {freeze x$16_@0:TFunction} + [6] Const mutate y$19_@1 = JSX {freeze x$16_@0} [7] Const mutate $20:TPrimitive = 0 - [8] Let mutate x$22_@2:TFunction[8:15] = undefined + [8] Let mutate x$22_@2[8:15] = undefined [8] Switch (read b$14) Case read $20:TPrimitive: bb5 Default: bb4 Fallthrough: bb3 bb5: predecessor blocks: bb1 - [9] Reassign mutate x$22_@2:TFunction[8:15] = Array [] + [9] Reassign mutate x$22_@2[8:15] = Array [] [10] Call mutate x$22_@2.push(read b$14) [11] Goto bb3 bb4: predecessor blocks: bb1 - [12] Reassign mutate x$22_@2:TFunction[8:15] = Array [] + [12] Reassign mutate x$22_@2[8:15] = Array [] [13] Call mutate x$22_@2.push(read c$15) [14] Goto bb3 bb3: @@ -66,7 +66,7 @@ bb3: [16] Const mutate $26 = "\n " [17] Const mutate $27 = "\n " [18] Const mutate $28 = "\n " - [19] Const mutate t9$31_@3 = JSX {read $26}{read y$19_@1}{read $27}{freeze x$22_@2:TFunction}{read $28} + [19] Const mutate t9$31_@3 = JSX {read $26}{read y$19_@1}{read $27}{freeze x$22_@2}{read $28} [20] Return read t9$31_@3 ``` @@ -79,26 +79,26 @@ function foo( c, ) { scope @0 [1:5] deps=[read a$13] out=[x$16_@0] { - [1] Const mutate x$16_@0:TFunction[1:5] = Array [] + [1] Const mutate x$16_@0[1:5] = Array [] if (read a$13) { [3] Call mutate x$16_@0.push(read a$13) } } [5] Const mutate $17:TPrimitive = "div" - scope @1 [6:7] deps=[freeze x$16_@0:TFunction] out=[y$19_@1] { - [6] Const mutate y$19_@1 = JSX {freeze x$16_@0:TFunction} + scope @1 [6:7] deps=[freeze x$16_@0] out=[y$19_@1] { + [6] Const mutate y$19_@1 = JSX {freeze x$16_@0} } [7] Const mutate $20:TPrimitive = 0 scope @2 [8:15] deps=[read b$14, read c$15] out=[x$22_@2] { - [8] Let mutate x$22_@2:TFunction[8:15] = undefined + [8] Let mutate x$22_@2[8:15] = undefined switch (read b$14) { case read $20:TPrimitive: { - [9] Reassign mutate x$22_@2:TFunction[8:15] = Array [] + [9] Reassign mutate x$22_@2[8:15] = Array [] [10] Call mutate x$22_@2.push(read b$14) break bb3 } default: { - [12] Reassign mutate x$22_@2:TFunction[8:15] = Array [] + [12] Reassign mutate x$22_@2[8:15] = Array [] [13] Call mutate x$22_@2.push(read c$15) } } @@ -107,8 +107,8 @@ function foo( [16] Const mutate $26 = "\n " [17] Const mutate $27 = "\n " [18] Const mutate $28 = "\n " - scope @3 [19:20] deps=[read y$19_@1, freeze x$22_@2:TFunction] out=[$31_@3] { - [19] Const mutate $31_@3 = JSX {read $26}{read y$19_@1}{read $27}{freeze x$22_@2:TFunction}{read $28} + scope @3 [19:20] deps=[read y$19_@1, freeze x$22_@2] out=[$31_@3] { + [19] Const mutate $31_@3 = JSX {read $26}{read y$19_@1}{read $27}{freeze x$22_@2}{read $28} } return read $31_@3 } diff --git a/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md b/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md index 61875c7917..2ee1e0947c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/reassignment.expect.md @@ -21,13 +21,13 @@ function Component(props) { ``` bb0: - [1] Const mutate x$7_@0:TFunction[1:7] = Array [] + [1] Const mutate x$7_@0[1:7] = Array [] [2] Call mutate x$7_@0.push(read props$6.p0) - [3] Const mutate y$8_@0:TFunction[1:7] = read x$7_@0:TFunction + [3] Const mutate y$8_@0[1:7] = read x$7_@0 [4] Const mutate x$9_@1 = Array [] [5] Const mutate _$10_@2 = JSX [6] Call mutate y$8_@0.push(read props$6.p1) - [7] Const mutate t7$11_@3 = JSX + [7] Const mutate t7$11_@3 = JSX [8] Return read t7$11_@3 ``` @@ -38,9 +38,9 @@ function Component( props, ) { scope @0 [1:7] deps=[read props$6.p0, read props$6.p1] out=[y$8_@0] { - [1] Const mutate x$7_@0:TFunction[1:7] = Array [] + [1] Const mutate x$7_@0[1:7] = Array [] [2] Call mutate x$7_@0.push(read props$6.p0) - [3] Const mutate y$8_@0:TFunction[1:7] = read x$7_@0:TFunction + [3] Const mutate y$8_@0[1:7] = read x$7_@0 scope @1 [4:5] deps=[] out=[x$9_@1] { [4] Const mutate x$9_@1 = Array [] } @@ -49,8 +49,8 @@ function Component( } [6] Call mutate y$8_@0.push(read props$6.p1) } - scope @3 [7:8] deps=[read x$9_@1, freeze y$8_@0:TFunction] out=[$11_@3] { - [7] Const mutate $11_@3 = JSX + scope @3 [7:8] deps=[read x$9_@1, freeze y$8_@0] out=[$11_@3] { + [7] Const mutate $11_@3 = JSX } return read $11_@3 } diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md index 54fd534406..ab0294f48e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch-non-final-default.expect.md @@ -32,7 +32,7 @@ function Component(props) { ``` bb0: - [1] Const mutate x$10_@1:TFunction[1:12] = Array [] + [1] Const mutate x$10_@1[1:12] = Array [] [2] Let mutate y$11_@1:TPrimitive[1:12] = undefined [3] Const mutate $12:TPrimitive = false [4] Const mutate $13:TPrimitive = true @@ -50,11 +50,11 @@ bb6: [9] Goto bb1 bb2: predecessor blocks: bb0 - [10] Reassign mutate y$11_@1:TPrimitive[1:12] = read x$10_@1:TFunction + [10] Reassign mutate y$11_@1:TPrimitive[1:12] = read x$10_@1 [11] Goto bb1 bb1: predecessor blocks: bb0 bb6 bb2 - [12] Const mutate child$19_@2 = JSX + [12] Const mutate child$19_@2 = JSX [13] Call read y$11_@1.push(read props$9.p4) [14] Const mutate t7$22_@3 = JSX {read child$19_@2} [15] Return read t7$22_@3 @@ -67,7 +67,7 @@ function Component( props, ) { scope @1 [1:12] deps=[read props$9.p0, read props$9.p2] out=[x$10_@1] { - [1] Const mutate x$10_@1:TFunction[1:12] = Array [] + [1] Const mutate x$10_@1[1:12] = Array [] [2] Let mutate y$11_@1:TPrimitive[1:12] = undefined [3] Const mutate $12:TPrimitive = false [4] Const mutate $13:TPrimitive = true @@ -85,12 +85,12 @@ function Component( break bb1 } case read $12:TPrimitive: { - [10] Reassign mutate y$11_@1:TPrimitive[1:12] = read x$10_@1:TFunction + [10] Reassign mutate y$11_@1:TPrimitive[1:12] = read x$10_@1 } } } - scope @2 [12:13] deps=[freeze x$10_@1:TFunction] out=[child$19_@2] { - [12] Const mutate child$19_@2 = JSX + scope @2 [12:13] deps=[freeze x$10_@1] out=[child$19_@2] { + [12] Const mutate child$19_@2 = JSX } [13] Call read y$11_@1.push(read props$9.p4) scope @3 [14:15] deps=[freeze y$11_@1:TPrimitive, read child$19_@2] out=[$22_@3] { diff --git a/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md b/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md index 9cf32c6749..f48373744c 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/switch.expect.md @@ -27,7 +27,7 @@ function Component(props) { ``` bb0: - [1] Const mutate x$9_@1:TFunction[1:12] = Array [] + [1] Const mutate x$9_@1[1:12] = Array [] [2] Let mutate y$10_@1:TPrimitive[1:12] = undefined [3] Const mutate $11:TPrimitive = false [4] Const mutate $12:TPrimitive = true @@ -44,11 +44,11 @@ bb4: [9] Goto bb2 bb2: predecessor blocks: bb4 bb0 - [10] Reassign mutate y$10_@1:TPrimitive[1:12] = read x$9_@1:TFunction + [10] Reassign mutate y$10_@1:TPrimitive[1:12] = read x$9_@1 [11] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [12] Const mutate child$19_@3 = JSX + [12] Const mutate child$19_@3 = JSX [13] Call read y$10_@1.push(read props$8.p4) [14] Const mutate t8$23_@4 = JSX {read child$19_@3} [15] Return read t8$23_@4 @@ -61,7 +61,7 @@ function Component( props, ) { scope @1 [1:12] deps=[read props$8.p0, read props$8.p2, read props$8.p3] out=[x$9_@1] { - [1] Const mutate x$9_@1:TFunction[1:12] = Array [] + [1] Const mutate x$9_@1[1:12] = Array [] [2] Let mutate y$10_@1:TPrimitive[1:12] = undefined [3] Const mutate $11:TPrimitive = false [4] Const mutate $12:TPrimitive = true @@ -74,12 +74,12 @@ function Component( } } case read $11:TPrimitive: { - [10] Reassign mutate y$10_@1:TPrimitive[1:12] = read x$9_@1:TFunction + [10] Reassign mutate y$10_@1:TPrimitive[1:12] = read x$9_@1 } } } - scope @3 [12:13] deps=[freeze x$9_@1:TFunction] out=[child$19_@3] { - [12] Const mutate child$19_@3 = JSX + scope @3 [12:13] deps=[freeze x$9_@1] out=[child$19_@3] { + [12] Const mutate child$19_@3 = JSX } [13] Call read y$10_@1.push(read props$8.p4) scope @4 [14:15] deps=[read y$10_@1:TPrimitive, read child$19_@3] out=[$23_@4] { diff --git a/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md b/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md index d47678cc17..54b928b15e 100644 --- a/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md +++ b/compiler/forget/src/__tests__/fixtures/hir/type-test-return-type-inference.expect.md @@ -28,7 +28,7 @@ bb2: [6] Goto bb1 bb1: predecessor blocks: bb2 bb0 - [7] Const mutate z$12_@3:TPrimitive = Call mutate foo$2:TFunction() + [7] Const mutate z$12_@3 = Call mutate foo$2:TFunction() [8] Return ``` @@ -50,7 +50,7 @@ function component( } } scope @3 [7:8] deps=[] out=[] { - [7] Const mutate z$12_@3:TPrimitive = Call mutate foo$2:TFunction() + [7] Const mutate z$12_@3 = Call mutate foo$2:TFunction() } return }