Skip to content

Commit cde90b1

Browse files
author
Ralph Küpper
committed
test(codegen): pin published pshape guard wrapper
1 parent 18c94d3 commit cde90b1

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

crates/perry-codegen/src/codegen/guarded_undefined_method_tests.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,28 @@ fn wrapper_guards_actual_bits_and_clone_erases_the_loop_filter_arm() {
172172
);
173173
}
174174

175+
#[test]
176+
fn a_pshape_family_guard_wrapper_is_a_published_capability() {
177+
let candidate = method(Vec::new());
178+
let base = "perry_method_guarded_undefined_method_ts__Scanner__scan$pshape";
179+
let mut llmod = crate::module::LlModule::new(super::default_target_triple());
180+
super::method_trampolines::emit_guarded_undefined(
181+
&mut llmod,
182+
&candidate,
183+
base,
184+
&format!("{base}$generic"),
185+
0,
186+
);
187+
let ir = llmod.to_ir();
188+
let wrapper = function_body(&ir, &format!("@{base}("));
189+
assert!(
190+
wrapper.starts_with("define double "),
191+
"the producer-published `$pshape` wrapper must retain external linkage:\n{wrapper}"
192+
);
193+
assert!(wrapper.contains(&format!("@{base}$undef0(")));
194+
assert!(wrapper.contains(&format!("@{base}$generic(")));
195+
}
196+
175197
#[test]
176198
fn a_real_parameter_write_keeps_one_unspecialized_public_body() {
177199
let mut candidate = method(Vec::new());

0 commit comments

Comments
 (0)