@@ -5011,6 +5011,18 @@ mod tests {
50115011 "# ] ] ) ;
50125012 }
50135013
5014+ #[ test]
5015+ fn test_invokebuiltin_cexpr_annotated ( ) {
5016+ assert_method_hir_with_opcode ( "class" , YARVINSN_opt_invokebuiltin_delegate_leave , expect ! [ [ r#"
5017+ fn class@<internal:kernel>:20:
5018+ bb0(v0:BasicObject):
5019+ v3:Class = InvokeBuiltin _bi20, v0
5020+ Jump bb1(v0, v3)
5021+ bb1(v5:BasicObject, v6:Class):
5022+ Return v6
5023+ "# ] ] ) ;
5024+ }
5025+
50145026 #[ test]
50155027 fn test_invokebuiltin_delegate_with_args ( ) {
50165028 // Using an unannotated builtin to test InvokeBuiltin generation
@@ -5028,10 +5040,13 @@ mod tests {
50285040
50295041 #[ test]
50305042 fn test_invokebuiltin_delegate_without_args ( ) {
5031- assert_method_hir_with_opcode ( "class" , YARVINSN_opt_invokebuiltin_delegate_leave , expect ! [ [ r#"
5032- fn class@<internal:kernel>:20:
5043+ let iseq = crate :: cruby:: with_rubyvm ( || get_method_iseq ( "GC" , "enable" ) ) ;
5044+ assert ! ( iseq_contains_opcode( iseq, YARVINSN_opt_invokebuiltin_delegate_leave ) , "iseq GC.enable does not contain invokebuiltin" ) ;
5045+ let function = iseq_to_hir ( iseq) . unwrap ( ) ;
5046+ assert_function_hir ( function, expect ! [ [ r#"
5047+ fn enable@<internal:gc>:55:
50335048 bb0(v0:BasicObject):
5034- v3:BasicObject = InvokeBuiltin _bi20 , v0
5049+ v3:BasicObject = InvokeBuiltin gc_enable , v0
50355050 Jump bb1(v0, v3)
50365051 bb1(v5:BasicObject, v6:BasicObject):
50375052 Return v6
0 commit comments