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

Unknown symbol "this" when defining an inflight closure inside preflight closure in the entrypoint #5034

Open
eladb opened this issue Nov 23, 2023 · 3 comments
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler

Comments

@eladb
Copy link
Contributor

eladb commented Nov 23, 2023

I tried this:

See inflight_closure_inside_preflight_closure.test.w:

let foo = () => {
  inflight () => {};
};

BTW, this is working:

class Foo {
  new() {
    let foo = () => {
      inflight () => {};
    };
  }
}

This happened:

error: Unknown symbol "this"

  |
1 | let foo = () => {
  | ^ Unknown symbol "this"

I expected this:

No response

Is there a workaround?

No response

Anything else?

I would propose that our entrypoint scope will include a this symbol, because it's basically the app.

Wing Version

No response

Node.js Version

No response

Platform(s)

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

@staycoolcall911
Copy link
Contributor

@yoav-steinberg - is this the same as #4925?

@yoav-steinberg
Copy link
Contributor

yoav-steinberg commented Jan 23, 2024

@yoav-steinberg - is this the same as #4925?

It's almost the same but slightly different. The problem here is that we fail during wing type checking because this doesn't exist in the main scope, but the inflight closure transformer added this. In #4925 this actually exists but behaves differently inside ctors and causes the generated JS to fail in preflight runtime. A fix for #4925 we'll likely fix this too, but it might be worth keeping these separate.

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
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

3 participants