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] Using the output slot breaks trait conformance #3540

Open
samufi opened this issue Sep 23, 2024 · 0 comments
Open

[BUG] Using the output slot breaks trait conformance #3540

samufi opened this issue Sep 23, 2024 · 0 comments
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@samufi
Copy link

samufi commented Sep 23, 2024

Bug description

When using the results slot in a method necessary to implement a trait, the compiler complains that the trait is not implemented.

Steps to reproduce

This fails:

@register_passable("trivial")
struct MyStruct(Hashable):
    var val: Int
    fn __hash__(self) -> UInt as output:
        output = UInt(self.val)

This works:

@register_passable("trivial")
struct MyStruct(Hashable):
    var val: Int
    fn __hash__(self) -> UInt:
        return UInt(self.val)

System information

- WSL on Windows 10
- mojo 24.5.0 (e8aacb95)
- magic 0.2.3
@samufi samufi added bug Something isn't working mojo-repo Tag all issues with this label labels Sep 23, 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