You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type A = { mode: "a", x: number };
type B = { mode: "b", y: string };
type C = { mode: "b" };
function test(foo: (A|B)&C) {
(foo.y: string); // doesn't work
}
I would expect Flow to carry out a transform (A|B)&C => (A&C)|(B&C) => {}|B => B, but that's not the case.
The text was updated successfully, but these errors were encountered:
On your first example: A&C is actually not defined (it's not BOTTOM), given that there's no reason to believe mode is read-only: computing the intersection would involve asserting "a" = "b", which is a contradiction. So your simplification doesn't hold. The direct simplification would compute A | B = { }, so (A | B) & C = C which doesn't contain y.
The second example is similar: { foo: Foo } & { foo: Bar } is not defined when Foo and Bar are not the same.
I would expect Flow to carry out a transform
(A|B)&C => (A&C)|(B&C) => {}|B => B
, but that's not the case.The text was updated successfully, but these errors were encountered: