Skip to content

function call lacking argument #514

@motok822

Description

@motok822

On Julia v1.11.0

julia> function f(a,b,c)
           a+b+c
       end
f (generic function with 1 method)

julia> f(1,2)
ERROR: MethodError: no method matching f(::Int64, ::Int64)
The function `f` exists, but no method is defined for this combination of argument types.

vs

When using JuliaSyntax

julia> code = """
       function f(a,b,c)
           a + b + c
       end
       f(1,2)
       """
"function f(a,b,c)\n    a + b + c\nend\nf(1,2)\n"

julia> JuliaSyntax.parseall(SyntaxNode, code)
SyntaxNode:
[toplevel]
  [function]
    [call]
      f                                  :: Identifier
      a                                  :: Identifier
      b                                  :: Identifier
      c                                  :: Identifier
    [block]
      [call-i]
        a                                :: Identifier
        +                                :: +
        b                                :: Identifier
        c                                :: Identifier
  [call]
    f                                    :: Identifier
    1                                    :: Integer
    2                                    :: Integer

When calling a function which lacks some arguments, there should be an error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions