You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subclass built inside a per-evaluation class's own static method fails '#x in' and instanceof against that class (redis RedisClient.factory shape) #11142
A per-evaluation class (declared inside a function, or top-level inside a CommonJS wrapper) builds a subclass inside one of its own static methods, as in class extends RC {}. Instances of that subclass then fail #field in instance and instance instanceof RC, and both return false. Reading this.#field through an inherited method still works.
The same subclass built outside the class body passes both checks.
This is @redis/client 6.1.0's own shape. RedisClient.factory calls attachConfig({ BaseClass: RedisClient, ... }) from inside the static method, and RedisClient.create does new (RedisClient.factory(options))(options). So a redis client has client instanceof RedisClient === false under Perry.
Inside the class body, RC in static make() resolves to the class's template ClassRef rather than to the current evaluation's class object. So the subclass evaluation pins a ClassRef as its parent. Both of the following follow the per-evaluation pinned parent chain, which stops at that ClassRef without reaching the RC evaluation the caller holds:
Per spec, the class's inner binding is the class object of that evaluation. The fix probably belongs where a fresh class's self-reference inside its own body is lowered. The #9052/#9089 static-private self-reference work is nearby.
Found while re-checking redis attachConfig for #11131 / PR #11141.
Activity
changelog: #11141 attachConfig coverage, #11142 remainder
changelog: #11141 attachConfig coverage, #11142 remainder
changelog: #11141 attachConfig coverage, #11142 remainder
fix(hir): bind a per-evaluation class declaration's own name to its e…
fix(hir): route new/instanceof of the class name and inlined/async ow…
fix(hir): bind a per-evaluation class declaration's own name to its e…
fix(hir): route new/instanceof of the class name and inlined/async ow…
test(hir): class declaration self-binding lowering (#11142)
changelog: #11190 class declaration self-binding (#11142)
fix(runtime): an evaluated class prototype's own getters shadow its h…
fix(runtime): an evaluated class prototype's own getters shadow its h…
fix(hir): route new/instanceof, async bodies and inlined factories th…
fix(runtime): an evaluated class prototype's own getters shadow its h…
fix(hir): route new/instanceof, async bodies and inlined factories th…
fix(runtime): an evaluated class prototype's own getters shadow its h…