diff --git a/compiler/forget/src/HIR/InferTypes.ts b/compiler/forget/src/HIR/InferTypes.ts index c5e4374e1e..52a42711b7 100644 --- a/compiler/forget/src/HIR/InferTypes.ts +++ b/compiler/forget/src/HIR/InferTypes.ts @@ -317,12 +317,15 @@ class Unifier { objectType.kind === "Object" && objectType.properties.has(name[0]) ) { - const newType: Type = { - kind: "Poly", - }; + let type = objectType.properties.get(name[0])!; + if (type.kind === "Poly") { + return type; + } - objectType.properties.set(name[0], newType); - return newType; + type = { kind: "Poly" }; + + objectType.properties.set(name[0], type); + return type; } return null;