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] __getitem__ with parameter index doesn't work when returning memory type #3206

Open
soraros opened this issue Jul 9, 2024 · 1 comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@soraros
Copy link
Contributor

soraros commented Jul 9, 2024

Bug description

As title.

Steps to reproduce

This is weird since if we change the return type to Int, the syntax sugar works fine.

fn main():
    var a = A()
    a[0:10]  # error: invalid call to '__getitem__': expected at most 1 positional argument, got 2

@value
struct A:
    fn __getitem__[s: Slice](self) -> String:
        return ""

System information

Mojo 2024.7.905 (e860c551)
@soraros soraros added bug Something isn't working mojo-repo Tag all issues with this label labels Jul 9, 2024
Copy link
Collaborator

Mogball commented Jul 31, 2024

Thanks for the small reproducer! We'll look into this

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

2 participants