@@ -1402,3 +1402,38 @@ end
14021402 end
14031403 end
14041404end
1405+
1406+ # https://github.com/JuliaLang/julia/issues/45050
1407+ @testset " propagate :meta annotations to keyword sorter methods" begin
1408+ # @inline, @noinline, @constprop
1409+ let @inline issue45050_f1 (:: Any ; x:: Int = 1 ) = 2 x
1410+ @test ccall (:jl_ir_flag_inlineable , Bool, (Any,), only (methods (issue45050_f1)). source)
1411+ @test ccall (:jl_ir_flag_inlineable , Bool, (Any,), only (methods (Core. kwfunc (issue45050_f1))). source)
1412+ end
1413+ let @noinline issue45050_f2 (:: Any ; x:: Int = 1 ) = 2 x
1414+ @test ! ccall (:jl_ir_flag_inlineable , Bool, (Any,), only (methods (issue45050_f2)). source)
1415+ @test ! ccall (:jl_ir_flag_inlineable , Bool, (Any,), only (methods (Core. kwfunc (issue45050_f2))). source)
1416+ end
1417+ let Base. @constprop :aggressive issue45050_f3 (:: Any ; x:: Int = 1 ) = 2 x
1418+ @test Core. Compiler. is_aggressive_constprop (only (methods (issue45050_f3)))
1419+ @test Core. Compiler. is_aggressive_constprop (only (methods (Core. kwfunc (issue45050_f3))))
1420+ end
1421+ let Base. @constprop :none issue45050_f4 (:: Any ; x:: Int = 1 ) = 2 x
1422+ @test Core. Compiler. is_no_constprop (only (methods (issue45050_f4)))
1423+ @test Core. Compiler. is_no_constprop (only (methods (Core. kwfunc (issue45050_f4))))
1424+ end
1425+
1426+ # propagate multiple metadata also
1427+ let @inline Base. @constprop :aggressive issue45050_f5 (:: Any ; x:: Int = 1 ) = 2 x
1428+ @test ccall (:jl_ir_flag_inlineable , Bool, (Any,), only (methods (issue45050_f5)). source)
1429+ @test Core. Compiler. is_aggressive_constprop (only (methods (issue45050_f5)))
1430+ @test ccall (:jl_ir_flag_inlineable , Bool, (Any,), only (methods (Core. kwfunc (issue45050_f5))). source)
1431+ @test Core. Compiler. is_aggressive_constprop (only (methods (Core. kwfunc (issue45050_f5))))
1432+ end
1433+ let @noinline Base. @constprop :aggressive issue45050_f6 (:: Any ; x:: Int = 1 ) = 2 x
1434+ @test ! ccall (:jl_ir_flag_inlineable , Bool, (Any,), only (methods (issue45050_f6)). source)
1435+ @test Core. Compiler. is_aggressive_constprop (only (methods (issue45050_f6)))
1436+ @test ! ccall (:jl_ir_flag_inlineable , Bool, (Any,), only (methods (Core. kwfunc (issue45050_f6))). source)
1437+ @test Core. Compiler. is_aggressive_constprop (only (methods (Core. kwfunc (issue45050_f6))))
1438+ end
1439+ end
0 commit comments