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

expected function to return type when trying to define an optional function #3115

Closed
ekeren opened this issue Jun 28, 2023 · 3 comments
Closed
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler

Comments

@ekeren
Copy link

ekeren commented Jun 28, 2023

I tried this:

struct Options {
  mappingFunction: ((num, str): str)? ; 
}

This happened:

Failed to compile.

error: Expected function return type
  --> test.w:2:20
  |
2 |   mappingFunction: ((num, str): str)? ; 
  |                    ^^^^^^^^^^^^^^^^^ Expected function return type


error: Compiler bug (panicked at 'called `Result::unwrap()` on an `Err` value: ()', libs/wingc/src/parser.rs:910:34) during parsing, please report at https://docs.winglang.io/contributing/bugs
  --> test.w:1:1
  |  
1 | / struct Options {
2 | |   mappingFunction: ((num, str): str)? ; 
3 | | }
  | \-^ Compiler bug (panicked at 'called `Result::unwrap()` on an `Err` value: ()', libs/wingc/src/parser.rs:910:34) during parsing, please report at https://docs.winglang.io/contributing/bugs

I expected this:

mappingFunction to be an optional function

Is there a workaround?

No response

Component

Compiler

Wing Version

0.22.27

Wing Console Version

No response

Node.js Version

No response

Platform(s)

No response

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.
@ekeren ekeren added the 🐛 bug Something isn't working label Jun 28, 2023
@monadabot monadabot added this to Wing Jun 28, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Jun 28, 2023
@staycoolcall911 staycoolcall911 moved this from 🆕 New - not properly defined to 🤝 Backlog - handoff to owners in Wing Jun 28, 2023
@github-actions
Copy link

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@github-actions
Copy link

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@yoav-steinberg
Copy link
Contributor

dup of #4296
pr submitted for this in #5455

@github-project-automation github-project-automation bot moved this from 🤝 Backlog - handoff to owners to ✅ Done in Wing Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler
Projects
Archived in project
Development

No branches or pull requests

3 participants