adopt Core.Compiler.get_max_methods
changes from #46810
#49781
Merged
Core.Compiler.get_max_methods
changes from #46810
#49781