rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

@this is breaking in rescript v11

Open seekshiva opened this issue 1 year ago • 3 comments

This doesn't work: link

Storing the fn in a variable and then returning it works. Link

seekshiva avatar Feb 13 '24 08:02 seekshiva

Seems to only happen in uncurried mode. cc @cristianoc

fhammerschmidt avatar Feb 13 '24 14:02 fhammerschmidt

It seems like wrapping the @this {fn definition} inside of {} is causing issues. We were able to fix it by changing from {} to ()

Screenshot 2024-02-14 at 8 35 31 AM

seekshiva avatar Feb 14 '24 03:02 seekshiva

Came here to report an issue with @this as well.

Playground

type t

@send
external on: (
  t,
  @string
  [
    | #a(t => unit)
    | #b(@this (t => unit)) // ← spot ()
  ],
) => t = "on"

// format
// ↓ ↓ ↓

type t

@send
external on: (
  t,
  @string
  [
    | #a(t => unit)
    | #b(@this t => unit) // ← () dropped
  ],
) => t = "on"

alex35mil avatar Feb 16 '24 13:02 alex35mil