Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow] make EMethodUnbinding defered_in_speculation
Summary: The difference in behavior can be seen in the example: ``` interface MethLike { m(): number } interface PropLike { m: () => string; } declare const obj: MethLike & PropLike; ``` Before this change, calling `obj.m` and calling `obj.m()` had a weird inconsistency: ``` obj.m as () => string; // no error obj.m() as number; // no error ``` as Flow would pick `.m` from different definitions each time. Accessing `obj.m` would cause a [method-unbinding] on `MethLike`, so in the first line we would pick `.m` off of `PropLike`. In the second case, we wouldn't get a [method-unbinding] error and so we would eventually get a number. With this change the following ``` obj.m as () => number; obj.m() as number; ``` has no type incompatibility, but we still raise the method-unbinding error in the first case. Changelog: [errors] method-unbinding errors will not affect choice over intersection members. (e.g. [try-Flow](https://flow.org/try/#1N4Igxg9gdgZglgcxALlAIwIZoKYBsD6uEEAztvhgE6UYCe+JADpdhgCYowa5kA0I2KAFcAtiRQAXSkOz9sADwxgJ+NPTbYuQ3BMnTZA+Y2yU4IwRO4A6SFBIrGVDGM7c+h46fNRLuKxJIGWh8MeT0ZfhYlCStpHzNsFBAMIQkIEQwJODAQfiEyfBE4eWw2fDgofDBMsAALfAA3KjgsXGxxZC4eAw0G-GhcWn9aY3wWZldu-g1mbGqJUoBaCRHEzrcDEgBrbAk62kXhXFxJ923d-cPRHEpTgyEoMDaqZdW7vKgoOfaSKgOKpqmDA+d4gB5fMA-P6LCCMLLQbiLOoYCqgh6-GDYRYIXYLSgkRZkCR4jpddwPfJLZjpOBkO4AX34kA0SQAOlAKniuJCAAQAWV2tQAMnAdjzgDyRAAKACUyB5whENx59PZnJM3OwPIACpRYSKxRKRPLZTyALwAPh59lMUAQAG4Vez2RonlQtbZ7DyIGgAFbygUSYWirUAMh1esYBuw9udUB9vqsIh5GBIPNNloV1xMjoA9LmeQB3ODHBUQQs8nApyWCiBsRYPNAVNgVBA8kx6yjshNJ02prNKnPs3IgBomEhwaBJBoABisACYAKwAdisM5A9KAA)) Reviewed By: SamChou19815 Differential Revision: D67529686 fbshipit-source-id: 3a4184cda40d1ddf1baec68d92b00fb5c55fec07
- Loading branch information