scala-ide / scala-refactoring

A library providing automated refactoring support for Scala.
http://scala-refactoring.org/
Other
69 stars 47 forks source link

Make codebase compatible with 2.12 #171

Closed kiritsuku closed 8 years ago

kiritsuku commented 8 years ago

work in progress - There are still a few remaining test failures:


============================================================================================================================
??? dependency problem
============================================================================================================================
[error] Test scala.tools.refactoring.tests.analysis.CompilationUnitDependenciesTest.importIsUsedAsTypeAscriptionNeeded failed: expected:<[]> but was:<[scala.Predef.ArrowAssoc]>

[error] Test scala.tools.refactoring.tests.analysis.CompilationUnitDependenciesTest.typeUsedInNewNeeded failed: expected:<scala.[]util.Random> but was:<scala.[Predef.intWrapper
[error] scala.]util.Random>

[error] Test scala.tools.refactoring.tests.analysis.CompilationUnitDependenciesTest.importedImplicitConversion failed: expected:<...ion.JavaConversions.[]bufferAsJavaList
[error] sca...> but was:<...ion.JavaConversions.[deprecated ]bufferAsJavaList
[error] sca...>

[error] Test scala.tools.refactoring.tests.analysis.CompilationUnitDependenciesTest.importedImplicitConversionNeedsImport failed: expected:<...ion.JavaConversions.[]bufferAsJavaList> but was:<...ion.JavaConversion
s.[deprecated ]bufferAsJavaList>

[error] Test scala.tools.refactoring.tests.analysis.CompilationUnitDependenciesTest.importedImplicitConversionNeedsImportShortForm failed: expected:<scala.[collection.JavaConversions.]asScalaBuffer> but was:<scala
.[Predef.augmentString
[error] scala.collection.JavaConversions.deprecated ]asScalaBuffer>

[error] Test scala.tools.refactoring.tests.analysis.CompilationUnitDependenciesTest.implicitDefImports failed: expected:<[]> but was:<[scala.Predef.byteArrayOps
[error] scala.reflect.`package`.materializeClassTag]>

[error] Test scala.tools.refactoring.tests.analysis.CompilationUnitDependenciesTest.testWithLocalTypeOnLazyVal failed: expected:<test.[DarkMagic
[error] test.]Magic> but was:<test.[]Magic>

============================================================================================================================
??? add import/organize import problem
============================================================================================================================
[error] Test scala.tools.refactoring.tests.implementations.ExtractTraitTest.withTypeParameters failed: expected:<...TypeParameters
[error]
[error]     []trait Empty[A]/*)*/ ...> but was:<...TypeParameters
[error]
[error]     [import scala.collection.immutable.Nil
[error]
[error]     ]trait Empty[A]/*)*/ ...>

============================================================================================================================
??? pretty printer problem
============================================================================================================================
[error] Test scala.tools.refactoring.tests.sourcegen.PrettyPrinterTest.patternMatchInAssignment failed: expected:<class Test {
[error]   val [List(one, three, eight) = List](1, 3, 8)
[error] }> but was:<class Test {
[error]   val [scala.collection.immutable.List(one, three, eight) = scala.collection.immutable.List.apply](1, 3, 8)
[error] }>

[error] Test scala.tools.refactoring.tests.sourcegen.PrettyPrinterTest.testStar failed: expected:<...st match {
[error]     case []Seq(car, _*) => car
[error] ...> but was:<...st match {
[error]     case [scala.collection.]Seq(car, _*) => car
[error] ...>

[error] Test scala.tools.refactoring.tests.sourcegen.PrettyPrinterTest.testMatches failed: expected:<...bject Functions {
[error]   [List(1, 2) match {
[error]     case i => i
[error]   }
[error]
[error]   List(1, 2).map {
[error]     case i if i > 5 => i
[error]   }
[error]
[error]   List(1, 2).map {
[error]     case i: Int => i
[error]   }
[error]
[error]   List(1, 2).map {
[error]     case a @ (i: Int) => i
[error]   }
[error]
[error]   List(1, 2).map {
[error]     case _ => 42
[error]   }
[error]
[error]   List(1, 2) match {
[error]     case (x, xs) => x
[error]   }
[error]
[error]   List](1, 2).map {
[error]     cas...> but was:<...bject Functions {
[error]   [scala.collection.immutable.List.apply(1, 2) match {
[error]     case i => i
[error]   }
[error]
[error]   scala.collection.immutable.List.apply(1, 2).map {
[error]     case i if i > 5 => i
[error]   }
[error]
[error]   scala.collection.immutable.List.apply(1, 2).map {
[error]     case i: Int => i
[error]   }
[error]
[error]   scala.collection.immutable.List.apply(1, 2).map {
[error]     case a @ (i: Int) => i
[error]   }
[error]
[error]   scala.collection.immutable.List.apply(1, 2).map {
[error]     case _ => 42
[error]   }
[error]
[error]   scala.collection.immutable.List.apply(1, 2) match {
[error]     case (x, xs) => x
[error]   }
[error]
[error]   scala.collection.immutable.List.apply](1, 2).map {
[error]     cas...>

[error] Test scala.tools.refactoring.tests.sourcegen.PrettyPrinterTest.testFunctions failed: expected:<...bject Functions {
[error]   [List(1, 2).map((i: Int) => i + 1)
[error]
[error]   val sum: Seq[Int] => Int = _.reduceLeft(_ + _)
[error]
[error]   List(1, 2).map(_ + 1)
[error]
[error]   List](1, 2).map(i => i + ...> but was:<...bject Functions {
[error]   [scala.collection.immutable.List.apply(1, 2).map((i: Int) => i + 1)
[error]
[error]   val sum: Seq[Int] => Int = _.reduceLeft(_ + _)
[error]
[error]   scala.collection.immutable.List.apply(1, 2).map(_ + 1)
[error]
[error]   scala.collection.immutable.List.apply](1, 2).map(i => i + ...>

[error] Test scala.tools.refactoring.tests.sourcegen.PrettyPrinterTest.testTypes failed: expected:<...t[Rename1.Person] = [List](Person.apply("Mirko...> but was:<...t[Rename1.Person] = [scala.collection.immutable.
List.apply](Person.apply("Mirko...>

[error] Test scala.tools.refactoring.tests.sourcegen.ReusingPrinterTest.add_override_final_flags_to_lazy_val failed: expected:<...T extends T {
[error]       [override final ]lazy val meth = 0
[error]   ...> but was:<...T extends T {
[error]       []lazy val meth = 0
[error]   ...>

Fixes #168

ghprb-bot commented 8 years ago

Test FAILed.

wpopielarski commented 8 years ago

Well, my advice is to ignore tests and release version for 2.12 as it is just to have a tool to debug it. Looks like there are some changes in trees processing by compiler (seems it is wiser that 2.11) so ExtractTrait.perform gives more Changes than in case of 2.11.

fommil commented 8 years ago

interesting, looks like we're getting back FQNs where we expect short names.

mlangc commented 8 years ago

I'm with @wpopielarski; also, we can then split the effort of fixing the tests into multiple PRs.

kiritsuku commented 8 years ago

Alright, we can do it this way. I can switch back to 2.11 in the sbt build but then we have the problem of having only half-baked 2.12 support. I don't know though if it makes it easier to get to full 2.12 support this way.

ghprb-bot commented 8 years ago

Test PASSed.

wpopielarski commented 8 years ago

LGTM