fix: allow plain local reference rebinding in source paint
Verify Tessera GUI / verify (push) Failing after 7m30s

This commit is contained in:
2026-10-21 14:32:21 +08:00
parent 6a88447524
commit d19fab55b9
7 changed files with 45 additions and 2 deletions
+6
View File
@@ -41,6 +41,9 @@ pub struct Block {
}
impl ObjectPayload for Block {
fn reference_assignment_only(&self) -> bool {
true
}
fn attribute_target(&self, store: &ObjectStore) -> Result<Option<ObjectRef>, VmError> {
let Value::Object(value) = store.cell_get(self.state)? else {
return Err(VmError::InvalidArgument("Block state is not an object"));
@@ -148,6 +151,9 @@ impl Data {
}
impl ObjectPayload for Data {
fn reference_assignment_only(&self) -> bool {
true
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
+22
View File
@@ -801,6 +801,28 @@ mod tests {
const EXAMPLE: &str = include_str!("../examples/hello.endor");
const PAGE: &str = include_str!("../examples/page.endor");
#[test]
fn source_paint_can_rebind_old_plain_reference_to_new_result_without_mutating_it() {
let source = r##"class ReboundRect: RectBlock {
previous: ObjectList
function paint(self: ReboundRect, mount: Mount, geometry: Bounds): DisplayList {
drawing = self.previous
drawing = RectBlock.paint(self, mount, geometry)
return drawing
}
}
previous = ObjectList()
rect = ReboundRect(80, 40, 0, "#DDEEFF", previous)
page = Page()
page.render(rect)"##;
let (mut session, document) = ReplSession::load(source, "app.main", 75, 1).unwrap();
assert_eq!(document.frame.commands.len(), 1);
assert_eq!(
session.execute("previous.count", "app.main").unwrap().value,
"0"
);
}
#[test]
fn source_paint_overrides_native_commands_and_reacts_to_heap_field_writes() {
let (mut session, initial) = ReplSession::load(
+9
View File
@@ -20,6 +20,9 @@ pub struct Event {
prevented: bool,
}
impl ObjectPayload for Event {
fn reference_assignment_only(&self) -> bool {
true
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
@@ -38,6 +41,9 @@ pub struct Connection {
pub capture: bool,
}
impl ObjectPayload for Connection {
fn reference_assignment_only(&self) -> bool {
true
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
@@ -57,6 +63,9 @@ pub struct Subscription {
pub connection: WeakObjectRef,
}
impl ObjectPayload for Subscription {
fn reference_assignment_only(&self) -> bool {
true
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
+3
View File
@@ -23,6 +23,9 @@ pub struct Mount {
}
impl ObjectPayload for Mount {
fn reference_assignment_only(&self) -> bool {
true
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
+3
View File
@@ -6,6 +6,9 @@ use endor_core::{
#[derive(Debug)]
struct ObjectList(Vec<ObjectRef>);
impl ObjectPayload for ObjectList {
fn reference_assignment_only(&self) -> bool {
true
}
fn as_any(&self) -> &dyn std::any::Any {
self
}