Skip to content

Functions with optional arguments do not type-check their mandatory parameters #32

@bennn

Description

@bennn

This code compiles and runs, even though the type annotation on the mandatory parameter x is wrong:

def g(x:int, y=0)->int:
  return x[y]

g([3])

If you remove the optional argument y, retic raises a static type error (good!):

def g(x:int)->int:
  y = 0
  return x[y]

# Cannot index into a value of type Int

Tested on the master branch, 7adef84

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions