julia
julia copied to clipboard
inference: make `Core.Compiler.return_type` respect `max_methods` setting
Previously we didn't limit the number of matching methods for
Core.Compiler.return_type, which could lead to a potential latency
problem.
This commit makes Core.Compiler.return_type and the corresponding
tfunc return_type_tfunc respect max_methods setting as like the
ordinary inference.
One caveat here is that the current Core.Compiler.return_type interface
unfortunately doesn't allow it to see the caller module context, so it
can't respect module-wide max_methods setting (I guess the change to
the interface should be made as of version 2.0), that I think can lead
to a potential confusion.