tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

Active record relations compiler generates incorrect `sum` sigs

Open stathis-alexander opened this issue 11 months ago • 7 comments

The active record relations compiler generates incorrect sigs for sum.

It is typed only allow the a first argument of a column name, but the active record defintion allows for passing an initial argument as well. See tapioca compiler here and active record definition here.

Additionally, it types the return to a Numeric when the result can be anything, depending on the block provided (or initial argument).

I looked into putting up a PR for this behavior myself, but I see that @jeffcarbs just merged a related change. It seems like it might be appropriate to use overloaded sigs here, but I'm not entirely sure. The Sorbet docs recommend against overloading sigs.

stathis-alexander avatar Mar 14 '24 16:03 stathis-alexander