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.13.0-M3: compiler crash with mismatched type params and args in Scalacheck clients #10762

Closed
retronym opened this Issue Mar 8, 2018 · 19 comments

Comments

Projects
None yet
6 participants
@retronym
Copy link
Member

retronym commented Mar 8, 2018

@retronym retronym added this to the 2.13.0-M4 milestone Mar 8, 2018

@retronym retronym self-assigned this Mar 8, 2018

@2m

This comment has been minimized.

Copy link
Member

2m commented Mar 8, 2018

To reproduce in the akka codebase:

  1. Checkout https://github.com/akka/akka/tree/wip-scala-2.13-2m
  2. Run sbt
  3. Switch to Scala milestone: ++2.13.0-M3!
  4. Compilation of akka-persistence tests should complete successfully by running akka-persistence/Test/compile
  5. Uncomment IndependentlyOrdered in akka-persistence/src/test/scala/akka/persistence/PersistenceSpec.scala
  6. Run akka-persistence/Test/compile again to get the crash.

@SethTisue SethTisue modified the milestones: 2.13.0-M4, 2.13.0-M5 May 14, 2018

@holograph holograph referenced this issue Jun 11, 2018

Open

Scala 2.13.0-M3 support #126

0 of 2 tasks complete
@holograph

This comment has been minimized.

Copy link

holograph commented Jun 11, 2018

