Repository navigation
Commit a7dd328
* fix(runtime): per-evaluation inherited static wins over last-wins registry props (#6552)
A subclass of a class-EXPRESSION value evaluated more than once
(`function make(a){return class{static ast=a}}`, then
`class Number$ extends make(x) {}` / `class Widget$ extends make(y) {}`)
records THIS evaluation's parent object as its static prototype
(`class_prototype_object`, #1788). But #6443's static-DATA-field inheritance
walk reads the parent's `CLASS_DYNAMIC_PROPS`, which are keyed by the
class-expression TEMPLATE id — shared, last-wins across every evaluation — and
it ran BEFORE the per-evaluation prototype-object walk. So every renamed
effect-Schema class read via `import * as M` (`M.Number.ast`/`M.Widget.ast`)
collapsed to the LAST `make(...)`'s static `ast` (the direct export's
`DirectKeyword`), re-breaking effect Schema decode
(test_gap_renamed_class_export_namespace, the #1758/#1812 guard).
Interleave the two walks: at each level of the class-object proto chain,
consult the class's pinned per-evaluation parent object BEFORE the parent's
registry props. The pinned object is authoritative (it carries this
evaluation's own edge); the registry read stays the fallback for a plain
declaration parent (#6443: Auth.js `SignInError.kind`), which has no pinned
object. Depth order is preserved, so a closer registry static still shadows a
deeper per-evaluation one.
test_gap_renamed_class_export_namespace is byte-identical to node again across
renamed (global-colliding + not) and direct exports; #6443 static-field
inheritance + deleted-key fallthrough, #6438 per-eval statics, effect factory
static dispatch, and the rest of the class-expr/static suite (18/18) stay green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(runtime): return a present `null` inherited static, don't fall through (#6552 review)
CodeRabbit review follow-up. The interleaved per-evaluation proto-object read
guarded on `!is_undefined() && !is_null()`, so a static explicitly set to `null`
on one evaluation (`class NullAst$ extends make(null) {}`) was treated as "absent"
and fell through to the parent's last-wins `CLASS_DYNAMIC_PROPS`, returning a
SIBLING evaluation's `ast` instead of `null` (verified: perry read `{_tag:'OBJ'}`
where node reads `null`).
`null` is a present, authoritative value — only `undefined` means "absent here".
Guard on `!is_undefined()` alone so a present `null` is returned and only a true
miss continues to the registry / a higher ancestor. Extends the gap test + helper
with a renamed null-static export (`M.NullAst.ast === null`), placed before the
last non-null `make(...)` so `null` is a genuine discriminator; byte-identical to
node.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Ralph <ralph@skelpo.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 95aed4f commit a7dd328
3 files changed
Lines changed: 66 additions & 23 deletions
File tree
- crates/perry-runtime/src/object/field_get_set
- test-files
- _helpers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1033 | 1033 | | |
1034 | 1034 | | |
1035 | 1035 | | |
1036 | | - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
1037 | 1057 | | |
1038 | 1058 | | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
1043 | 1073 | | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | 1074 | | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1062 | 1093 | | |
| 1094 | + | |
| 1095 | + | |
1063 | 1096 | | |
1064 | 1097 | | |
1065 | 1098 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
19 | | - | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments