Shopify / tapioca

The swiss army knife of RBI generation
MIT License
701 stars 115 forks source link

In ActiveRecordColumns persisted mode, remove T.nilable from reflected sigs #1937

Closed alex-tan closed 2 weeks ago

alex-tan commented 4 weeks ago

Motivation

We use types inheriting from ActiveModel::Type::Value where the deserialize sig says it returns T.nilable([custom type]). However when using the new dsl persisted mode, we can assume the type won't be nilable.

Implementation

Apply as_non_nilable_type to getter_type and setter_type only in persisted mode and when the column is not nullable.

Tests

I've added tests.