augustjune / context-applied

Compiler plugin for intuitive tagless final
MIT License
128 stars 8 forks source link

Fix problem with class shadowing on 2.13.2+ #5

Closed ybasket closed 4 years ago

ybasket commented 4 years ago

Starting from Scala 2.13.2, it is no longer allowed to define an inner class with the same name as an inner class in the super class of the outer: https://github.com/scala/bug/issues/8353

As context-applied generates such class names when you extend a class which has a context bound with the same name, it generates a warning, for example in https://github.com/profunktor/redis4cats/issues/244. This PR fixes that by appending the outer class' name to make it unique.

Includes as well:

To reproduce the problem itself, do the following:

  1. Fix kind-projector to "org.typelevel" % "kind-projector_2.13.1" % "0.11.0"
  2. Open a sbt session
  3. set ThisBuild/resolvers += "scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"
  4. ++2.13.2-bin-53ba87a!
  5. compile - fails on the new test in shadowed.scala
augustjune commented 4 years ago

That's an excellent PR, @ybasket! Thank you 👍