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
An own NON-callable property that shadows a builtin method runs the builtin instead of throwing TypeError #11006
Where.crates/perry-runtime/src/object/own_override.rs, own_user_method_value: an own property whose value is not pointer-tagged returns None, which the call site cannot distinguish from "no own property". The dispatcher then runs the builtin.
ECMA-262 resolves recv.m(a) as Get(recv, "m") then Call, and Call on a non-callable throws. perry reads the own value, sees it is not a pointer, treats that as "no own method", and dispatches the builtin — so a shadowed method silently keeps working instead of throwing.
Not a regression. Measured identically on main (a022cf2e4) and on the #10958 branch, so #10958 neither causes nor worsens it. Found while verifying a review finding on that PR; filed separately rather than widening its scope.
Shape of the fix.own_user_method_value currently answers a two-valued question ("own user method, or run the builtin") over a three-valued world: an own callable, an own NON-callable, and absent-or-borrowed-builtin. The third is the only one that may reach the builtin. A non-callable own value has to reach the call site as its own answer and throw before collection dispatch, which is also where the right TypeError message can be produced.
Found by review (CodeRabbit) on #10958; the two rows above are the run.
Activity
fix(runtime): reject noncallable own method shadows (#11006)