Repository navigation
Fix nullable parameter code generation - #191
Open
ninjapanzer wants to merge 2 commits into
Open
ninjapanzer wants to merge 2 commits into
ninjapanzer wants to merge 2 commits into
Conversation
Fixes the "can't use variable name inside assignment to variable" error that occurs when generating bindings for functions with nullable parameters.
Verifies the generator produces `_nullable = if nullable.nil?` instead of the broken `nullable = if nullable.nil?` pattern that Crystal rejects with "can't use variable name inside assignment".
|
I had the same problem and used this PR to fix it. I would appreciate it, if this PR is going to be in a future official release soon. |
Owner
|
believe me, I just saw this PR today, I'll review it next days, thanks! |
Author
|
@hugopl bump :) Happy Wednesday! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When generating bindings for functions with nullable non-array parameters, gi-crystal produces invalid Crystal code.
_nullablepattern. Existing core tests guards against_nullableparameters_ from /spec/basic_spec.cr guard against this bug so this new spec if for regression coverage..try(&.size)instead ofgenerate_null_guard. The bug only triggers fornullablenon-array parameters.Related Issues