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

Error when more than one space is placed between if and let #3959

Closed
marciocadev opened this issue Aug 24, 2023 · 1 comment · Fixed by #3960
Closed

Error when more than one space is placed between if and let #3959

marciocadev opened this issue Aug 24, 2023 · 1 comment · Fixed by #3960
Assignees
Labels
🐛 bug Something isn't working

Comments

@marciocadev
Copy link
Collaborator

I tried this:

Compiling this code with 2 spaces between if and let

let b: num? = 1;
if  let z = b {
  assert(z == 1);
}

This happened:

Gives

$ wing compile main.w
error: Expected block
  --> main.w:2:8
  |
2 | if  let z = b {
  |        ^ Expected block


error: Unexpected 'custom_type'
  --> main.w:2:13
  |
2 | if  let z = b {
  |             ^ Unexpected 'custom_type'


error: Unexpected 'identifier'
  --> main.w:3:3
  |
3 |   assert(z == 1);
  |   ^^^^^^ Unexpected 'identifier'


error: Unknown parser error
  --> main.w:4:1
  |
4 | }
  | ^ Unknown parser error


error: Unknown symbol "let"
  --> main.w:2:5
  |
2 | if  let z = b {
  |     ^^^ Unknown symbol "let"


error: Unknown symbol "z"
  --> main.w:3:10
  |
3 |   assert(z == 1);
  |          ^ Unknown symbol "z"


error: Unknown symbol "z"
  --> main.w:2:9
  |
2 | if  let z = b {
  |         ^ Unknown symbol "z"

I expected this:

it works

Is there a workaround?

Removing the extra space

Component

Compiler

Wing Version

0.24.83

Node.js Version

v18.16.1

Platform(s)

Linux

Anything else?

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@marciocadev marciocadev added the 🐛 bug Something isn't working label Aug 24, 2023
@marciocadev marciocadev self-assigned this Aug 24, 2023
@mergify mergify bot closed this as completed in #3960 Aug 24, 2023
mergify bot pushed a commit that referenced this issue Aug 24, 2023
…and `let` (#3960)

@MarkMcCulloh, your review on PR #3888 made me realize that if I put more than one space between `if let`, it generates errors.

I've updated the `if let` to work even with extra spaces.

Closes #3959 

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.26.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants