void () { // resolve to the last overload final PyFunction foo = assertResolvesTo(PyFunction.class, "foo"); final TypeEvalContext context = TypeEvalContext.codeAnalysis(myFixture.getProject(), myFixture.getFile()); assertTrue(PyiUtil.isOverload(foo, context)); ((PyFile)foo.getContainingFile()) .getTopLevelFunctions() .forEach( function -> assertTrue(function == foo || PyPsiUtils.isBefore(function, foo)) ); }