mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-CR-49176: select distinct files before optimizing imports (PY-36484)
GitOrigin-RevId: 48b187e19ee36fd274c1670ecc388c661f11f774
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a4091e6051
commit
0bceb70531
@@ -282,7 +282,11 @@ class PyInlineFunctionProcessor(project: Project,
|
||||
}
|
||||
}
|
||||
|
||||
imports.forEach { PyClassRefactoringUtil.optimizeImports(it.element!!.containingFile!!) }
|
||||
imports.asSequence()
|
||||
.map { it.element?.containingFile }
|
||||
.filterNotNull()
|
||||
.distinct()
|
||||
.forEach { PyClassRefactoringUtil.optimizeImports(it) }
|
||||
|
||||
if (myRemoveDeclaration) {
|
||||
val stubFunction = PyiUtil.getPythonStub(myFunction)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
z = 1 + 2
|
||||
print(z)
|
||||
res = z
|
||||
|
||||
|
||||
def bar():
|
||||
z = 1 + 2
|
||||
print(z)
|
||||
res1 = z
|
||||
@@ -0,0 +1,9 @@
|
||||
from src import foo
|
||||
|
||||
|
||||
res = foo(1, 2)
|
||||
|
||||
|
||||
def bar():
|
||||
from src import foo
|
||||
res1 = fo<caret>o(1, 2)
|
||||
@@ -0,0 +1,4 @@
|
||||
def foo(x, y):
|
||||
z = x + y
|
||||
print(z)
|
||||
return z
|
||||
@@ -0,0 +1,3 @@
|
||||
z = 1 + 2
|
||||
print(z)
|
||||
res = z
|
||||
@@ -0,0 +1,3 @@
|
||||
from src import fo<caret>o
|
||||
|
||||
res = foo(1, 2)
|
||||
@@ -0,0 +1,4 @@
|
||||
def foo(x, y):
|
||||
z = x + y
|
||||
print(z)
|
||||
return z
|
||||
@@ -83,6 +83,8 @@ class PyInlineFunctionTest : PyTestCase() {
|
||||
fun testRemovingDocstringAndTypeComment() = doTest()
|
||||
fun testRemovingDocstringOfEmptyFunction() = doTest()
|
||||
fun testKeepingComments() = doTest()
|
||||
fun testInvocationOnImport() = doTest(inlineThis = false, remove = true)
|
||||
fun testImportedLocally() = doTest(inlineThis = false, remove = true)
|
||||
//fun testInlineImportedAs() = doTest(inlineThis = false)
|
||||
fun testRemoveFunctionWithStub() {
|
||||
doTest(inlineThis = false, remove = true)
|
||||
|
||||
Reference in New Issue
Block a user