Alas, this is also an issue with Accord (see wix/accord#126). I'll post if I can find a workaround; in the meantime, to reproduce:

  1. Build resetallattrs:
     git clone git@github.com:holograph/resetallattrs.git
     cd resetallattrs && sbt ++2.13.0-M3 publishLocal
    
  2. Build Accord:
    git checkout git@github.com:holograph/accord.git
    cd accord
    git checkout scala-2.13.0-m3
    sbt ++2.13.0-M3 test
    

Sample output:

[error] scala.reflect.internal.FatalError:
[error]   Something is wrong: cannot find S in applied type org.scalatest.matchers.Matcher[T]
[error]    sought  S in Matcher
[error]  classSym  Matcher in matchers
[error]   tparams  T in Matcher
[error]
[error]      while compiling: /Users/tomer.gabel/dev/accord/scalatest/src/main/scala/com/wix/accord/scalatest/CombinatorTestSpec.scala
[error]         during phase: xsbt-api
[error]      library version: version 2.13.0-M3
[error]     compiler version: version 2.13.0-M3
[error]   reconstructed args: -deprecation -language:reflectiveCalls -feature -Xfatal-warnings -classpath /Users/tomer.gabel/dev/accord/scalatest/.jvm/target/scala-2.13.0-M3/classes:/Users/tomer.gabel/dev/accord/api/.jvm/target/scala-2.13.0-M3/classes:/Users/tomer.gabel/.ivy2/cache/org.scalatest/scalatest_2.13.0-M3/bundles/scalatest_2.13.0-M3-3.0.5-M1.jar:/Users/tomer.gabel/.ivy2/cache/org.scalactic/scalactic_2.13.0-M3/bundles/scalactic_2.13.0-M3-3.0.5-M1.jar:/Users/tomer.gabel/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.13.0-M3.jar:/Users/tomer.gabel/.ivy2/cache/org.scala-lang.modules/scala-xml_2.13.0-M3/bundles/scala-xml_2.13.0-M3-1.0.6.jar:/Users/tomer.gabel/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.13.0-M3.jar:/Users/tomer.gabel/.ivy2/cache/jline/jline/jars/jline-2.14.5.jar -unchecked -bootclasspath /Users/tomer.gabel/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.13.0-M3.jar
[error]
[error]   last tree to typer: Ident(x)
[error]        tree position: line 356 of /Users/tomer.gabel/dev/accord/scalatest/src/main/scala/com/wix/accord/scalatest/ResultMatchers.scala
[error]             tree tpe: (Boolean, Iterable[com.wix.accord.Violation] with Int with com.wix.accord.Violation => Boolean{def seq: Iterable[com.wix.accord.Violation] with Int with com.wix.accord.Violation => Boolean})
[error]               symbol: value x
[error]    symbol definition: x: (Boolean, Iterable[com.wix.accord.Violation] with Int with com.wix.accord.Violation => Boolean{def seq: Iterable[com.wix.accord.Violation] with Int with com.wix.accord.Violation => Boolean}) (a TermSymbol)
[error]       symbol package: <none>
[error]        symbol owners: value x
[error]            call site: trait ResultMatchers in package scalatest in package scalatest
[error]
[error] == Source file context for tree position ==
[error]
[error]    353   /** Enables syntax like `someResult should be( aSuccess )` */
[error]    354   val aSuccess = new BeMatcher[ Result ] {
[error]    355     def apply( left: Result ): MatchResult = {
[error]    356       val ( success, violations ) = left match {
[error]    357         case Success => ( true, Seq.empty )
[error]    358         case f: Failure => ( false, f.violations )
[error]    359       }
[error] 	at scala.reflect.internal.Reporting.abort(Reporting.scala:61)
[error] 	at scala.reflect.internal.Reporting.abort$(Reporting.scala:57)
[error] 	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:16)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.correspondingTypeArgument(TypeMaps.scala:477)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.loop$3(TypeMaps.scala:513)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.classParameterAsSeen(TypeMaps.scala:518)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:393)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:364)
[error] 	at scala.reflect.internal.Types$TypeRef.mapOver(Types.scala:2178)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:394)
[error] 	at scala.reflect.internal.Types$PolyType.mapOver(Types.scala:2741)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:394)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:364)
[error] 	at scala.reflect.internal.Types$TypeRef.mapOver(Types.scala:2178)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:394)
[error] 	at scala.reflect.internal.Types$MethodType.mapOver(Types.scala:2638)
[error] 	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:394)
[error] 	at scala.reflect.internal.Types$Type.asSeenFrom(Types.scala:692)
[error] 	at scala.reflect.internal.Types$Type.memberInfo(Types.scala:712)
[error] 	at xsbt.ExtractAPI.defDef(ExtractAPI.scala:309)
[error] 	at xsbt.ExtractAPI.definition(ExtractAPI.scala:440)
[error] 	at xsbt.ExtractAPI.$anonfun$processDefinitions$1(ExtractAPI.scala:422)
[error] 	at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:237)
[error] 	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
[error] 	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
[error] 	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:188)
[error] 	at scala.collection.TraversableLike.flatMap(TraversableLike.scala:237)
[error] 	at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:234)
[error] 	at scala.collection.mutable.ArrayOps$ofRef.flatMap(ArrayOps.scala:188)
[error] 	at xsbt.ExtractAPI.processDefinitions(ExtractAPI.scala:422)
[error] 	at xsbt.ExtractAPI.$anonfun$mkStructure$2(ExtractAPI.scala:418)
[error] 	at xsbt.Message$$anon$1.get(Message.scala:14)
[error] 	at xsbti.api.SafeLazy$Impl.get(SafeLazy.java:58)
[error] 	at xsbt.ExtractAPI.$anonfun$forceStructures$1(ExtractAPI.scala:170)
[error] 	at scala.collection.immutable.List.foreach(List.scala:389)
[error] 	at xsbt.ExtractAPI.forceStructures(ExtractAPI.scala:170)
[error] 	at xsbt.ExtractAPI.allExtractedNonLocalClasses(ExtractAPI.scala:639)
[error] 	at xsbt.API$TopLevelHandler.allNonLocalClasses(API.scala:68)
[error] 	at xsbt.API$ApiPhase.processScalaUnit(API.scala:48)
[error] 	at xsbt.API$ApiPhase.processUnit(API.scala:35)
[error] 	at xsbt.API$ApiPhase.apply(API.scala:33)
[error] 	at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:436)
[error] 	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:429)
[error] 	at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1(Global.scala:400)
[error] 	at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1$adapted(Global.scala:400)
[error] 	at scala.collection.Iterator.foreach(Iterator.scala:938)
[error] 	at scala.collection.Iterator.foreach$(Iterator.scala:938)
[error] 	at scala.collection.AbstractIterator.foreach(Iterator.scala:1426)
[error] 	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:400)
[error] 	at xsbt.API$ApiPhase.run(API.scala:27)
[error] 	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1453)
[error] 	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1437)
[error] 	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1429)
[error] 	at scala.tools.nsc.Global$Run.compile(Global.scala:1546)
[error] 	at xsbt.CachedCompiler0.run(CompilerInterface.scala:130)
[error] 	at xsbt.CachedCompiler0.run(CompilerInterface.scala:105)
[error] 	at xsbt.CompilerInterface.run(CompilerInterface.scala:31)
[error] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] 	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[error] 	at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
[error] 	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
[error] 	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:83)
[error] 	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:134)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:74)
[error] 	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:117)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:305)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:305)
[error] 	at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:101)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:82)
[error] 	at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:110)
[error] 	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:57)
[error] 	at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:84)
[error] 	at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:129)
[error] 	at sbt.internal.inc.Incremental$.compile(Incremental.scala:75)
[error] 	at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:61)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:309)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:267)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)
[error] 	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)
[error] 	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1443)
[error] 	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1417)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] 	at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:263)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.Execute.work(Execute.scala:272)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:263)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
[error] 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] 	at java.base/java.lang.Thread.run(Thread.java:844)
@retronym

