Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in 2.12.0-M5: NoSuchMethodError during macro expansion #9920

Closed
scabug opened this issue Sep 11, 2016 · 4 comments
Closed

Regression in 2.12.0-M5: NoSuchMethodError during macro expansion #9920

scabug opened this issue Sep 11, 2016 · 4 comments

Comments

@scabug
Copy link

scabug commented Sep 11, 2016

Compiler can't find this lazy val:
https://github.com/kxbmap/configs/blob/e2fb1fedfadaac5b68bb9289bdeaf296cc08986b/core/src/main/scala/configs/macros/Construct.scala#L86

2.11.8 and 2.12.0-M4 compile successfully:
https://travis-ci.org/kxbmap/configs/builds/159102423

[error] C:\Users\kxbmap\src\github.com\kxbmap\configs\core\src\test\scala\configs\DeriveConfigsTest.scala:54: exception during macro expansion:
[error] java.lang.NoSuchMethodError: configs.macros.MacroBase.configs$macros$Construct$$defaults$1(Lscala/reflect/api/Symbols$ClassSymbolApi;Lscala/runtime/LazyRef;)Lscala/collection/immutable/Map;
[error]         at configs.macros.Construct$$anonfun$1.$anonfun$applyOrElse$1(Construct.scala:104)
[error]         at scala.collection.immutable.List.map(List.scala:272)
[error]         at configs.macros.Construct$$anonfun$1.applyOrElse(Construct.scala:103)
[error]         at configs.macros.Construct$$anonfun$1.applyOrElse(Construct.scala:100)
[error]         at scala.collection.TraversableOnce.collectFirst(TraversableOnce.scala:145)
[error]         at configs.macros.Construct.caseClass(Construct.scala:100)
[error]         at configs.macros.Construct.forClass$1(Construct.scala:33)
[error]         at configs.macros.Construct.construct(Construct.scala:37)
[error]         at configs.macros.ConfigsMacro.derive(ConfigsMacro.scala:28)
[error]   val caseClass1 = check[CC1]
[error]                         ^
@scabug
Copy link
Author

scabug commented Sep 11, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9920?orig=1
Reporter: Tsukasa Kitachi (kxbmap)
Affected Versions: 2.12.0-M5, 2.12.0-RC1

@scabug
Copy link
Author

scabug commented Sep 12, 2016

@retronym said:
A similar report from Akka. My working assumption is that the root cause is the same:

akka/akka#20306 (comment)

trait MyActor { def receive: PartialFunction[Any, Unit] }
abstract class AkkaSpec1(_system: Any)
trait ReproTrait { self: AkkaSpec1 
  def test = {
    case object Tick

    val actor = new MyActor {
      def receive: PartialFunction[Any, Unit] = {
        case Tick 
      }
    }
    actor.receive.apply(Tick)
  }
}

object Repro extends AkkaSpec1(null) with ReproTrait {
  def main(args: Array[String]): Unit = {
    test
  }
}

@scabug
Copy link
Author

scabug commented Sep 12, 2016

@retronym said:
Whittled down to:

class C
trait T { self: C =>
  def test = {
    object O

    class C {
      O
    }
    new C()
  }
}

object Test extends C with T {
  def main(args: Array[String]): Unit = {
    test
  }
}

@scabug
Copy link
Author

scabug commented Sep 16, 2016

@lrytz said:
scala/scala#5397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants