-
Notifications
You must be signed in to change notification settings - Fork 123
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
Incorrect array signature for .new
in ActiveRecord model
#1981
Comments
We have a similar issue, probably also caused by the suspect commit linked in the original post. After regenerating types, sorbet is giving us multiple errors with the same pattern: I investigated further:
Typing attributes works:
Splatting attributes also helps:
|
@pawelduda it's a side effect of this feature #1978 combined with Sorbet's prioritization which is outlined in sorbet/sorbet#7744. I suggest typing the arguments supplied. |
- This swaps the order of the `T.untyped` and `T::Array[T.untyped]` signatures when generating RBI files for ActiveRecord methods. - Some of the methods that define a sig for `T::Array[T.untyped]`, such as `new` [1], don't support arrays as input. - More common than arrays are non-array inputs for ActiveRecord methods, so the non-array signature should come first. [1] - Shopify#1981
An incorrect signature is being generated for the
.new
method in an ActiveRecord model.Even though the
.new
method does not support arrays, this signature is nevertheless being generated:This is despite arrays not being supported in the
.new
method:Suspect commit: https://github.com/Shopify/tapioca/pull/1946/files#diff-ccd1794e49448cc1badb48d2a32af60d5fcd47336d00a484fbf474ebf79b6789R223
The text was updated successfully, but these errors were encountered: