diff --git a/python/src/com/jetbrains/python/psi/impl/references/PyReferenceImpl.java b/python/src/com/jetbrains/python/psi/impl/references/PyReferenceImpl.java index 14d732b05540..3b81f0b18406 100644 --- a/python/src/com/jetbrains/python/psi/impl/references/PyReferenceImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/references/PyReferenceImpl.java @@ -98,7 +98,7 @@ public class PyReferenceImpl implements PsiReferenceEx, PsiPolyVariantReference public ResolveResult[] multiResolve(final boolean incompleteCode) { if (USE_CACHE) { final ResolveCache cache = ResolveCache.getInstance(getElement().getProject()); - return cache.resolveWithCaching(this, CachingResolver.INSTANCE, false, incompleteCode); + return cache.resolveWithCaching(this, CachingResolver.INSTANCE, true, incompleteCode); } else { return multiResolveInner(); diff --git a/python/testData/resolve/SOEDecoratingFunctionWithSameNameDecorator.py b/python/testData/resolve/SOEDecoratingFunctionWithSameNameDecorator.py new file mode 100644 index 000000000000..4429edc68e2b --- /dev/null +++ b/python/testData/resolve/SOEDecoratingFunctionWithSameNameDecorator.py @@ -0,0 +1,15 @@ +def foo(baz=None): + def _foo(func): + def wrapper(*args, **kwargs): + func(*args, **kwargs) + + wrapper.baz = baz + return wrapper + + return _foo + + +@foo +# +def foo(): + pass \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyResolveTest.java b/python/testSrc/com/jetbrains/python/PyResolveTest.java index 53a3643b90a4..934fbe406799 100644 --- a/python/testSrc/com/jetbrains/python/PyResolveTest.java +++ b/python/testSrc/com/jetbrains/python/PyResolveTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.python; import com.intellij.psi.PsiElement; @@ -1246,4 +1232,10 @@ public class PyResolveTest extends PyResolveTestCase { assertEquals("__lt__", dunderLt.getName()); assertEquals("str", dunderLt.getContainingClass().getName()); } + + // PY-26006 + public void testSOEDecoratingFunctionWithSameNameDecorator() { + final PyFunction function = assertInstanceOf(doResolve(), PyFunction.class); + assertEquals(4, function.getTextOffset()); + } }