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

[stdlib] Introduce Hasher type with all necessary changes #2619

Draft
wants to merge 1 commit into
base: nightly
Choose a base branch
from

Conversation

mzaks
Copy link
Contributor

@mzaks mzaks commented May 11, 2024

This is a draft because although the code compiles 8 tests are failing.
It might be due to compiler bug. The error messages are cryptic. I don't have the "Mojo" ;) to fix them.

Failed Tests (8):
Mojo Standard Library :: builtin/test_dtype.mojo
Mojo Standard Library :: builtin/test_hash.mojo
Mojo Standard Library :: builtin/test_object.mojo
Mojo Standard Library :: builtin/test_string.mojo
Mojo Standard Library :: builtin/test_string_literal.mojo
Mojo Standard Library :: collections/test_dict.mojo
Mojo Standard Library :: collections/test_set.mojo
Mojo Standard Library :: python/test_python_object.mojo

Failed Tests (8):
  Mojo Standard Library :: builtin/test_dtype.mojo
  Mojo Standard Library :: builtin/test_hash.mojo
  Mojo Standard Library :: builtin/test_object.mojo
  Mojo Standard Library :: builtin/test_string.mojo
  Mojo Standard Library :: builtin/test_string_literal.mojo
  Mojo Standard Library :: collections/test_dict.mojo
  Mojo Standard Library :: collections/test_set.mojo
  Mojo Standard Library :: python/test_python_object.mojo

Signed-off-by: Maxim Zaks <maxim.zaks@gmail.com>
@mzaks
Copy link
Contributor Author

mzaks commented May 12, 2024

@mzaks
Copy link
Contributor Author

mzaks commented May 17, 2024

@JoeLoser do we have a status on this one? From what I can tell there are some unexpected deeper language problems, my guess is it has something to do with register passable types. I am ok with shelving it for now. If so, I will concentrate on some other things and revisit when it is resolvable.

@mzaks
Copy link
Contributor Author

mzaks commented May 17, 2024

Actually now I rebased the minimal reproducible example mzaks:feature/minimal-example-of-test-crash-for-new-hasher and it some times passes and some times fails the test. Seems like the order of tests is important and there is something fishy going on.

@mzaks
Copy link
Contributor Author

mzaks commented May 20, 2024

After rebasing the mzaks:feature/minimal-example-of-test-crash-for-new-hasher on todays nightly, I see following compile error on :

invalid indirect call: l-value of type '$0' cannot be converted to reference of type 'H'
struct Int(
       ^~~

The H in question is from:

trait NewHashable:
    fn __hash_with__[H: Hasher](self, inout hasher: H):
        pass

which Int is implementing.

I pushed the rebased version so the team can confirm.

modularbot pushed a commit that referenced this pull request May 27, 2024
…#40624)

[External] [stdlib] Add the new `Hasher` trait with some unit tests

This was done in cooperation with @mzaks. We want to introduce the new
hasher progressively to make it easier to review and flush out the
compiler bugs.

New names will be used to avoid conflicts during the transition.

The source PR is this one: #2619

Co-authored-by: Gabriel de Marmiesse <gabriel.demarmiesse@datadoghq.com>

Co-authored-by: Maxim Zaks <maxim.zaks@gmail.com>
Closes #2823
MODULAR_ORIG_COMMIT_REV_ID: 67371ec3b0c3eb886896c2a030567d465d187efa
Av1nag pushed a commit to Av1nag/mojo that referenced this pull request May 27, 2024
…#40624)

[External] [stdlib] Add the new `Hasher` trait with some unit tests

This was done in cooperation with @mzaks. We want to introduce the new
hasher progressively to make it easier to review and flush out the
compiler bugs.

New names will be used to avoid conflicts during the transition.

The source PR is this one: modularml#2619

Co-authored-by: Gabriel de Marmiesse <gabriel.demarmiesse@datadoghq.com>

Co-authored-by: Maxim Zaks <maxim.zaks@gmail.com>
Closes modularml#2823
MODULAR_ORIG_COMMIT_REV_ID: 67371ec3b0c3eb886896c2a030567d465d187efa
Av1nag pushed a commit to Av1nag/mojo that referenced this pull request May 27, 2024
…#40624)

[External] [stdlib] Add the new `Hasher` trait with some unit tests

This was done in cooperation with @mzaks. We want to introduce the new
hasher progressively to make it easier to review and flush out the
compiler bugs.

New names will be used to avoid conflicts during the transition.

The source PR is this one: modularml#2619

Co-authored-by: Gabriel de Marmiesse <gabriel.demarmiesse@datadoghq.com>

Co-authored-by: Maxim Zaks <maxim.zaks@gmail.com>
Closes modularml#2823
MODULAR_ORIG_COMMIT_REV_ID: 67371ec3b0c3eb886896c2a030567d465d187efa

Signed-off-by: Avinag <udayagiriavinag@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant