From 5bee0004ef202265621e2930db6d3c829f49ffd8 Mon Sep 17 00:00:00 2001 From: Cheng Lian Date: Wed, 13 Jan 2021 02:08:58 -0800 Subject: [PATCH] Renames and wildcard should not be separated --- input/src/main/scala/fix/GroupedImportsExplodeMixed.scala | 4 +--- output/src/main/scala/fix/GroupedImportsExplodeMixed.scala | 7 ++----- rules/src/main/scala/fix/OrganizeImports.scala | 7 +++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/input/src/main/scala/fix/GroupedImportsExplodeMixed.scala b/input/src/main/scala/fix/GroupedImportsExplodeMixed.scala index 262c963..df97af3 100644 --- a/input/src/main/scala/fix/GroupedImportsExplodeMixed.scala +++ b/input/src/main/scala/fix/GroupedImportsExplodeMixed.scala @@ -7,6 +7,4 @@ package fix import scala.collection.immutable._ import scala.collection.mutable.{Map, Seq => S, Buffer => _, _} -object GroupedImportsExplodeMixed { - val m: Map[Int, Int] = ??? -} +object GroupedImportsExplodeMixed diff --git a/output/src/main/scala/fix/GroupedImportsExplodeMixed.scala b/output/src/main/scala/fix/GroupedImportsExplodeMixed.scala index 866c8c2..67074e0 100644 --- a/output/src/main/scala/fix/GroupedImportsExplodeMixed.scala +++ b/output/src/main/scala/fix/GroupedImportsExplodeMixed.scala @@ -2,9 +2,6 @@ package fix import scala.collection.immutable._ import scala.collection.mutable.Map -import scala.collection.mutable.{Buffer => _, _} -import scala.collection.mutable.{Seq => S} +import scala.collection.mutable.{Buffer => _, Seq => S, _} -object GroupedImportsExplodeMixed { - val m: Map[Int, Int] = ??? -} +object GroupedImportsExplodeMixed diff --git a/rules/src/main/scala/fix/OrganizeImports.scala b/rules/src/main/scala/fix/OrganizeImports.scala index bd920f3..9be2e17 100644 --- a/rules/src/main/scala/fix/OrganizeImports.scala +++ b/rules/src/main/scala/fix/OrganizeImports.scala @@ -720,17 +720,16 @@ object OrganizeImports { importer :: Nil case Importer(ref, Importees(names, renames, unimports, Some(wildcard))) => - // When a wildcard exists, all unimports (if any) and the wildcard must appear in the same + // When a wildcard exists, all renames, unimports, and the wildcard must appear in the same // importer, e.g.: // // import p.{A => _, B => _, C => D, E, _} // // should be rewritten into // - // import p.{A => _, B => _, _} - // import p.{C => D} + // import p.{A => _, B => _, C => D, _} // import p.E - val importeesList = (names ++ renames).map(_ :: Nil) :+ (unimports :+ wildcard) + val importeesList = names.map(_ :: Nil) :+ (renames ++ unimports :+ wildcard) importeesList filter (_.nonEmpty) map (Importer(ref, _)) case importer =>