winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.68k stars 181 forks source link

incorrect lift qualification when acessing property on return value of inflight closure #6501

Closed yoav-steinberg closed 2 weeks ago

yoav-steinberg commented 2 weeks ago

I tried this:

bring cloud;

let my = new cloud.Bucket();

inflight class Foo {
  pub do() {}
}

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

test "test" {
  foo().do();
}

This happened:

Error: Resource root/env0/$Closure1_0 does not support inflight operation do.
It might not be implemented yet.

I expected this:

to run

Is there a workaround?

We can assign the inflight closure to a temp variable and then call that temp variable. This along with an explicit lift() call works around the problem:

bring cloud;

let my = new cloud.Bucket();

inflight class Foo {
  pub do() {}
}

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

test "test" {
  lift(foo,[]);
  let x = foo;
  x().do();
}

Anything else?

No response

Wing Version

No response

Node.js Version

No response

Platform(s)

No response

Community Notes

monadabot commented 2 weeks ago

Congrats! :rocket: This was released in Wing 0.73.51.