From c306c788e916ccd4fc75e103939f2cf87adec68c Mon Sep 17 00:00:00 2001 From: Steven Cole Date: Fri, 28 Aug 2026 16:03:00 -0700 Subject: [PATCH] fix: duplicate private names now throw as expected When doing coverage testing, I couldn't figure out how to cause this error to happen. But there's a test262 test that does it, so the exception handling goes back in. --- src/object/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/object/mod.rs b/src/object/mod.rs index 925c63d5..39c46ee2 100644 --- a/src/object/mod.rs +++ b/src/object/mod.rs @@ -2738,8 +2738,7 @@ pub(crate) fn define_field(obj: &Object, field: &ClassFieldDefinitionRecord) -> match field_name { ClassName::String(string) => obj.create_data_property_or_throw(string, init_value)?, ClassName::Symbol(symbol) => obj.create_data_property_or_throw(symbol.clone(), init_value)?, - ClassName::Private(pn) => private_field_add(obj, pn.clone(), init_value) - .expect("Private field duplication is protected, and this should never error"), + ClassName::Private(pn) => private_field_add(obj, pn.clone(), init_value)?, } Ok(()) }