This comment has been minimized.

Copy link
Member

retronym commented Jun 11, 2018

@holograph Thanks for the repro. Unfortunatlely I get stuck here:

/code/resetallattrs on master*
$ sbt ++2.13.0-M3 publishLocal
[info] Loading settings from dirtymoney.sbt,gpg.sbt,idea.sbt ...
[info] Loading global plugins from /Users/jz/.sbt/1.0/plugins
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /Users/jz/code/resetallattrs/project
[info] Loading settings from build.sbt ...
[info] Set current project to default-df0679 (in build file:/Users/jz/code/resetallattrs/)
[info] Set current project to root (in build file:/Users/jz/code/resetallattrs/)
[info] Setting Scala version to 2.13.0-M3 on 3 projects.
[info] Excluded 1 projects, run ++ 2.13.0-M3 -v for more details.
[info] Reapplying settings...
[info] Set current project to root (in build file:/Users/jz/code/resetallattrs/)
[info] Packaging /Users/jz/code/resetallattrs/resetallattrs/target/scala-2.13.0-M3/resetallattrs_2.13.0-M3-1.0.0-SNAPSHOT-sources.jar ...
[info] :: delivering :: org.scalamacros#root_2.13.0-M3;1.0.0-SNAPSHOT :: 1.0.0-SNAPSHOT :: integration :: Tue Jun 12 09:54:14 AEST 2018
[info] Done packaging.
[info] Main Scala API documentation to /Users/jz/code/resetallattrs/resetallattrs/target/scala-2.13.0-M3/api...
[info] Wrote /Users/jz/code/resetallattrs/resetallattrs/target/scala-2.13.0-M3/resetallattrs_2.13.0-M3-1.0.0-SNAPSHOT.pom
[info] :: delivering :: org.scalamacros#tests_2.13.0-M3;1.0.0-SNAPSHOT :: 1.0.0-SNAPSHOT :: integration :: Tue Jun 12 09:54:14 AEST 2018
[info] Packaging /Users/jz/code/resetallattrs/resetallattrs/target/scala-2.13.0-M3/resetallattrs_2.13.0-M3-1.0.0-SNAPSHOT.jar ...
[info] Done packaging.
model contains 11 documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /Users/jz/code/resetallattrs/resetallattrs/target/scala-2.13.0-M3/resetallattrs_2.13.0-M3-1.0.0-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] :: delivering :: org.scalamacros#resetallattrs_2.13.0-M3;1.0.0-SNAPSHOT :: 1.0.0-SNAPSHOT :: integration :: Tue Jun 12 09:54:18 AEST 2018
[info] 	delivering ivy file to /Users/jz/code/resetallattrs/resetallattrs/target/scala-2.13.0-M3/ivy-1.0.0-SNAPSHOT.xml
[info] 	published resetallattrs_2.13.0-M3 to /Users/jz/.ivy2/local/org.scalamacros/resetallattrs_2.13.0-M3/1.0.0-SNAPSHOT/poms/resetallattrs_2.13.0-M3.pom
[info] 	published resetallattrs_2.13.0-M3 to /Users/jz/.ivy2/local/org.scalamacros/resetallattrs_2.13.0-M3/1.0.0-SNAPSHOT/jars/resetallattrs_2.13.0-M3.jar
[info] 	published resetallattrs_2.13.0-M3 to /Users/jz/.ivy2/local/org.scalamacros/resetallattrs_2.13.0-M3/1.0.0-SNAPSHOT/srcs/resetallattrs_2.13.0-M3-sources.jar
[info] 	published resetallattrs_2.13.0-M3 to /Users/jz/.ivy2/local/org.scalamacros/resetallattrs_2.13.0-M3/1.0.0-SNAPSHOT/docs/resetallattrs_2.13.0-M3-javadoc.jar
[info] 	published ivy to /Users/jz/.ivy2/local/org.scalamacros/resetallattrs_2.13.0-M3/1.0.0-SNAPSHOT/ivys/ivy.xml
[error] java.lang.IllegalStateException: Ivy file not found in cache for org.scalamacros#tests_2.13.0-M3;1.0.0-SNAPSHOT!
[error] 	at sbt.internal.librarymanagement.ResolutionCache.getResolvedModuleDescriptor(ResolutionCache.scala:66)
[error] 	at org.apache.ivy.core.deliver.DeliverEngine.deliver(DeliverEngine.java:111)
[error] 	at org.apache.ivy.Ivy.deliver(Ivy.java:601)
[error] 	at sbt.internal.librarymanagement.IvyActions$.$anonfun$deliver$2(IvyActions.scala:100)
[error] 	at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:243)
[error] 	at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)

