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] Some syntax sugars doesn't work with special methods using conditional conformance #3199

Closed
soraros opened this issue Jul 9, 2024 · 3 comments
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

@value
struct S[T: CollectionElement]:
    var data: T

    fn __eq__[
        T: ComparableCollectionElement, //,
    ](self: S[T], other: S[T]) -> Bool:
        return self.data == other.data

fn main():
    var a = S(1)
    var b = S(2)
    a == b       # invalid call to '__eq__': could not deduce parameter 'T' of parent struct 'S'
    a.__eq__(b)  # runs fine

System information

Mojo 2024.7.705 (3d1f7817) on Docker, Intel Mac
@soraros soraros added bug Something isn't working mojo-repo Tag all issues with this label labels Jul 9, 2024
@JoeLoser
Copy link
Collaborator

JoeLoser commented Jul 9, 2024

Thanks for filing this! FYI @lattner @Mogball

@soraros
Copy link
Contributor Author

soraros commented Jul 9, 2024

Actually, I was wrong, 97d70d3 fixed this exact problem, and it works on mojo 2024.7.905 (e860c551).

@JoeLoser
Copy link
Collaborator

JoeLoser commented Jul 9, 2024

Actually, I was wrong, 97d70d3 fixed this exact problem, and it works on (mojo 2024.7.905 (e860c551)).

Confirmed it works on top-of-tree today. Closing this issue as such. Thanks!

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