Skip to content

Handle Null type in TypeSignatureClass more consistently #15013

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
alan910127 opened this issue Mar 5, 2025 · 2 comments · May be fixed by #15404
Open

Handle Null type in TypeSignatureClass more consistently #15013

alan910127 opened this issue Mar 5, 2025 · 2 comments · May be fixed by #15404
Assignees
Labels
enhancement New feature or request

Comments

@alan910127
Copy link
Contributor

alan910127 commented Mar 5, 2025

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.

@alan910127 alan910127 added the enhancement New feature or request label Mar 5, 2025
@alan910127
Copy link
Contributor Author

take

@alan910127
Copy link
Contributor Author

Since there are no other ideas, I will go with adding NULL to the allowed source types list wherever possible.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant