PY-77167 Simplify resolve logic for overloads, get rid of RatedResolveResult#RATE_LIFTED_PY_FILE_OVERLOAD

If there is an overload not followed by an implementation, which is
already an error, always resolve to the first overload, regardless
of whether it's a .py file, or a .pyi stub. It allows us to eliminate
the special RatedResolveResult#RATE_LIFTED_PY_FILE_OVERLOAD rate in .py
files, because we no longer need to duplicate the last, closest reachable
overload (normally an implementation should be reachable) with a higher
priority, and then filter it out during overload resolution.

Meanwhile, this filtering out didn't work right before
because some type inference logic, e.g., PyCallExpressionHelper.getCalleeType
used in PyReferenceExpressionImpl.getCallableType bypassed it. It should have
been done at the level of
PyCallExpressionHelper.forEveryScopeTakeOverloadsOtherwiseImplementations.


(cherry picked from commit 99a624ab85957d7a2d3c2c0ced596e472f9d615b)

IJ-MR-148398

GitOrigin-RevId: c2cdfe8c8b046118f4e6f7269dbf7848dd746e08
This commit is contained in:
Mikhail Golubev
2024-11-01 18:06:57 +02:00
committed by intellij-monorepo-bot
parent dc39c7d32d
commit 31678081b3
7 changed files with 36 additions and 19 deletions

View File

@@ -61,9 +61,6 @@ public class RatedResolveResult implements ResolveResult {
*/
public static final int RATE_NORMAL = 0;
@ApiStatus.Experimental
public static final int RATE_LIFTED_PY_FILE_OVERLOAD = -100;
@ApiStatus.Experimental
public static final int RATE_PY_FILE_OVERLOAD = -200;