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

Can't access base class's inflight fields #3977

Closed
yoav-steinberg opened this issue Aug 27, 2023 · 4 comments
Closed

Can't access base class's inflight fields #3977

yoav-steinberg opened this issue Aug 27, 2023 · 4 comments
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler

Comments

@yoav-steinberg
Copy link
Contributor

I tried this:

class FooBase {
  inflight baseInflightField: str;

  inflight init() {
    this.baseInflightField = "base inflight field";
  }
}

class Foo extends FooBase {}

let foo = new Foo();

test "a test" {
  log(foo.baseInflightField);
}

This happened:

3:27 $ apps/wing/bin/wing test temp/bla.w 
ERROR: Resource root/env0/Foo does not support inflight operation baseInflightField (requested by root/env0/test:a test/Handler)

temp/target/test/bla.wsim.164393.tmp/.wing/preflight.js:87
         _registerBind(host, ops) {
           if (ops.includes("handle")) {
>>           $Closure1._registerBindObject(foo, host, ["baseInflightField"]);
           }
           super._registerBind(host, ops);

 
 
Tests 1 failed (1)
Test Files 1 failed (1)

I expected this:

to work (print the base class's inflight field's value)

Is there a workaround?

No response

Component

Compiler

Wing Version

No response

Node.js Version

No response

Platform(s)

No response

Anything else?

I was attempting to prove there's a bug where we don't call the base class's inflight init method. So base class fields don't get initialized, for example. But then this happened.
I guess we now need to fix both..

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.
@yoav-steinberg yoav-steinberg added the 🐛 bug Something isn't working label Aug 27, 2023
@monadabot monadabot added this to Wing Aug 27, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Aug 27, 2023
@staycoolcall911 staycoolcall911 changed the title Can't access base class's inflight feidls Can't access base class's inflight fields Aug 27, 2023
@staycoolcall911 staycoolcall911 moved this from 🆕 New - not properly defined to 🤝 Backlog - handoff to owners in Wing Aug 27, 2023
@Chriscbr
Copy link
Contributor

This could be a regression from my PR #3884 (sorry 😬)

@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!

Copy link

Hi,

This issue hasn't seen activity in 90 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 github-actions bot added the Stale label Feb 29, 2024
@Chriscbr Chriscbr added this to the Winglang Stable Release milestone Feb 29, 2024
@github-actions github-actions bot removed the Stale label Mar 1, 2024
@staycoolcall911
Copy link
Contributor

Had to modernize the code a bit (init -> new, exposed the inflight field as pub), but then this works - closing.

@github-project-automation github-project-automation bot moved this from 🤝 Backlog - handoff to owners to ✅ Done in Wing Mar 4, 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