Skip to content

Improve error message for invalid argument types #21

@mateusfccp

Description

@mateusfccp

Currently, when a function call has invalid arguments, the error is emitted in relation to the entire argument struct.

Example:

let printMessage (:message String) = print message

let main () = printMessage (:message 10)
//                         ^^^^^^^^^^^^^ invalid_argument_type

For single arguments functions this is not a big problem, but when one of the arguments match while the others don't, it may be confusing.

Example

let printUser (:name String, :age int) = print name

// The error is emitted to the entire struct, but only
// the age is invalid.
let main () = printMessage (:name "Joe", :age "10")
//                         ^^^^^^^^^^^^^^^^^^^^^^^^ invalid_argument_type

We should distinguish every problem with the passed argument and give more specific error messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: linterRelated to the linter warnings and errors.enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions