Skip to content

Disallow parameter (argument) redefinition #1784

@certik

Description

@certik
def f(x: i32) -> i32:
    x = 2
    return x * x

print(f(3)) # => 4

Currently this is allowed:

$ lpython a.py 
4

But we should give a compile time error message "input parameter x cannot be assigned to"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions