scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

2.12.7 regression wrt implicit conversions in super-class companion objects #11174

Closed japgolly closed 5 years ago

japgolly commented 5 years ago

scalajs-react doesn't compile with 2.12.7. (Nor do any downstream projects).

Here is Travis compiling with both 2.12.6 and 2.12.7: https://travis-ci.org/japgolly/scalajs-react/builds/434352061

The error seems to be that this implicit conversion here is no longer being considered.

Atry commented 5 years ago

Maybe a duplicate of #11068

joroKr21 commented 5 years ago

Maybe a duplicate of #11068

Unlikely, the bug fix that caused #11068 is not in 2.12

adriaanm commented 5 years ago

Looks like it actually is scala/scala#7067 this time:

With a locally-built scala (https://github.com/scala/scala/compare/v2.12.7...adriaanm:revert-7067?expand=1), sbt test:compile passes for: https://github.com/japgolly/scalajs-react/compare/master...adriaanm:revert-7067?expand=1

SethTisue commented 5 years ago

/cc @milessabin

milessabin commented 5 years ago

Ack ... I'm travelling but should be able to take a look over the weekend.

japgolly commented 5 years ago

Oh btw, take my title of this issue with a healthy serve of salt. It's a guess. The variance in the HKT also seems like something that could easily slip past the community build. Or maybe something else.

milessabin commented 5 years ago

I think I can see what's going on here ... stay tuned.

milessabin commented 5 years ago

PR here: https://github.com/scala/scala/pull/7295.

scalajs-react compiles locally for me with that applied.

SethTisue commented 5 years ago

@japgolly is this something you'll be able to work around in scalajs-react?

japgolly commented 5 years ago

Cool, nice turnaround @milessabin! It's a shame scalajs-react wasn't in the community build, I'd actually like to add a few libs of mine to it (cos I have a habit of using running up against Scala's edges) but I usually need Scala.JS support. Actually is it still the case that you can't use Scala.JS in the community build?

@SethTisue Unfortunately not. If it were just a problem for scalajs-react itself I would just hold off on upgrading to .7 and wait for .8 (which is fine). Sadly though, this issue affects all downstream users of scalajs-react in that their code will no longer compile if they upgrade to .7 which is much more dire.

SethTisue commented 5 years ago

Actually is it still the case that you can't use Scala.JS in the community build?

I'll look into it, maybe it's possible.

(We've historically been reluctant to expand the scope of the community build to include the Scala.js ecosystem, not primarily for technical reasons, but primarily because the community build already consumes a lot of engineering resources so we have to be skeptical of any further expansions of scope. But perhaps we could at least include a handful of things? I'll look into it.)

SethTisue commented 5 years ago

Let's move any further community build discussion to https://github.com/scala/community-builds/issues/798

adriaanm commented 5 years ago

Seems like you can work around this particular bug using a patch like:

