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

fix(tinygo): syntax error when field name is 'type' in record and a function exists that uses that record #912

Merged
merged 10 commits into from
Apr 2, 2024

Conversation

rajatjindal
Copy link
Contributor

@rajatjindal rajatjindal commented Mar 28, 2024

This PR fixes generator for go when:

  • world has a keyword as name
  • record has a field with keyword as name AND that record is used in a function

in addition, it added following two testcases which worked without any explicit changes:

  • interface has keyword
  • enum has keyword

an example of failure can be seen below. Notice lift_ret_ptr.type in the below generated code, here type is a golang keyword. and thus fails.

error:

<standard input>:25:11: expected selector or type assertion, found 'type'
test types ... FAILED

generated code:

    if lift_ret_ptr.type == 0 {
      lift_ret_val_Type = WasiFilesystem0_2_0_TypesDescriptorTypeUnknown()
    }

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

crates/go/src/lib.rs Show resolved Hide resolved
@rajatjindal rajatjindal force-pushed the field-name-type-with-func branch 3 times, most recently from d81e8bc to 67873a4 Compare March 29, 2024 07:24
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
Signed-off-by: Rajat Jindal <rajatjindal83@gmail.com>
@rajatjindal rajatjindal changed the title [wip]: fix(tinygo): syntax error when field name is 'type' in record and a function exists that uses that record fix(tinygo): syntax error when field name is 'type' in record and a function exists that uses that record Apr 1, 2024
@rajatjindal rajatjindal marked this pull request as ready for review April 1, 2024 16:52
crates/c/src/lib.rs Outdated Show resolved Hide resolved
Signed-off-by: Jiaxiao Zhou (Mossaka) <duibao55328@gmail.com>
@Mossaka Mossaka added this pull request to the merge queue Apr 2, 2024
Merged via the queue into bytecodealliance:main with commit 174c584 Apr 2, 2024
12 checks passed
mergify bot pushed a commit to andrzejressel/pulumi-wasm that referenced this pull request Apr 3, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [wit-bindgen](https://togithub.com/bytecodealliance/wit-bindgen) | workspace.dependencies | minor | `0.23.0` -> `0.24.0` |
| [wit-bindgen-rt](https://togithub.com/bytecodealliance/wit-bindgen) | workspace.dependencies | minor | `0.23.0` -> `0.24.0` |

---

### Release Notes

<details>
<summary>bytecodealliance/wit-bindgen (wit-bindgen)</summary>

### [`v0.24.0`](https://togithub.com/bytecodealliance/wit-bindgen/releases/tag/v0.24.0)

[Compare Source](https://togithub.com/bytecodealliance/wit-bindgen/compare/v0.23.0...v0.24.0)

##### Go

-   Fixed a build error for generated type names for flags: [bytecodealliance/wit-bindgen#911
-   Fixed a build error for generated filed names that are Go keywords: [bytecodealliance/wit-bindgen#912
-   Add the ability to rename Go packages: [bytecodealliance/wit-bindgen#915

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/andrzejressel/pulumi-wasm).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants