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

post-2.13.1 regression: getClass not found in secondary constructor body #660

Closed
SethTisue opened this issue Dec 10, 2019 · 7 comments
Closed
Assignees

Comments

@SethTisue
Copy link
Member

SethTisue commented Dec 10, 2019

on Scala version 2.13.2-bin-161c2a7, in the 2.13 community build, at e.g. https://scala-ci.typesafe.com/job/scala-2.13.x-integrate-community-build/2860/consoleFull , akka-stream is failing with:

[akka-stream] [error] /home/jenkins/workspace/scala-2.13.x-integrate-community-build/target-0.9.16/project-builds/akka-stream-8a2efbf6a483843e2425edb83d04591231140e93/akka-stream-testkit/src/test/scala/akka/stream/testkit/StreamSpec.scala:19:45: not found: value getClass
[akka-stream] [error]     this(ActorSystem(AkkaSpec.getCallerName(getClass), ConfigFactory.load(config.withFallback(AkkaSpec.testConf))))
[akka-stream] [error]                                             ^
[akka-stream] [error] /home/jenkins/workspace/scala-2.13.x-integrate-community-build/target-0.9.16/project-builds/akka-stream-8a2efbf6a483843e2425edb83d04591231140e93/akka-stream-testkit/src/test/scala/akka/stream/testkit/StreamSpec.scala:25:56: not found: value getClass
[akka-stream] [error]   def this() = this(ActorSystem(AkkaSpec.getCallerName(getClass), AkkaSpec.testConf))
[akka-stream] [error]                                                        ^
[akka-stream] [error] two errors found

ordinarily I could easily git bisect my way to the culprit scala/scala commit, but in this case I can't because the regression seems to have occurred somewhere in a range of commits where akka-stream failed to compile for a different reason. that reason was fixed by @som-snytt in scala/scala#8577, uncovering this other regression

I made some halfhearted stabs at a standalone reproduction, but failed. for example:

Welcome to Scala 2.13.2-bin-161c2a7
scala> class C(x: Class[_]) { def this() = this(getClass) }
class C

actually I tried a little harder than that, and I could certainly try harder still, but before I dig any deeper, I want to ask:

Som, what might be going on here, does any insight jump out at you? could scala/scala#8547 and/or scala/scala#8541 somehow be related? getClass is of course a "universal member", so the presence of "universal member" in those PRs caught my attention

@SethTisue SethTisue self-assigned this Dec 10, 2019
@som-snytt
Copy link

I don't mind giving it a half-hearted sob, I mean stab.

@som-snytt
Copy link

som-snytt commented Dec 10, 2019

Not sure if standalone repro means akka/stream not compiling or minimization. stream just compiled for me with tip. Edit: akka-stream-testkit, naturally. (Edit again, sorry I meant naturally that was the failure.)

But let this be said: you will never stand alone.

@SethTisue
Copy link
Member Author

Oh, by "standalone" I meant minimization.

but also, the akka-stream failure is reproducible for me outside dbuild, on the master branch of the Akka repo (akka/akka@653d05e), with sbt -Dakka.build.scalaVersion=2.13.2-bin-161c2a7 akka-stream-testkit/Test/compile and

diff --git akka-testkit/src/test/scala/akka/testkit/WithLogCapturing.scala akka-testkit/src/test/scala/akka/testkit/WithLogCapturing.scala
index 6305061e36..456925951d 100644
--- akka-testkit/src/test/scala/akka/testkit/WithLogCapturing.scala
+++ akka-testkit/src/test/scala/akka/testkit/WithLogCapturing.scala
@@ -55,7 +55,7 @@ trait WithLogCapturing extends SuiteMixin { this: TestSuite =>
         override def write(b: Int): Unit = oldOut.write(b)
       }) {
         override def println(x: Any): Unit =
-          oldOut.println(prefix + String.valueOf(x).replaceAllLiterally("\n", s"\n$prefix"))
+          oldOut.println(prefix + String.valueOf(x).replace("\n", s"\n$prefix"))
       }

but in order to get this to work I had to publishLocal silencer for 2.13.2-bin-161c2a7

would it be helpful if I pushed a branch to my fork of the community-build repo that just has Akka-stream and its dependencies? I could easily do that (with that new narrow script I made)

@som-snytt
Copy link

som-snytt commented Dec 10, 2019

So I have akka-stream-testkit failing, taking a look.

Since it compiles without the lint flag, I'll probably just roll back that "quick fix". Inference should be able to tell us if it was constrained to infer Any, rather than guessing after the fact.

@joroKr21
Copy link
Member

These are not the classes you're looking for.

Before scala/scala#8541 you could always find a class.
"Classes everywhere". But it was good ol' Predef all along.

@som-snytt
Copy link

Thanks @joroKr21 and I see Seth already mentioned the PR. Maybe I'll have to de-revert the other PR, but only if I have a chance to test it first.

@SethTisue
Copy link
Member Author

ah, not actually a Scala regression! akka/akka#28355 👍

I will get that into the community build

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

No branches or pull requests

3 participants