--- i/core/src/main/scala/japgolly/scalajs/react/component/Generic.scala
+++ w/core/src/main/scala/japgolly/scalajs/react/component/Generic.scala
@@ -8,7 +8,7 @@ import scala.scalajs.js.|

 object Generic {

-  @inline implicit def toComponentCtor[P, CT[-p, +u] <: CtorType[p, u], U](c: ComponentSimple[P, CT, U]): CT[P, U] =
+  @inline implicit def toComponentCtor[P, CT[-p, +u] <: CtorType[p, u], U](c: ComponentSimple[P, CT, U]): c.CTPU =
     c.ctor

   trait ComponentRaw {
@@ -20,6 +20,7 @@ object Generic {
   trait ComponentSimple[P, CT[-p, +u] <: CtorType[p, u], U] extends ComponentRaw {
     final type Props = P
     final type Unmounted = U
+    type CTPU = CT[P, U]

     def cmapCtorProps[P2](f: P2 => P): ComponentSimple[P2, CT, U]
     def mapUnmounted[U2](f: U => U2): ComponentSimple[P, CT, U2]

That does lead to an impressive error message:

[info] Compiling 25 Scala sources to /Users/adriaan/git/scalajs-react/extra/target/scala-2.12/classes...
[error] /Users/adriaan/git/scalajs-react/extra/src/main/scala/japgolly/scalajs/react/extra/components/TriStateCheckbox.scala:46: japgolly.scalajs.react.component.Js.ComponentWithRoot[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props,[-p, +u]japgolly.scalajs.react.CtorType.Props[p,u],japgolly.scalajs.react.component.Js.UnmountedWithRoot[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props,japgolly.scalajs.react.component.Scala.MountedWithRoot[[A]A,japgolly.scalajs.react.extra.components.TriStateCheckbox.Props,Unit,Unit,japgolly.scalajs.react.extra.components.TriStateCheckbox.Props,Unit],japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.component.Js.MountedWithRoot[[A]A,japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit],japgolly.scalajs.react.raw.React.Component[japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit]] with japgolly.scalajs.react.component.Scala.Vars[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props,Unit,Unit],japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit]]],japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],[-p, +u]japgolly.scalajs.react.CtorType.Props[p,u],japgolly.scalajs.react.component.Js.UnmountedWithRoot[japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.component.Js.MountedWithRoot[[A]A,japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit],japgolly.scalajs.react.raw.React.Component[japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit]] with japgolly.scalajs.react.component.Scala.Vars[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props,Unit,Unit],japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit]],japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.component.Js.MountedWithRoot[[A]A,japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit],japgolly.scalajs.react.raw.React.Component[japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit]] with japgolly.scalajs.react.component.Scala.Vars[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props,Unit,Unit],japgolly.scalajs.react.internal.Box[japgolly.scalajs.react.extra.components.TriStateCheckbox.Props],japgolly.scalajs.react.internal.Box[Unit]]]] does not take parameters
[error]     def render = Component(this)
japgolly commented 5 years ago

So now that a fix has been merged and this is a showstopper for (at least (anyone else report this?)) scalajs-react users, is there a plan in the works to get a 2.12.8 release out earlier than is typical? Were there any other regressions in 2.12.7?

adriaanm commented 5 years ago

I'm not aware of any other regressions that would hasten a 2.12.8 release, so far.

Have you had a chance to look into completing the workaround? Maybe my suggestion could be improved so that it actually compiles.

japgolly commented 5 years ago

@adriaanm Oh... no I'm sorry I thought you were joking. When I saw that huge japgolly-gets-paid-by-char-per-type type error I quickly concluded that the workaround didn't end up working, but you're thinking maybe I can workaround the downstream failure too? I doubt it but I'll have a look and a try this weekend and see if there's a way. Will report back here.

adriaanm commented 5 years ago

I agree it was an amusing scalac fail :-)

Still, since we’re dealing with some rough edges in the compiler here, I think it would be prudent to see if there’s a refactoring or reformulation that would avoid relying too much on (the buggier parts of) the type checker. I worry about implicits with type constructor parameters. Maybe there’s some wisdom in the cats community on how to stay out of the scalac danger zone?

It could also be a good opportunity to make sure this code will be portable to dotty. On Sat, Oct 20, 2018 at 02:35 David Barri notifications@github.com wrote:

@adriaanm https://github.com/adriaanm Oh... no I'm sorry I thought you were joking. When I saw that huge someone-gets-paid-by-char-per-type type error I quickly concluded that the workaround didn't end up working, but you're thinking maybe I can workaround the downstream failure too? I doubt it but I'll have a look and a try this weekend and see if there's a way. Will report back here.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/scala/bug/issues/11174#issuecomment-431533704, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFjy4kzkA7EfY-VkJXR87KIp6s1wVasks5umm-9gaJpZM4W9l5M .

japgolly commented 5 years ago

Hello. Ok so I've played around with this and I'm not able to come up with a workaround.

Seeing as the regression has been fixed on master, would it be possible to get an early 2.12.8 release out? There are a number of options, maybe just 2.12.7 + this one fix, maybe some other goodies cherry-picked, maybe a normal release but just earlier than normal. I've no idea of Lightbend's resourcing but I can say that there are have been a consistent stream of people bumping in to this, asking about and reporting so it would be widely appreciated.

cquiroz commented 5 years ago

Yes, this is affecting several of us. A new release would be greatly appreciated

adriaanm commented 5 years ago

Thanks for taking the time to investigate. I'll see what we can do in terms of getting 2.12.8 out sooner -- would be late Nov / early Dec at earliest.

dsilvasc commented 5 years ago

Can the affected projects use the compiler commit with the fix per the instructions at https://stackoverflow.com/questions/40622878/how-do-i-tell-sbt-to-use-a-nightly-build-of-scala-2-12-or-2-13 ?