I tried deleting /Users/jz/.ivy2/cache/org.scalamacros/, but the problem persisted.

Any ideas how I can get around that?

@holograph

This comment has been minimized.

Copy link

holograph commented Jun 12, 2018

Oh yeah, that’s a quirk of the build that I haven’t yet started looking into. Try sbt package publishLocal instead, I think that worked for me.

@retronym

This comment has been minimized.

Copy link
Member

retronym commented Jul 12, 2018

This suggests that the root problem is in compiling Scalatest itself:

$ scala-launch 2.13.0-M3 -classpath ~/.ivy2/cache/org.scalatest/scalatest_2.13.0-M3/bundles/scalatest_2.13.0-M3-3.0.5-M1.jar
Welcome to Scala 2.13.0-M3 (GraalVM 1.0.0-rc1, Java 1.8.0_161).
Type in expressions for evaluation. Or try :help.

scala> :power
Power mode enabled. :phase is at typer.
import scala.tools.nsc._, intp.global._, definitions._
Try :help or completions for vals._ and power._

scala> typeOf[org.scalatest.matchers.Matcher[_]].decl(TypeName("AndNotWord"))
res1: $r.intp.global.Symbol = class AndNotWord

scala> val AndNotWordClass = typeOf[org.scalatest.matchers.Matcher[_]].decl(TypeName("AndNotWord"))
AndNotWordClass: $r.intp.global.Symbol = class AndNotWord

scala> val be = AndNotWordClass.info.decl(TermName("be")).alternatives.map(definitions.fullyInitializeSymbol).filter(_.defString == "def be(sortedWord: org.scalatest.words.SortedWord): org.scalatest.matchers.MatcherFactory1[T with Any,[-S]org.scalatest.enablers.Sortable[S]]").head
be: $r.intp.global.Symbol = method be

scala> be.info
res2: $r.intp.global.Type = (sortedWord: org.scalatest.words.SortedWord)org.scalatest.matchers.MatcherFactory1[T with Any,[-S]org.scalatest.enablers.Sortable[S]]

scala> AndNotWordClass.defString
res6: String = final class AndNotWord extends AnyRef

scala> AndNotWordClass.owner
res7: $r.intp.global.Symbol = trait Matcher

scala> AndNotWordClass.owner.defString
res8: String = abstract trait Matcher[-T] extends T => org.scalatest.matchers.MatchResult

