Skip to content

bug: function call with named arguments and with 'any' argument does not compile #780

@Namek

Description

@Namek

Hi!

The following code does not compile:

component Main {
  fun insertAfter (value : a, afterValue : Maybe(a), arr : Array(a)) : Array(a) {
    []
  }

  fun render : Html {
    insertAfter(value: "123", afterValue: Maybe.Nothing, arr: []) 
  
    <div>"Hello World!"</div>
  }
}

due to error:

░ ERROR (CALL_NOT_FOUND_ARGUMENT) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

I was looking for a named argument but I can't find it:

  value

The type of the function is:

  Function(
    a,
    afterValue: Maybe(a),
    arr: Array(a),
    Array(a))

The call in question is here:

    ┌ Main.mint:7:5
    ├───────────────────────────────────────────────────────────────────
   3│     []
   4│   }
   5│
   6│   fun render : Html {
   7│     insertAfter(value: "123", afterValue: Maybe.Nothing, arr: [])
    │     ⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃
   8│
   9│     <div>"Hello World!"</div>
  10│   }
  11│ }

The error defines the function to have 4 parameters but it has in fact just 3 parameters.

Sandbox:
https://mint-lang.com/sandbox/C5yZMlukwyting

Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions