From 63f827432d3df1c2b0de00b62c13d272f586ff2a Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Sat, 15 Aug 2026 06:40:57 +0800 Subject: [PATCH] =?UTF-8?q?test:=20IC=20=E5=A4=9A=E6=80=81=20primitive=20r?= =?UTF-8?q?eceiver=20=E6=96=AD=E8=A8=80=EF=BC=88=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E5=AD=97=E8=B7=B3=E8=B6=8A=E6=97=A0=E9=94=99=E4=BD=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_vm/tests/ic_polymorphic_tests.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/oxide_vm/tests/ic_polymorphic_tests.rs b/crates/oxide_vm/tests/ic_polymorphic_tests.rs index e6e6ace4..a63b4cd7 100644 --- a/crates/oxide_vm/tests/ic_polymorphic_tests.rs +++ b/crates/oxide_vm/tests/ic_polymorphic_tests.rs @@ -169,3 +169,15 @@ fn member_compound_polymorphic_read_side_hits() { assert_eq!(r, "10003", "两对象 x 各自增 5000 次(从 1/2 起)"); assert!(misses < 5000, "读侧 4 槽缓存使 miss 远低于迭代数(实际 {misses},写侧新属性路径不计入)"); } + +/// 非对象 receiver(字符串)经 IC primitive 分支:手动跳越全部扩展字后语义正确。 +#[test] +fn primitive_receiver_skips_ic_ext_words() { + let (r, _hits, _misses) = run_once( + r#"var s = "abc"; + var total = 0; + for (var i = 0; i < 100; i++) { total += s.length; } + total + s.length"#, + ); + assert_eq!(r, "303", "字符串 length 经 primitive 分支返回 3,扩展字跳越无错位"); +}