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

Deprecate INothing #2870

Merged
merged 1 commit into from
Apr 4, 2022
Merged

Conversation

mpilquist
Copy link
Member

This PR deprecates the INothing type alias as it appears to no longer be necessary with modern compilers. Only a single use site is impacted by this deprecation (in CompilationTest.scala).

@mpilquist
Copy link
Member Author

Note Pure is still necessary unfortunately. If we replace all uses of Pure with Nothing (and replace bounds like F[x] >: Nothing[x] with F[_]), Scala 3 fails to compile with errors like:

[error] -- [E007] Type Mismatch Error: Development/oss/fs2/core/jvm/src/test/scala/fs2/HashSuite.scala:45:12
[error] 45 |            acc ++ Stream.chunk(Chunk.array(c))
[error]    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |    Found:    fs2.Stream[[x] =>> Nothing, Byte]
[error]    |    Required: fs2.Stream[Nothing, Byte]

This is due to scala/scala3#14640.

Scala 2 fares worse with diverging implicit expansions when looking for Arbitrary[Stream[Nothing, X]] instances.

@SystemFw SystemFw merged commit 28c6e6a into typelevel:main Apr 4, 2022
@bplommer
Copy link
Contributor

bplommer commented Apr 5, 2022

In Scala 3.1.1, changing the definition of Pure from type Pure[A] <: Nothing to type Pure[A] = Nothing produces the following error - looks like a compiler bug?

[info] exception occurred while compiling /Users/ben/oss/fs2/core/jvm/src/main/scala/fs2/compression/CompressionPlatform.scala, /Users/ben/oss/fs2/core/jvm/src/main/scala/fs2/hash.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/Compiler.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/Pull.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/Scan.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/Stream.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/concurrent/Channel.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/concurrent/Signal.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/fs2.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/text.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/timeseries/TimeSeries.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/timeseries/TimeStamped.scala
java.lang.AssertionError: assertion failed: unresolved symbols: type x (line 375) #24976, type x (line 3077) #26919, type x (line 3110) #26928, type x (line 363) #26998 when pickling /Users/ben/oss/fs2/core/jvm/src/main/scala/fs2/compression/CompressionPlatform.scala while compiling /Users/ben/oss/fs2/core/jvm/src/main/scala/fs2/compression/CompressionPlatform.scala, /Users/ben/oss/fs2/core/jvm/src/main/scala/fs2/hash.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/Compiler.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/Pull.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/Scan.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/Stream.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/concurrent/Channel.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/concurrent/Signal.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/fs2.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/text.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/timeseries/TimeSeries.scala, /Users/ben/oss/fs2/core/shared/src/main/scala/fs2/timeseries/TimeStamped.scala
[error] ## Exception when compiling 37 sources to /Users/ben/oss/fs2/core/jvm/target/scala-3.1.1/classes
[error] java.lang.AssertionError: assertion failed: unresolved symbols: type x (line 375) #24976, type x (line 3077) #26919, type x (line 3110) #26928, type x (line 363) #26998 when pickling /Users/ben/oss/fs2/core/jvm/src/main/scala/fs2/compression/CompressionPlatform.scala
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:777)
[error] dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:69)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.transform.Pickler.run$$anonfun$1(Pickler.scala:106)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.transform.Pickler.run(Pickler.scala:106)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308)
[error] scala.collection.immutable.List.map(List.scala:246)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309)
[error] dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:111)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:261)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$1(Run.scala:272)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:289)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:222)
[error] dotty.tools.dotc.Run.compile(Run.scala:206)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:169)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2366)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2316)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:30)
[error] sbt.internal.io.Retry$.apply(Retry.scala:46)
[error] sbt.internal.io.Retry$.apply(Retry.scala:28)
[error] sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:30)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2314)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] sbt.Execute.work(Execute.scala:291)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error] java.base/java.lang.Thread.run(Thread.java:833)
[error]            
[error] stack trace is suppressed; run last Compile / compileIncremental for the full output
[error] (Compile / compileIncremental) java.lang.AssertionError: assertion failed: unresolved symbols: type x (line 375) #24976, type x (line 3077) #26919, type x (line 3110) #26928, type x (line 363) #26998 when pickling /Users/ben/oss/fs2/core/jvm/src/main/scala/fs2/compression/CompressionPlatform.scala
[error] Total time: 2 s, completed 5 Apr 2022, 09:53:11

@mpilquist mpilquist deleted the topic/deprecate-inothing branch February 18, 2024 13:33
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

Successfully merging this pull request may close these issues.

3 participants