Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Passing functions which have arguments to other functions fails without type hints #2601

Open
jackmott opened this issue May 9, 2024 · 0 comments
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@jackmott
Copy link

jackmott commented May 9, 2024

Bug description

Within def functions I expect to be able to pass function pointers around without type hints just as I would in python. If the functions have no arguments, this works fine. But passing a function that has arguments to another function currently fails, unless you add type hints.

Steps to reproduce

Here is a minimal reproducing example, the call to bar within main errors with: invalid call to 'bar': argument #0 cannot be converted from 'fn(owned s: object) raises -> object' to 'object'mojo

def foo(s):
    print(s)
     
def bar(foo):
    foo("foo")
    print("bar")
 
def main():
    bar(foo)

System information

- Windows with Ubuntu linux subsystem
- Mojo 24.3.0
- Modular 0.7.4
@jackmott jackmott added bug Something isn't working mojo-repo Tag all issues with this label labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

1 participant