@samitouri / QOS-React-2 / commits / a0fa5ede54

[typer] Type Array.at returnType as PolyType

Sathya Gunasekaran committed Mar 27, 2023 at 15:58 UTC a0fa5ede549c76600734d2758f1617b7c8fb44aa
2 files changed +4 -4
compiler/forget/src/HIR/ObjectShape.ts
+3 -3
@@ -6,7 +6,7 @@
6 */
7 import invariant from "invariant";
8 import { Effect } from "./HIR";
9 -import { BuiltInType, FunctionType, PrimitiveType } from "./Types";
9 +import { BuiltInType, FunctionType, PolyType, PrimitiveType } from "./Types";
10
11 const PRIMITIVE_TYPE: PrimitiveType = {
12 kind: "Primitive",
@@ -58,7 +58,7 @@ function addShape(
58 export type FunctionSignature = {
59 positionalParams: Array<Effect>;
60 restParam: Effect | null;
61 - returnType: BuiltInType | null;
61 + returnType: BuiltInType | PolyType;
62 calleeEffect: Effect;
63 };
64
@@ -85,7 +85,7 @@ addShape(BUILTIN_SHAPES, ArrayShapeId, [
85 addFunction(BUILTIN_SHAPES, [], {
86 positionalParams: [Effect.Read],
87 restParam: null,
88 - returnType: null,
88 + returnType: { kind: "Poly" },
89 calleeEffect: Effect.Read,
90 }),
91 ],
compiler/forget/src/HIR/Types.ts
+1 -1
@@ -9,7 +9,7 @@ import { Hook } from "./Hooks";
9
10 export type BuiltInType = PrimitiveType | FunctionType | ObjectType;
11
12 -export type Type = BuiltInType | HookType | PhiType | PolyType | TypeVar;
12 +export type Type = BuiltInType | HookType | PhiType | TypeVar | PolyType;
13 export type PrimitiveType = { kind: "Primitive" };
14 export type HookType = {
15 kind: "Hook";