scala> be.info.asSeenFrom(AndNotWordClass.typeOfThis, AndNotWordClass)
ReplGlobal.abort: Something is wrong: cannot find S in applied type org.scalatest.matchers.Matcher[T]
   sought  S in Matcher
 classSym  Matcher in matchers
  tparams  T in Matcher

error:
  Something is wrong: cannot find S in applied type org.scalatest.matchers.Matcher[T]
   sought  S in Matcher
 classSym  Matcher in matchers
  tparams  T in Matcher

     while compiling: <synthetic>
        during phase: globalPhase=terminal, enteringPhase=typer
     library version: version 2.13.0-M3
    compiler version: version 2.13.0-M3
  reconstructed args: -deprecation -usejavacp -feature -classpath /Users/jz/.ivy2/cache/org.scalatest/scalatest_2.13.0-M3/bundles/scalatest_2.13.0-M3-3.0.5-M1.jar

  last tree to typer: TypeTree(class Byte)
       tree position: line 6 of <synthetic>
            tree tpe: Byte
              symbol: (final abstract) class Byte in package scala
   symbol definition: final abstract class Byte extends AnyVal (a ClassSymbol)
      symbol package: scala
       symbol owners: class Byte
           call site: constructor $eval in object $eval in package $line47

<Cannot read source file>
scala.reflect.internal.FatalError:
  Something is wrong: cannot find S in applied type org.scalatest.matchers.Matcher[T]
   sought  S in Matcher
 classSym  Matcher in matchers
  tparams  T in Matcher

     while compiling: <synthetic>
        during phase: globalPhase=terminal, enteringPhase=typer
     library version: version 2.13.0-M3
    compiler version: version 2.13.0-M3
  reconstructed args: -deprecation -usejavacp -feature -classpath /Users/jz/.ivy2/cache/org.scalatest/scalatest_2.13.0-M3/bundles/scalatest_2.13.0-M3-3.0.5-M1.jar

  last tree to typer: TypeTree(class Byte)
       tree position: line 6 of <synthetic>
            tree tpe: Byte
              symbol: (final abstract) class Byte in package scala
   symbol definition: final abstract class Byte extends AnyVal (a ClassSymbol)
      symbol package: scala
       symbol owners: class Byte
           call site: constructor $eval in object $eval in package $line47

<Cannot read source file>
  at scala.reflect.internal.Reporting.abort(Reporting.scala:61)
  at scala.reflect.internal.Reporting.abort$(Reporting.scala:57)

That method is defined in Scalacheck as:

    /**
     * This method enables the following syntax:
     *
     * <pre class="stHighlight">
     * aMatcher and not be sorted
     *                  ^
     * </pre>
     **/
    def be(sortedWord: SortedWord) = 
      outerInstance.and(MatcherWords.not.be(sortedWord))

The higher kinded type param S within org.scalatest.matchers.MatcherFactory1[T with Any,[-S]org.scalatest.enablers.Sortable[S]] is incorrectly (I think) owned by Matcher.

scala> val S = (be.info.collect { case x: PolyType => x.typeParams }).flatten.distinct.head
S: $r.intp.global.Symbol = type S

scala> S.owner
res19: $r.intp.global.Symbol = trait Matcher

scala> S.owner.tpeHK.typeParams
res20: List[$r.intp.global.Symbol] = List(type T)

Now, why is that?

@retronym

This comment has been minimized.

Copy link
Member

retronym commented Jul 12, 2018

In Scala 2.12, be has the type.


scala> val be = AndNotWordClass.info.decl(TermName("be")).alternatives.map(definitions.fullyInitializeSymbol).filter(_.defString.contains("sortedWord")).head
be: $r.intp.global.Symbol = method be

