Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Prework for 1002704 assembla ticket #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class NotPackageImportParticipants[O <: OrganizeImports](val organizeImportsInst
}
(imp, usedSelectors)
}.collect {
case (imp, selectors @ h :: _) => imp.copy(selectors = selectors).setPos(imp.pos)
case (imp, selectors @ h :: _) => imp.copy(selectors = selectors).setPos(imp.pos).setSymbol(imp.symbol).setType(imp.tpe)
}.toList
}

Expand All @@ -201,9 +201,7 @@ class NotPackageImportParticipants[O <: OrganizeImports](val organizeImportsInst
protected def doApply(trees: List[Import]) = trees.map { imp =>
val wild = imp.selectors.find(_.name == nme.WILDCARD)
if (wild.nonEmpty) {
val newImp = imp.copy(selectors = imp.selectors.filter { renamed }.sortBy { _.name } ::: wild.toList).setPos(imp.pos)
newImp.symbol = imp.symbol
newImp
imp.copy(selectors = imp.selectors.filter { renamed }.sortBy { _.name } ::: wild.toList).setPos(imp.pos).setSymbol(imp.symbol).setType(imp.tpe)
} else
imp
}.groupBy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5309,4 +5309,37 @@ class OrganizeImportsTest extends OrganizeImportsBaseTest {
}
""" isNotModified
} applyRefactoring organizeCustomized(dependencies = Dependencies.RecomputeAndModify)

@Test
def shouldNotRemoveImportWhenPathIsPartiallyGiven_v1() = new FileSet {
"""
/*<-*/
package acme

object Main extends App {
import scala.concurrent.duration
import scala.concurrent.duration.FiniteDuration

val d1: FiniteDuration = ???
val d2: duration.FiniteDuration = ???
}
""" isNotModified
} applyRefactoring organizeCustomized(dependencies = Dependencies.RecomputeAndModify)

@Ignore("FIXME")
@Test
def shouldNotRemoveImportWhenPathIsPartiallyGiven_v2() = new FileSet {
"""
/*<-*/
package acme

import scala.concurrent.duration
import scala.concurrent.duration.FiniteDuration

object Main extends App {
val d1: FiniteDuration = ???
val d2: duration.FiniteDuration = ???
}
""" isNotModified
} applyRefactoring organizeCustomized(dependencies = Dependencies.RecomputeAndModify)
}