dillon1000/react
Commit
Browse files [hir][typer] infer polymorphic types from PropertyLoad and PropertyCall
---
Expand Hindley Milner type inference to infer dependent types.
Say `t` is a typevar and `t'` is some type (a built-in type, phi node, or
another typevar).
Our type equations are as follows (please edit/correct notation 😅)
- type substitution: `t = t'`,
- ~~dependent~~ polymorphic property load: `t = t'.prop`
- polymorphic function call `t = fnCall{returnType}`
- ~~dependent property call: `t = t'.prop` (only if t'.prop is a function
type)~~
- ~~dependent return type: `t = t'.[[returntype]]`~~Changed paths21 files
First-parent comparisoncompiler/forget/src/HIR/Environment.ts ModifiedM compiler/forget/src/HIR/HIR.ts ModifiedM compiler/forget/src/HIR/PrintHIR.ts ModifiedM compiler/forget/src/TypeInference/InferTypes.ts ModifiedA compiler/forget/src/__tests__/fixtures/compiler/array-properties.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/array-properties.js AddedA compiler/forget/src/__tests__/fixtures/compiler/array-property-call.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/array-property-call.js AddedA compiler/forget/src/__tests__/fixtures/hir/array-properties.expect.md AddedA compiler/forget/src/__tests__/fixtures/hir/array-properties.js AddedA compiler/forget/src/__tests__/fixtures/hir/array-property-call.expect.md AddedA compiler/forget/src/__tests__/fixtures/hir/array-property-call.js AddedA compiler/forget/src/__tests__/fixtures/hir/infer-call-array-length.expect.md AddedA compiler/forget/src/__tests__/fixtures/hir/infer-call-array-length.js AddedM compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-ternary-destruction-with-mutation.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-ternary-destruction.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-ternary-with-mutation.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-ternary.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-unconditional-ternary-with-mutation.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-unconditional-ternary.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/hir/ssa-renaming-unconditional-with-mutation.expect.md ModifiedPatch
Files changed
Rendering syntax-highlighted changes…