Has it been merged to the 2.12.x branch?

adriaanm commented 5 years ago

Yes, https://github.com/scala/scala/pull/7295 was merged. The latest green nightly is 2.12.8-bin-c4575fd (Via https://github.com/scala/scala/commits/2.12.x, click on the green checkmark to see the commit status, which lists the version that was published to https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/.)

SethTisue commented 5 years ago

@japgolly if you published scalajs-react using a Scala nightly, would that take care of the problem until 2.12.8 is released? (because that sounds pretty satisfactory to me) ...or would your downstream users also need to use the nightly? (which doesn't sound satisfactory at all)

japgolly commented 5 years ago

I'll see what we can do in terms of getting 2.12.8 out sooner -- would be late Nov / early Dec at earliest.

Thank you @adriaanm . I appreciate that for something as fundamental as the Scala compiler, it's a release train and not a release motorbike.

would your downstream users also need to use the nightly?

@SethTisue yeah unfortunately downstream users would need to be using a Scala nightly too. It's a two-part problem. Both Adriaan's workaround idea and the idea of using a Scala nightly bypass the first part of the problem but it's the second part at which we (and downstream) users are stuck without a workaround....unfortunately. (I'm realising lately that I use "unfortunately" a lot. It's unfortunate.)

SethTisue commented 5 years ago

@japgolly would you like us to add a Known Issues section with a short, scalajs-react-focused blurb about the regression to the 2.12.7 release notes? if you propose a text, I can insert it. it might spare a few exceptionally conscientious readers some trouble.

SethTisue commented 5 years ago

@japgolly 2.12.8-bin-25c7215 is our current 2.12.8 release candidate, can you check and make sure it's suitable for scala-js-react's purposes? (but note that #11271 is still up in the air, so we might have to ask you to test one more time; regardless, it would still be valuable for you to test 2.12.8-bin-25c7215 now)

SethTisue commented 5 years ago

tentatively reopening, hoping to hear from @japgolly

japgolly commented 5 years ago

Hey Seth, I just tried but wasn't able to compile due to Scala JS not being released at that version.

On Tue., 27 Nov. 2018, 12:56 pm Seth Tisue <notifications@github.com wrote:

tentatively reopening, hoping to hear from @japgolly https://github.com/japgolly

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scala/bug/issues/11174#issuecomment-441868699, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMYt0gzELwICjsux1im-KYb2ydmjWlFks5uzJvKgaJpZM4W9l5M .

adriaanm commented 5 years ago

Here’s how to override the scala.js version: https://github.com/adriaanm/scalajs-react/commit/2a20278628ff91f234db165f22c813f7ba793f68 On Tue, Nov 27, 2018 at 06:35 David Barri notifications@github.com wrote:

Hey Seth, I just tried but wasn't able to compile due to Scala JS not being released at that version.

On Tue., 27 Nov. 2018, 12:56 pm Seth Tisue <notifications@github.com wrote:

tentatively reopening, hoping to hear from @japgolly https://github.com/japgolly

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scala/bug/issues/11174#issuecomment-441868699, or mute the thread < https://github.com/notifications/unsubscribe-auth/AAMYt0gzELwICjsux1im-KYb2ydmjWlFks5uzJvKgaJpZM4W9l5M

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scala/bug/issues/11174#issuecomment-441925316, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFjy3LMNcZDWVbSr_01Ths-IzxQW5srks5uzM8YgaJpZM4W9l5M .

milessabin commented 5 years ago

@SethTisue why reopening?

SethTisue commented 5 years ago

@SethTisue why reopening?

hoping for final confirmation from @japgolly, before 2.12.8 release, that the problem is fixed not only for scalajs-react itself but also for downstream projects

He-Pin commented 5 years ago

Right,let's go with it slowly.

japgolly commented 5 years ago

Morning. I'm back in front of a computer, tried again with @adriaanm 's instructions but still no dice.

This is what I've done but I'm still getting this error.

[error] (root/*:coursierResolutions) coursier.ResolutionException: Encountered 1 error(s) in dependency resolution:
[error]     org.scala-js:scalajs-compiler_2.12.8:0.6.25:
[error]         not found:
[error]             /Users/d886476/.ivy2/local/org.scala-js/scalajs-compiler_2.12.8/0.6.25/ivys/ivy.xml
[error]             https://repo1.maven.org/maven2/org/scala-js/scalajs-compiler_2.12.8/0.6.25/scalajs-compiler_2.12.8-0.6.25.pom
[error]             https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/org/scala-js/scalajs-compiler_2.12.8/0.6.25/scalajs-compiler_2.12.8-0.6.25.pom
[error]             https://scala-ci.typesafe.com/artifactory/scala-integration/org/scala-js/scalajs-compiler_2.12.8/0.6.25/scalajs-compiler_2.12.8-0.6.25.pom
[error] (gh-pages-macros/*:coursierResolutions) coursier.ResolutionException: Encountered 3 error(s) in dependency resolution:
[error]     org.scala-lang:scala-compiler:2.12.8-bin-25c7215:
[error]         not found:
[error]             /Users/d886476/.ivy2/local/org.scala-lang/scala-compiler/2.12.8-bin-25c7215/ivys/ivy.xml
[error]             https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.8-bin-25c7215/scala-compiler-2.12.8-bin-25c7215.pom
[error]             https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/org/scala-lang/scala-compiler/2.12.8-bin-25c7215/scala-compiler-2.12.8-bin-25c7215.pom
[error]     org.scala-lang:scala-library:2.12.8-bin-25c7215:
[error]         not found:
[error]             /Users/d886476/.ivy2/local/org.scala-lang/scala-library/2.12.8-bin-25c7215/ivys/ivy.xml
[error]             https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.8-bin-25c7215/scala-library-2.12.8-bin-25c7215.pom
[error]             https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/org/scala-lang/scala-library/2.12.8-bin-25c7215/scala-library-2.12.8-bin-25c7215.pom
[error]     org.scala-lang:scala-reflect:2.12.8-bin-25c7215:
[error]         not found:
[error]             /Users/d886476/.ivy2/local/org.scala-lang/scala-reflect/2.12.8-bin-25c7215/ivys/ivy.xml
[error]             https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.12.8-bin-25c7215/scala-reflect-2.12.8-bin-25c7215.pom
[error]             https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/org/scala-lang/scala-reflect/2.12.8-bin-25c7215/scala-reflect-2.12.8-bin-25c7215.pom
[error] (core/*:coursierResolutions) coursier.ResolutionException: Encountered 3 error(s) in dependency resolution:
[error]     org.scala-lang:scala-library:2.12.8-bin-25c7215:
[error]         not found:
[error]             /Users/d886476/.ivy2/local/org.scala-lang/scala-library/2.12.8-bin-25c7215/ivys/ivy.xml
[error]             https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.8-bin-25c7215/scala-library-2.12.8-bin-25c7215.pom
[error]             https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/org/scala-lang/scala-library/2.12.8-bin-25c7215/scala-library-2.12.8-bin-25c7215.pom
[error]     org.scala-lang:scala-reflect:2.12.8-bin-25c7215:
[error]         not found:
[error]             /Users/d883476/.ivy2/local/org.scala-lang/scala-reflect/2.12.8-bin-25c7215/ivys/ivy.xml
[error]             https://repo1.maven.org/maven2/org/scala-lang/scala-reflect/2.12.8-bin-25c7215/scala-reflect-2.12.8-bin-25c7215.pom
[error]             https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/org/scala-lang/scala-reflect/2.12.8-bin-25c7215/scala-reflect-2.12.8-bin-25c7215.pom
[error]     org.scala-lang:scala-compiler:2.12.8-bin-25c7215:
[error]         not found:
[error]             /Users/d886476/.ivy2/local/org.scala-lang/scala-compiler/2.12.8-bin-25c7215/ivys/ivy.xml
[error]             https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.8-bin-25c7215/scala-compiler-2.12.8-bin-25c7215.pom
[error]             https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/org/scala-lang/scala-compiler/2.12.8-bin-25c7215/scala-compiler-2.12.8-bin-25c7215.pom
[error] Total time: 5 s, completed 28/11/2018 8:39:39 AM

Sorry for being a bit useless but I don't know how to workaround this. I'm not used to working with non-final Scala releases.

sjrd commented 5 years ago

Use

addCompilerPlugin("org.scala-js" % "scalajs-compiler_2.12.7" % "0.6.25")

instead of what @adriaanm suggested. (same for paradise)

japgolly commented 5 years ago

@sjrd Still didn't work; it's still looking for org.scala-js:scalajs-compiler_2.12.8-bin-25c7215:0.6.25.

All I'm doing is copy-pasting suggestions and trying sbt test. It would be much more efficient if someone who's used to working with Scala (& Scala JS) pre-releases would just do it directly on a fork. I don't quite know this area of SBT well enough and I'm happy to keep taking and trying suggestions but we're probably all gonna be here all day.

SethTisue commented 5 years ago

I'm working on it. (At least part of the problem is that https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots is the wrong resolver, that's for unmerged PRs and the Scala versions end in -SNAPSHOT.)

sjrd commented 5 years ago

OK I tried it locally. It turns out you need

resolvers in Global += "scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/"

with the in Global.

Using that + my earlier suggestion, I was able to get through resolution with sbt test. There is a crash in typer, though:

java.lang.AssertionError: assertion failed:
  (class SetUrlToPage,copy$default$1)
     while compiling: C:\Users\Sepi\Documents\Projets\scalajs-react\test\src\main\scala\japgolly\scalajs\react\test\Mock
RouterCtl.scala
        during phase: globalPhase=typer, enteringPhase=namer
     library version: version 2.12.8-bin-25c7215
    compiler version: version 2.12.8-bin-25c7215
  reconstructed args: -bootclasspath C:\Program Files\Java\jdk1.8.0_60\jre\lib\resources.jar;C:\Program Files\Java\jdk1.
8.0_60\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib
\jsse.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\charsets.jar;C:\Pr
ogram Files\Java\jdk1.8.0_60\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_60\jre\classes;C:\Users\Sepi\.ivy2\cache\org
.scala-lang\scala-library\jars\scala-library-2.12.8-bin-25c7215.jar -deprecation -opt:unreachable-code -opt:simplify-jum
ps -opt:compact-locals -opt:copy-propagation -opt:redundant-casts -opt:box-unbox -opt:nullness-tracking -opt:closure-inv
ocations -language:postfixOps -language:implicitConversions -language:higherKinds -language:existentials -feature -P:sca
lajs:sjsDefinedByDefault -Xplugin:C:\Users\Sepi\.ivy2\cache\org.scala-js\scalajs-compiler_2.12.7\jars\scalajs-compiler_2
.12.7-0.6.25.jar -Xplugin:C:\Users\Sepi\.ivy2\cache\org.scalamacros\paradise_2.12.7\jars\paradise_2.12.7-2.1.1.jar -unch
ecked -classpath C:\Users\Sepi\Documents\Projets\scalajs-react\test\target\scala-2.12\classes;C:\Users\Sepi\Documents\Pr
ojets\scalajs-react\core\target\scala-2.12\classes;C:\Users\Sepi\Documents\Projets\scalajs-react\extra\target\scala-2.12
\classes;C:\Users\Sepi\.ivy2\cache\org.scala-lang\scala-reflect\jars\scala-reflect-2.12.8-bin-25c7215.jar;C:\Users\Sepi\
.ivy2\cache\org.scala-js\scalajs-dom_sjs0.6_2.12\jars\scalajs-dom_sjs0.6_2.12-0.9.6.jar;C:\Users\Sepi\.ivy2\cache\com.li
haoyi\sourcecode_sjs0.6_2.12\bundles\sourcecode_sjs0.6_2.12-0.1.4.jar;C:\Users\Sepi\.ivy2\cache\org.scala-js\scalajs-lib
rary_2.12\jars\scalajs-library_2.12-0.6.24.jar

  last tree to typer: This(class SetUrlToPage)
       tree position: line 43 of C:\Users\Sepi\Documents\Projets\scalajs-react\test\src\main\scala\japgolly\scalajs\reac
t\test\MockRouterCtl.scala
            tree tpe: SetUrlToPage.this.type
              symbol: case class SetUrlToPage in object MockRouterCtl
   symbol definition: case class SetUrlToPage[+P] extends MockRouterCtl.Event[P] with Product with Serializable (a Class
Symbol)
      symbol package: japgolly.scalajs.react.test
       symbol owners: class SetUrlToPage -> object MockRouterCtl
           call site: method copy in class SetUrlToPage in package test

== Source file context for tree position ==

    40
    41   sealed trait Event[+P]
    42   case object Refresh                                  extends Event[Nothing]
    43   case class SetUrlToPage[+P](page: P, mockPath: Path) extends Event[P]
    44   case class SetUrlToPath    (path: Path)              extends Event[Nothing]
    45
    46   def apply[P](baseUrl   : BaseUrl   = defaultBaseUrl,
        at scala.reflect.internal.SymbolTable.throwAssertionError(SymbolTable.scala:183)
        at scala.tools.nsc.typechecker.Namers$Namer.$anonfun$addDefaultGetters$10(Namers.scala:1588)
        at scala.tools.nsc.typechecker.Namers$Namer$DefaultMethodInOwningScope.addGetter(Namers.scala:1664)
        at scala.tools.nsc.typechecker.Namers$Namer.$anonfun$addDefaultGetters$8(Namers.scala:1557)
        at scala.tools.nsc.typechecker.Namers$Namer.$anonfun$addDefaultGetters$6(Namers.scala:1528)
        at scala.tools.nsc.typechecker.Namers$Namer.addDefaultGetters(Namers.scala:1524)
        at scala.tools.nsc.typechecker.Namers$Namer.methodSig(Namers.scala:1411)
        at scala.tools.nsc.typechecker.Namers$Namer.memberSig(Namers.scala:1876)
        at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1842)
        at scala.tools.nsc.typechecker.Namers$Namer$MonoTypeCompleter.completeImpl(Namers.scala:853)
        at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete(Namers.scala:2039)
        at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete$(Namers.scala:2037)
        at scala.tools.nsc.typechecker.Namers$TypeCompleterBase.complete(Namers.scala:2032)
        at scala.tools.nsc.typechecker.Namers$PolyTypeCompleter.completeImpl(Namers.scala:2072)
        at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete(Namers.scala:2039)
        at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete$(Namers.scala:2037)
        at scala.tools.nsc.typechecker.Namers$PolyTypeCompleter.complete(Namers.scala:2051)
        at scala.tools.nsc.typechecker.Namers$CompleterWrapper.complete(Namers.scala:2088)
        at scala.tools.nsc.typechecker.Namers$Namer$$anon$1.complete(Namers.scala:616)
        at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1542)
        at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1690)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$6(Typers.scala:3325)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$6$adapted(Typers.scala:3323)
        at scala.Option$WithFilter.foreach(Option.scala:274)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$4(Typers.scala:3323)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$4$adapted(Typers.scala:3321)
        at scala.reflect.internal.Scopes$Scope.foreach(Scopes.scala:415)
        at scala.tools.nsc.typechecker.Typers$Typer.addSynthetics$1(Typers.scala:3321)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3383)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2030)
        at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1843)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5646)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5726)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:5790)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$10(Typers.scala:3373)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3373)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2030)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1896)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5647)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5726)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:5790)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$10(Typers.scala:3373)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3373)
        at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5356)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5649)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5726)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.apply(Analyzer.scala:114)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:448)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.run(Analyzer.scala:103)
        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1498)
        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1482)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1475)
        at scala.tools.nsc.Global$Run.compile(Global.scala:1598)
        at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
        at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
        at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:107)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:53)
        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:50)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
        at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:74)
        at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:49)
        at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:64)
        at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
        at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
        at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:32)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:72)
        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:71)
        at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:99)
        at sbt.inc.Incremental$.compile(Incremental.scala:71)
        at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
        at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
        at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
        at sbt.Compiler$.compile(Compiler.scala:155)
        at sbt.Compiler$.compile(Compiler.scala:141)
        at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:913)
        at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:904)
        at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:902)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
        at sbt.std.Transform$$anon$4.work(System.scala:63)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
        at sbt.Execute.work(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
[error] (test/compile:compileIncremental) java.lang.AssertionError: assertion failed:
[error]   (class SetUrlToPage,copy$default$1)
[error]      while compiling: C:\Users\Sepi\Documents\Projets\scalajs-react\test\src\main\scala\japgolly\scalajs\react\t
est\MockRouterCtl.scala
[error]         during phase: globalPhase=typer, enteringPhase=namer
[error]      library version: version 2.12.8-bin-25c7215
[error]     compiler version: version 2.12.8-bin-25c7215
[error]   reconstructed args: -bootclasspath C:\Program Files\Java\jdk1.8.0_60\jre\lib\resources.jar;C:\Program Files\Ja
va\jdk1.8.0_60\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_60
\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\charsets.j
ar;C:\Program Files\Java\jdk1.8.0_60\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_60\jre\classes;C:\Users\Sepi\.ivy2\c
ache\org.scala-lang\scala-library\jars\scala-library-2.12.8-bin-25c7215.jar -deprecation -opt:unreachable-code -opt:simp
lify-jumps -opt:compact-locals -opt:copy-propagation -opt:redundant-casts -opt:box-unbox -opt:nullness-tracking -opt:clo
sure-invocations -language:postfixOps -language:implicitConversions -language:higherKinds -language:existentials -featur
e -P:scalajs:sjsDefinedByDefault -Xplugin:C:\Users\Sepi\.ivy2\cache\org.scala-js\scalajs-compiler_2.12.7\jars\scalajs-co
mpiler_2.12.7-0.6.25.jar -Xplugin:C:\Users\Sepi\.ivy2\cache\org.scalamacros\paradise_2.12.7\jars\paradise_2.12.7-2.1.1.j
ar -unchecked -classpath C:\Users\Sepi\Documents\Projets\scalajs-react\test\target\scala-2.12\classes;C:\Users\Sepi\Docu
ments\Projets\scalajs-react\core\target\scala-2.12\classes;C:\Users\Sepi\Documents\Projets\scalajs-react\extra\target\sc
ala-2.12\classes;C:\Users\Sepi\.ivy2\cache\org.scala-lang\scala-reflect\jars\scala-reflect-2.12.8-bin-25c7215.jar;C:\Use
rs\Sepi\.ivy2\cache\org.scala-js\scalajs-dom_sjs0.6_2.12\jars\scalajs-dom_sjs0.6_2.12-0.9.6.jar;C:\Users\Sepi\.ivy2\cach
e\com.lihaoyi\sourcecode_sjs0.6_2.12\bundles\sourcecode_sjs0.6_2.12-0.1.4.jar;C:\Users\Sepi\.ivy2\cache\org.scala-js\sca
lajs-library_2.12\jars\scalajs-library_2.12-0.6.24.jar
[error]
[error]   last tree to typer: This(class SetUrlToPage)
[error]        tree position: line 43 of C:\Users\Sepi\Documents\Projets\scalajs-react\test\src\main\scala\japgolly\scal
ajs\react\test\MockRouterCtl.scala
[error]             tree tpe: SetUrlToPage.this.type
[error]               symbol: case class SetUrlToPage in object MockRouterCtl
[error]    symbol definition: case class SetUrlToPage[+P] extends MockRouterCtl.Event[P] with Product with Serializable
(a ClassSymbol)
[error]       symbol package: japgolly.scalajs.react.test
[error]        symbol owners: class SetUrlToPage -> object MockRouterCtl
[error]            call site: method copy in class SetUrlToPage in package test
[error]
[error] == Source file context for tree position ==
[error]
[error]     40
[error]     41   sealed trait Event[+P]
[error]     42   case object Refresh                                  extends Event[Nothing]
[error]     43   case class SetUrlToPage[+P](page: P, mockPath: Path) extends Event[P]
[error]     44   case class SetUrlToPath    (path: Path)              extends Event[Nothing]
[error]     45
[error]     46   def apply[P](baseUrl   : BaseUrl   = defaultBaseUrl,
[error] Total time: 49 s, completed 28-nov.-2018 0:33:47
[debug] > shell
japgolly commented 5 years ago

Thank you for trying that locally :)

That's a different error @sjrd and the first time I'm seeing that. It might be a new regression to 2.12.8?

japgolly commented 5 years ago

Some good news: this new error has occurred in the test module, meaning that if its the only reported error, this is confirmation that the original regression has been resolved. The regression caused errors at the test and gh-pages modules, both of which have no downstream modules.

SethTisue commented 5 years ago

I wonder if Scala.js and/or macro paradise need to be rebuilt in order to do a proper test. Perhaps this is a new regression, but perhaps it's just that we aren't truly rebuilding everything relevant using the new code.

@sjrd can you push your branch up?

sjrd commented 5 years ago

@SethTisue https://github.com/sjrd/scalajs-react/tree/tmp/scala-2.12.8

I wonder if Scala.js and/or macro paradise need to be rebuilt in order to do a proper test. Perhaps this is a new regression, but perhaps it's just that we aren't truly rebuilding everything relevant using the new code.

Unlikely for Scala.js; our compiler plugin does virtually nothing before typer. Our first phase kicks in right after pickler. (we do have a phase after parser, but it only adds some annotations in the code)

adriaanm commented 5 years ago

You likely need a new macro paradise (https://github.com/scalamacros/paradise/commit/ed5ddcb5369670f896ffb25624b10f07b36ad741). The branch is 2.12.8

adriaanm commented 5 years ago

The tests compile, on your branch with these patches and a locally published macro paradise. They fail to run, but that's probably because I don't have node on this machine?

[info] Fast optimizing /Users/adriaan/git/scalajs-react/test/target/scala-2.12/test-test-fastopt.js
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'jsdom'
diff --git c/build.sbt w/build.sbt
index 8e6c44d..0741a24 100644
--- c/build.sbt
+++ w/build.sbt
@@ -1,5 +1,5 @@
 lazy val sharedSettings = Seq(
-  scalaVersion  := "2.12.8",
+  scalaVersion  := "2.12.8-bin-25c7215-SNAPSHOT",
   scalaHome     := Option(System.getProperty("paradise.scala.home")).map(file(_)),
   scalacOptions ++= Seq("-deprecation", "-feature"),

@@ -11,6 +11,7 @@ lazy val sharedSettings = Seq(
   resolvers     += Resolver.sonatypeRepo("snapshots"),
   resolvers     += Resolver.sonatypeRepo("releases"),
   resolvers     += "Sonatype staging" at "https://oss.sonatype.org/content/repositories/staging/",
+  resolvers += "pr" at "https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/",

   parallelExecution in Test := false, // hello, reflection sync!!
   logBuffered               := false

patch to your branch:

diff --git c/project/Build.scala w/project/Build.scala
index 89acfdf..3c05962 100644
--- c/project/Build.scala
+++ w/project/Build.scala
@@ -12,14 +12,14 @@ object ScalajsReact {
   object Ver {
     val Cats          = "1.4.0"
     val KindProjector = "0.9.7"
-    val MacroParadise = "2.1.1"
+    val MacroParadise = "2.1.0-SNAPSHOT"
     val Monocle       = "1.5.0"
     val MonocleCats   = "1.5.1-cats"
     val MTest         = "0.6.5"
     val Nyaya         = "0.8.1"
     val ReactJs       = "16.5.1"
     val Scala211      = "2.11.12"
-    val Scala212      = "2.12.7"
+    val Scala212      = "2.12.8-bin-25c7215-SNAPSHOT"
     val ScalaJsDom    = "0.9.6"
     val Scalaz72      = "7.2.26"
     val SizzleJs      = "2.3.0"
@@ -47,7 +47,11 @@ object ScalajsReact {
         //scalacOptions    += "-Xlog-implicits",
         updateOptions      := updateOptions.value.withCachedResolution(true),
         incOptions         := incOptions.value.withNameHashing(true).withLogRecompileOnMacro(false),
-        triggeredMessage   := Watched.clearWhenTriggered)
+        triggeredMessage   := Watched.clearWhenTriggered,
+        libraryDependencies := libraryDependencies.value.filterNot(_.name == "scalajs-compiler"),
+        addCompilerPlugin("org.scala-js" % "scalajs-compiler_2.12.7" % "0.6.25"),
+        resolvers += "pr" at "https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/"
+      )

   def preventPublication: PE =
     _.settings(
@@ -171,7 +175,7 @@ object ScalajsReact {
         "org.scala-lang" % "scala-compiler" % scalaVersion.value % "provided"))

   def macroParadisePlugin =
-    compilerPlugin("org.scalamacros" % "paradise" % Ver.MacroParadise cross CrossVersion.full)
+    compilerPlugin("org.scalamacros" % "paradise_2.12.8-bin-25c7215-SNAPSHOT" % "2.1.0-SNAPSHOT")
japgolly commented 5 years ago

Thanks @adriaanm for those patches. I applied them both and everything worked! Compilation and test execution all ok. 🎉 🎉

japgolly commented 5 years ago

Now that this is resolved, I just wanted to say a quick thanks. Thanks for getting it resolved so fast, for getting a new release out earlier than usual, and for confirming scalajs-react is entirely ok before the release. Cheers all 🎉