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

IdentityCache compiler generates wrong return types for fetch_multi_n_by_m fields #1770

Open
bitwise-aiden opened this issue Jan 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bitwise-aiden
Copy link
Contributor

Description

After implementing the missing fetch_multi_n_by_m methods in #1758 I have found out that the method signature isn't always correct as shown in this example from cache_attribute: https://github.com/Shopify/identity_cache/blob/main/lib/identity_cache/cached/attribute.rb#L82-L101

The result of methods that include by in the name is a hash where:

  • Key: type m (be it a single value or an array of multiple)
  • Value: type n or T::Array[n] depending on things like if unique has been passed to cache_attribute.

So at present when the return type is T::Array[n], it would be expected that it is actually T::Hash[T.untyped, n] or T::Hash[T.untyped, T::Array[n]] based on how it was created.

@bitwise-aiden bitwise-aiden added the bug Something isn't working label Jan 19, 2024
@andyw8
Copy link
Contributor

andyw8 commented Jan 26, 2024

@KaanOzkan @Morriar So as not hold it up any further, I've marked two calls in the latest Core RBI update as T.unsafe, with smart TODOs pointing at this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants