- Notifications
You must be signed in to change notification settings - Fork 471
Labels
Description
Rescript version: 11.1.3
Working code:
// Note: none of the values are casted to float let (x, y) = (ev->DOM.MouseEvent.offsetX, ev->DOM.MouseEvent.offsetY)
// Note: both values are casted to float let (x, y) = (ev->DOM.MouseEvent.offsetX, ev->DOM.MouseEvent.offsetY) :> (float, float)
// Note: only first value is casted to float let (x, y) = (ev->DOM.MouseEvent.offsetX :> float, ev->DOM.MouseEvent.offsetY)
// Note: only second value is casted to float. *there are parens around the second item let (x, y) = (ev->DOM.MouseEvent.offsetX, (ev->DOM.MouseEvent.offsetY :> float))
Not working code:
// Note: coersion in both values // ERROR: Did you forget a `,` here? let (x, y) = (ev->DOM.MouseEvent.offsetX :> float, ev->DOM.MouseEvent.offsetY :> float)
// Note: coersion only in second value // ERROR: Did you forget a `,` here? let (x, y) = (ev->DOM.MouseEvent.offsetX, ev->DOM.MouseEvent.offsetY :> float)
This looks like a bug (or syntax incosistency at least), because type coersion for first item works without parens, but doesn't work for the second (requires parens). It looks like a parser bug.