Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Lua generators use None instead of nil #6720

Closed
Tracked by #7446
NathanSnail opened this issue Dec 22, 2022 · 4 comments
Closed
Tracked by #7446

Lua generators use None instead of nil #6720

NathanSnail opened this issue Dec 22, 2022 · 4 comments
Assignees
Labels
breaking change Used to mark a PR or issue that changes our public APIs. component: generators good first issue issue: bug Describes why the code or behaviour is wrong size: small Bugs that can be picked up and completed in 1-3 days

Comments

@NathanSnail
Copy link

NathanSnail commented Dec 22, 2022

This causes
image
this generates list = {None, None, None} print(#list) printing 0

Expected Behavior:
The generator should produce list = {nil, nil, nil} print(#list) printing 3

To Fix

  1. In the list block-code generators. Change references to 'None' to 'nil'.
  2. Update the block-code generator tests if they are failing.
@NathanSnail
Copy link
Author

Oops, the second example also outputs 0, however, nil should still be used though as None can be assigned to while nil can't be. nil is also a special type in Lua for no data

@gonfunko gonfunko added issue: bug Describes why the code or behaviour is wrong help wanted External contributions actively solicited component: generators labels Dec 22, 2022
@BeksOmega BeksOmega added the ghc-osd Reserved for open source day: https://anitab-org.github.io/open-source-day/ label Sep 5, 2023
@BeksOmega BeksOmega moved this to Needs Split in Blockly GHC OSD Sep 5, 2023
@BeksOmega BeksOmega added good first issue and removed help wanted External contributions actively solicited labels Sep 5, 2023
@BeksOmega BeksOmega moved this from Needs Split to Needs Detail in Blockly GHC OSD Sep 5, 2023
@BeksOmega BeksOmega added the size: small Bugs that can be picked up and completed in 1-3 days label Sep 5, 2023
@BeksOmega
Copy link
Collaborator

The following code in the playground:
image
Generates the following Lua:

None = 123
list = {None, None, None}
print(list[1])

Which results in:

123

Ideally it should be:

None = 123
list = {nil, nil, nil}
print(list[1])

Resulting in:

nil

@BeksOmega BeksOmega added breaking change Used to mark a PR or issue that changes our public APIs. and removed good first issue ghc-osd Reserved for open source day: https://anitab-org.github.io/open-source-day/ labels Sep 6, 2023
@BeksOmega BeksOmega self-assigned this Dec 8, 2023
@BeksOmega BeksOmega removed their assignment Dec 18, 2023
@neerajkumarc
Copy link
Contributor

@BeksOmega Can I be assigned?

@BeksOmega
Copy link
Collaborator

@neerajkumarc Go for it =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Used to mark a PR or issue that changes our public APIs. component: generators good first issue issue: bug Describes why the code or behaviour is wrong size: small Bugs that can be picked up and completed in 1-3 days
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants