Thanks to visit codestin.com
Credit goes to github.com

Skip to content

User defined functions ignored when used as subroutine #2305

Closed
@ubaidsk

Description

@ubaidsk

// TODO: Avoid overriding of user defined functions with same name as
// intrinsics like print, quit and reserve. Right now, user defined
// functions will never be considered.

Example:

$ cat examples/expr2.py 
from lpython import i32, InOut

def reserve(a: InOut[list[i32]], b: i32):
    a.append(b)
    print("user defined reserve() called")

def main0():
    x: list[i32] = []
    reserve(x, 5)

    assert len(x) == 1
    assert x[0] == 5

main0()
$ python examples/expr2.py      
user defined reserve() called
$ lpython_in_main examples/expr2.py
AssertionError

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