-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Is your feature request related to a problem or challenge?
Discovered in #14763 and #14872.
Currently, NativeType::Null is treated as a special case in TypeSignatureClass::matches_native_type. This leads to an error in TypeSignatureClass::default_casted_type when the signature class is not TypeSignatureClass::Native, since both native_type and origin_type end up being Null. This results in an inconsistency between the two functions.
Describe the solution you'd like
One approach is to add TypeSignatureClass::Native(logical_null()) to the allowed_source_types of Coercion::Implicit wherever NULL is valid. However, this would require modifying many places in the codebase.
Describe alternatives you've considered
Another option is introducing a Coercion::new_nullable function, which takes the same arguments as Coercion::new_implicit and automatically adds TypeSignatureClass::Native(logical_null()) to allowed_source_type.
Additional context
Both approaches require significant changes, so I’d love to hear thoughts on which direction makes the most sense.