Open yoav-steinberg opened 6 months ago
Another example of the same issue using our JSII fixture class which doesn't have any "constructs" in it:
bring "jsii-fixture" as jf;
let x = new jf.JsiiClass(1);
test "test" {
log("{x.field()}");
}
This causes the same "can't lift object of type JsiiClass" issue.
Will this work?
let o = new JsiiClass();
inflight () => {
log(o.myString);
};
Will this work?
No, it won't, it's the same as my example above. JsiiClass
is phase ind but doesn't implement ILiftable
so o
can't be lifted. In theory we can eagerly lift o.myString
but in some cases we don't want to do that because we want to access myString
in inflight (because of any side effects of this access, they use would probably expect it to be accessed inflight).
because of any side effects of this access
What kind of side effects can occur?
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!
I tried this:
This happened:
I expected this:
To print the node address
Is there a workaround?
Don't use the node object inflight, lift the specific fields you need (which makes more sense anyway)
Anything else?
Note that this use to work back when we more eagerly lifted expressions, so
x.addr
was lifted in its entirety while todayx
is lifted (being phase independent) andaddr
is accessed inflight. Tthis is good for many reasons but introduces this bug where phase independent classes that don't implementILiftable
(like stuff imported from JSII) cause an issue. Ideas for solving this:ILiftable
for them, is this possible? How?Construct
is considered phase independent, but we might want to consider anything that doesn't have any preflight types in its surface area as phase independent. thestd.Node
objects has multiple methods, and fields (root
,of()
) that reference the preflightConstruct
type. So perhaps theNode
type should be marked as preflight after all. This will fix this specific case, but not the generic issue of not being able to lift phase independent objects/types brought from JSII.Wing Version
No response
Node.js Version
No response
Platform(s)
No response
Community Notes