dillon1000/react

Commit

Add examples for phi type inference

Adds test cases that would demonstrate different output if we were to update 
InferTypes to infer the types of phi identifiers when their operands have the 
same type. We currently do infer such types, but attach them to phi.type instead 
of phi.id.type, so the type doesn't effect inference. Fixing that would cause 
the output on these examples to change — however, per the discussion on #2079, 
we'd also incorrectly set the mutable ranges in some cases and cause incorrect 
compilation. 

I did a thorough review of InferReferenceEffects and can't figure out how to 
trigger the bug in our current implementation — the bug only kicks in when phi 
operands would be mutated as a store instead of a mutate, and that cannot happen 
given our currently imprecise types on phi identifiers.
Browse files
Changed paths4 files
First-parent comparison
A compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/phi-type-inference-array-push.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/phi-type-inference-array-push.js AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/phi-type-inference-property-store.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/phi-type-inference-property-store.js Added
Patch

Files changed

Rendering syntax-highlighted changes…