Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

This argument cannot be applied without label. Confused, can anyone explain?

$
0
0

Hello everyone,

Can someone explain this to me ?

let log_name = (first_name, ~last_name=?) => {
  switch last_name {
  | None => Console.log2(first_name, "Noname")
  | Some(last_name) => Console.log2(first_name, last_name)
  }
}

let ada = "Ada"

// this is OK
log_name(ada)

// this is OK too
ada->log_name(~last_name="Lovelace")

// this is not OK
ada->log_name()

Error message is:


  We've found a bug for you!
  /.../__tests__/Demo_test.res:34:17

  32 ┆ ada->log_name(~last_name="Lovelace")
  33 ┆ // this is not
  34 ┆ ada->log_name()
  35 ┆
  36 ┆ Assert.pass(~message="OK")

  The function applied to this argument has type
    ('a, ~last_name: 'b=?) => unit
This argument cannot be applied without label

Viewing all articles
Browse latest Browse all 2592

Trending Articles