diff options
| -rw-r--r-- | zjit/src/hir.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs index 203be0661e..635120eb80 100644 --- a/zjit/src/hir.rs +++ b/zjit/src/hir.rs @@ -2242,6 +2242,12 @@ impl<'a> std::fmt::Display for FunctionPrinter<'a> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { let fun = &self.fun; let iseq_name = iseq_get_location(fun.iseq, 0); + // In tests, strip the line number for builtin ISEQs to make tests stable across line changes + let iseq_name = if cfg!(test) && iseq_name.contains("@<internal:") { + iseq_name[..iseq_name.rfind(':').unwrap()].to_string() + } else { + iseq_name + }; writeln!(f, "fn {iseq_name}:")?; for block_id in fun.rpo() { write!(f, "{block_id}(")?; @@ -5003,7 +5009,7 @@ mod tests { #[test] fn test_invokebuiltin_delegate_annotated() { assert_method_hir_with_opcode("Float", YARVINSN_opt_invokebuiltin_delegate_leave, expect![[r#" - fn Float@<internal:kernel>:197: + fn Float@<internal:kernel>: bb0(v0:BasicObject, v1:BasicObject, v2:BasicObject, v3:BasicObject): v6:Flonum = InvokeBuiltin rb_f_float, v0, v1, v2 Jump bb1(v0, v1, v2, v3, v6) @@ -5015,7 +5021,7 @@ mod tests { #[test] fn test_invokebuiltin_cexpr_annotated() { assert_method_hir_with_opcode("class", YARVINSN_opt_invokebuiltin_delegate_leave, expect