scala> be.info
res0: $r.intp.global.Type = (sortedWord: org.scalatest.words.SortedWord)org.scalatest.matchers.MatcherFactory1[T with Any,org.scalatest.enablers.Sortable]```
@retronym

This comment has been minimized.

Copy link
Member

retronym commented Jul 12, 2018

Minimized:

$ cat /tmp/test.scala && for v in M2 M3; do scalac-launch 2.13.0-$v -d /tmp /tmp/test.scala -Xprint:typer 2>&1 | grep 'def be'; done


trait Matcher[-T] {
  def and[U, TC1[_]](other: MatcherFactory1X[U, TC1]): MatcherFactory1X[T with U, TC1]
	def be = {
	  val temp: MatcherFactory1X[Any,SortableX] = null
	  and(temp)
	}
}

trait SortableX[-A]
trait MatcherFactory1X[-SC, TC1[_]]

    def be: MatcherFactory1X[T with Any,SortableX] = {
    def be: MatcherFactory1X[T with Any,[-A]SortableX[A]] = {
@retronym

This comment has been minimized.

Copy link
Member

retronym commented Jul 12, 2018

$ scalac-ref 33478bdc97 -d /tmp -Xsource:2.13 /tmp/test.scala -Xprint:typer 2>&1 | grep 'def be'
    def be: MatcherFactory1X[T with Any,[-A]SortableX[A]] = {
/code/scalatest on 3.1.x*
$ scalac-ref 33478bdc97~1 -d /tmp -Xsource:2.13 /tmp/test.scala -Xprint:typer 2>&1 | grep 'def be'
    def be: MatcherFactory1X[T with Any,SortableX] = {

scala/scala#6069

@retronym

This comment has been minimized.

Copy link
Member

retronym commented Jul 12, 2018

Here's a variation that also crashes 2.12, albeit, I think, for a different reason.

trait Matcher[-T]{
  def and[U, TC1[_]](other: MatcherFactory1X[U, TC1]): MatcherFactory1X[T with U, TC1]
	def be = {
	  val temp: MatcherFactory1X[Any,SortableX] = null
	  and(temp)
	}
  val temp = (null: (this.type with SortableX[Any])).be
}
trait SortableX[-A]
trait MatcherFactory1X[-SC, TC1[_]]
@retronym

This comment has been minimized.

Copy link
Member

retronym commented Jul 12, 2018

Test and a WIP fix: https://github.com/retronym/scala/tree/ticket/10762

@adriaanm WDYT about the right way to fix this?

@adriaanm

This comment has been minimized.

Copy link
Member

adriaanm commented Jul 13, 2018

The variation can be further minimized (moved to its own ticket at #11020):

trait Matcher[T] { def t: T = ???
  (??? : (this.type with Any)).t
}

adriaanm added a commit to adriaanm/scala that referenced this issue Jul 13, 2018

Eta-expanded tycon's type params need own owner
Since scala#6069, it is possible to have type variables compared to the eta
expansion of a class type, which is `[CLASSTPARAM] => Class[CLASSTPARAM]`.

After separate compilation, the owner of this type constructor param
is adjusted to the root class (see the comments and special cases in
Pickler.localizedOwner), which makes it show up to certain subsequent
as-seen-from maps as a type parameter of an enclosing class. SBT's
ExtractAPI phase runs into this problem.

Eta expansion of the tycon type ref uses an owner (NoSymbol) that
will not become a class after pickling.

Fixes scala/bug#10762

adriaanm added a commit to adriaanm/scala that referenced this issue Jul 13, 2018

Eta-expanded tycon's type params need own owner
Since scala#6069, it is possible to have type variables compared to the eta
expansion of a class type, which is `[CLASSTPARAM] => Class[CLASSTPARAM]`.

After separate compilation, the owner of this type constructor param
is adjusted to the root class (see the comments and special cases in
Pickler.localizedOwner), which makes it show up to certain subsequent
as-seen-from maps as a type parameter of an enclosing class. SBT's
ExtractAPI phase runs into this problem.

Eta expansion of the tycon type ref uses an owner (NoSymbol) that
will not become a class after pickling.

Fixes scala/bug#10762

adriaanm added a commit to adriaanm/scala that referenced this issue Jul 13, 2018

Eta-expanded tycon's type params need own owner
Since scala#6069, it is possible to have type variables compared to the eta
expansion of a class type, which is `[CLASSTPARAM] => Class[CLASSTPARAM]`.

After separate compilation, the owner of this type constructor param
is adjusted to the root class (see the comments and special cases in
Pickler.localizedOwner), which makes it show up to certain subsequent
as-seen-from maps as a type parameter of an enclosing class. SBT's
ExtractAPI phase runs into this problem.

Eta expansion of the tycon type ref uses an owner (NoSymbol) that
will not become a class after pickling.

Fixes scala/bug#10762

adriaanm added a commit to adriaanm/scala that referenced this issue Jul 13, 2018

Eta-expanded tycon's type params need own owner
Since scala#6069, it is possible to have type variables compared to the eta
expansion of a class type, which is `[CLASSTPARAM] => Class[CLASSTPARAM]`.

After separate compilation, the owner of this type constructor param
is adjusted to the root class (see the comments and special cases in
Pickler.localizedOwner), which makes it show up to certain subsequent
as-seen-from maps as a type parameter of an enclosing class. SBT's
ExtractAPI phase runs into this problem.

Eta expansion of the tycon type ref uses an owner (NoSymbol) that
will not become a class after pickling.

Fixes scala/bug#10762

@adriaanm adriaanm added the has PR label Aug 8, 2018

adriaanm added a commit to adriaanm/scala that referenced this issue Aug 8, 2018

Eta-expanded tycon's type params need own owner
Since scala#6069, it is possible to have type variables compared to the eta
expansion of a class type, which is `[CLASSTPARAM] => Class[CLASSTPARAM]`.

After separate compilation, the owner of this type constructor param
is adjusted to the root class (see the comments and special cases in
Pickler.localizedOwner), which makes it show up to certain subsequent
as-seen-from maps as a type parameter of an enclosing class. SBT's
ExtractAPI phase runs into this problem.

Eta expansion of the tycon type ref uses an owner (NoSymbol) that
will not become a class after pickling.

Fixes scala/bug#10762
@adriaanm

This comment has been minimized.

Copy link
Member

adriaanm commented Aug 23, 2018

This should be fixed by scala/scala#7119.

To give the fix a try in your project:

resolvers += "pr" at "https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/"
scalaVersion := "2.13.0-pre-6c20b59-SNAPSHOT"

let me know how it goes!

@2m

This comment has been minimized.

Copy link
Member

2m commented Aug 23, 2018

It is not that easy to test Akka with a custom Scala version, because it depends on scala-java8-compat_2.13.0-pre-6c20b59-SNAPSHOT.

@adriaanm

This comment has been minimized.

Copy link
Member

adriaanm commented Aug 23, 2018

Yup, I'm running a community build locally to sort out the dependencies. Will report back!

@adriaanm

This comment has been minimized.

Copy link
Member

adriaanm commented Aug 24, 2018

I'm not sure if this is progress, but now I'm stuck at:

[error] ## Exception when compiling 34 sources to /Users/adriaan/git/akka/akka-persistence/target/test-classes
[error] Failed to find name hashes for akka.persistence.fsm.AbstractPersistentFSMTest

I'm using @MasseGuillaume's branch 2.13.0-M4 with slight modifications (http://github.com/adriaanm/akka/tree/2.13.0-M5) and locally built scalatest/scalacheck/java8-compat/collection-compat

possibly a zinc bug related to java classes? /cc @jvican (ref sbt/zinc#531)

@adriaanm

This comment has been minimized.

Copy link
Member

adriaanm commented Aug 24, 2018

after disabling zinc, the IndependentlyOrdered class (in PersistenceMatchers) compiles ok for me

@jvican

This comment has been minimized.

Copy link
Member

jvican commented Aug 24, 2018

Thanks for looping me in! I'm looking into this error. In your fork, AkkaPersistentFSMTest.java does not exist (I can only find it in akka latest master), so I don't understand how Zinc finds this class. Is it possible that you're reusing an analysis file from a previous compile?

@adriaanm

This comment has been minimized.

@jvican

This comment has been minimized.

Copy link
Member

jvican commented Aug 27, 2018

I'll have a look at what's going on here soon, I opened #10762 (comment).

@SethTisue SethTisue modified the milestones: 2.13.0-RC1, 2.13.0-M5 Aug 27, 2018

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