syntax icon indicating copy to clipboard operation
syntax copied to clipboard

File converted from Reason to Rescript using bsc -format does not compile and Reason syntax not expressible in Rescript

Open mbergal opened this issue 4 years ago • 0 comments

Reason file:

let f: unit => [ | `A] = () => `A;
let g: unit => [ | `B] = () => `B;

let h = b =>
  if (b) {
    (f(): [ | `A] :> [> | `A]);
  } else {
    (g(): [ | `B] :> [> | `B]);
  };

Rescript file:

let f: unit => [#A] = () => #A
let g: unit => [#B] = () => #B

let h = b =>
  if b {
    (f(): [#A] :> [> #A])
  } else {
    (g(): [#B] :> [> #B])
  }

Error:

Type Errors
[E] Line 8, column 5:
This has type: [#B]
  Somewhere wanted: [#A]
  These two variant types have no intersection

Discussion here and here

mbergal avatar Feb 20 '21 23:02 mbergal