Skip to content

Handle Null type in TypeSignatureClass more consistently #15013

Open
@alan910127

Description

@alan910127

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions