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

Compiler crashes with an invocation of a polymorphic by-name function in an if #19548

Closed
ChenCMD opened this issue Jan 27, 2024 · 1 comment · Fixed by #19558
Closed

Compiler crashes with an invocation of a polymorphic by-name function in an if #19548

ChenCMD opened this issue Jan 27, 2024 · 1 comment · Fixed by #19558
Assignees
Labels
area:typer itype:bug itype:crash regression This worked in a previous version but doesn't anymore
Milestone

Comments

@ChenCMD
Copy link

ChenCMD commented Jan 27, 2024

Compiler version

3.4.0-RC3

Minimized code

def byName[T](p: => T): T = p
val test = (if ??? then byName else (??? : ((=> Int) => Int))) (42)

Output (click arrow to expand)

[debug] [zinc] IncrementalCompile -----------
[debug] IncrementalCompile.incrementalCompile
[debug] previous = Stamps for: 2 products, 1 sources, 1 libraries
[debug] current source = Set(${BASE}/src/main/scala/Main.scala)
[debug] > initialChanges = InitialChanges(Changes(added = Set(), removed = Set(), changed = Set(${BASE}/src/main/scala/Main.scala), unmodified = ...),Set(${BASE}/target/scala-3.4.0-RC3/classes/Main$package$.class, ${BASE}/target/scala-3.4.0-RC3/classes/Main$package.class),Set(),API Changes: Set())
[debug] 
[debug] Initial source changes:
[debug]         removed: Set()
[debug]         added: Set()
[debug]         modified: Set(${BASE}/src/main/scala/Main.scala)
[debug] Invalidated products: Set(${BASE}/target/scala-3.4.0-RC3/classes/Main$package$.class, ${BASE}/target/scala-3.4.0-RC3/classes/Main$package.class)
[debug] External API changes: API Changes: Set()
[debug] Modified binary dependencies: Set()
[debug] Initial directly invalidated classes: Set(Main$package)
[debug] Sources indirectly invalidated by:
[debug]         product: Set(${BASE}/src/main/scala/Main.scala)
[debug]         binary dep: Set()
[debug]         external source: Set()
[debug] all 1 sources are invalidated
[debug] Initial set of included nodes: Main$package
[debug] Recompiling all sources: number of invalidated sources > 50.0 percent of all sources
[debug] compilation cycle 1
[info] compiling 1 Scala source to /Users/chen/ChenData/Programming/Scala/Test/target/scala-3.4.0-RC3/classes ...
[debug] Returning already retrieved and compiled bridge: /Users/chen/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-sbt-bridge/3.4.0-RC3/scala3-sbt-bridge-3.4.0-RC3.jar.
[debug] [zinc] Running cached compiler 617b6cdd for Scala Compiler version 3.4.0-RC3
[debug] [zinc] The Scala compiler is invoked with:
[debug]         -bootclasspath
[debug]         /Users/chen/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.4.0-RC3/scala3-library_3-3.4.0-RC3.jar:/Users/chen/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar
[debug]         -classpath
[debug]         /Users/chen/ChenData/Programming/Scala/Test/target/scala-3.4.0-RC3/classes
[error] ## Exception when compiling 1 sources to /Users/chen/ChenData/Programming/Scala/Test/target/scala-3.4.0-RC3/classes
[error] java.lang.AssertionError: assertion failed: ExprType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class Int)) in in intersection () ?=> Any & => Int
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error] dotty.tools.dotc.core.Types$.expectValueTypeOrWildcard(Types.scala:3651)
[error] dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:3466)
[error] dotty.tools.dotc.core.Types$AndType$.balanced(Types.scala:3484)
[error] dotty.tools.dotc.core.TypeComparer.andType$$anonfun$1(TypeComparer.scala:2541)
[error] dotty.tools.dotc.core.TypeComparer.liftIfHK(TypeComparer.scala:2579)
[error] dotty.tools.dotc.core.TypeComparer.andTypeGen(TypeComparer.scala:2519)
[error] dotty.tools.dotc.core.TypeComparer.andType(TypeComparer.scala:2541)
[error] dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:2354)
[error] dotty.tools.dotc.core.TypeComparer.lubArgs(TypeComparer.scala:2413)
[error] dotty.tools.dotc.core.TypeComparer$.lubArgs(TypeComparer.scala:3169)
[error] dotty.tools.dotc.core.TypeOps$.mergeRefinedOrApplied$1(TypeOps.scala:272)
[error] dotty.tools.dotc.core.TypeOps$.orDominator(TypeOps.scala:393)
[error] dotty.tools.dotc.core.Types$OrType.join(Types.scala:3546)
[error] dotty.tools.dotc.core.Types$Type.goOr$1(Types.scala:916)
[error] dotty.tools.dotc.core.Types$Type.go$1(Types.scala:789)
[error] dotty.tools.dotc.core.Types$Type.findMember(Types.scala:932)
[error] dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:726)
[error] dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:716)
[error] dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:2508)
[error] dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2841)
[error] dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2856)
[error] dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2789)
[error] dotty.tools.dotc.ast.tpd$TypedTreeCopier.Select(tpd.scala:640)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:241)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:291)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
[error] dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:247)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:252)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
[error] dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:461)
[error] dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:461)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:372)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:268)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
[error] dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:461)
[error] dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:461)
[error] dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:392)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:395)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:477)
[error] dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:489)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:354)
[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.core.Phases$Phase.runOn(Phases.scala:360)
[error] dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:315)
[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:337)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:348)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:357)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:71)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:357)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:261)
[error] dotty.tools.dotc.Run.compile(Run.scala:246)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
[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:193)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
[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:211)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:180)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
[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:419)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2371)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2321)
[error] sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:31)
[error] sbt.internal.io.Retry$.apply(Retry.scala:47)
[error] sbt.internal.io.Retry$.apply(Retry.scala:29)
[error] sbt.internal.io.Retry$.apply(Retry.scala:24)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2319)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] sbt.Execute.work(Execute.scala:292)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error] java.base/java.lang.Thread.run(Thread.java:1589)
[error]            
[error] java.lang.AssertionError: assertion failed: ExprType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class Int)) in in intersection () ?=> Any & => Int
[error]         at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
[error]         at dotty.tools.dotc.core.Types$.expectValueTypeOrWildcard(Types.scala:3651)
[error]         at dotty.tools.dotc.core.Types$AndType$.apply(Types.scala:3466)
[error]         at dotty.tools.dotc.core.Types$AndType$.balanced(Types.scala:3484)
[error]         at dotty.tools.dotc.core.TypeComparer.andType$$anonfun$1(TypeComparer.scala:2541)
[error]         at dotty.tools.dotc.core.TypeComparer.liftIfHK(TypeComparer.scala:2579)
[error]         at dotty.tools.dotc.core.TypeComparer.andTypeGen(TypeComparer.scala:2519)
[error]         at dotty.tools.dotc.core.TypeComparer.andType(TypeComparer.scala:2541)
[error]         at dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:2354)
[error]         at dotty.tools.dotc.core.TypeComparer.lubArgs(TypeComparer.scala:2413)
[error]         at dotty.tools.dotc.core.TypeComparer$.lubArgs(TypeComparer.scala:3169)
[error]         at dotty.tools.dotc.core.TypeOps$.mergeRefinedOrApplied$1(TypeOps.scala:272)
[error]         at dotty.tools.dotc.core.TypeOps$.orDominator(TypeOps.scala:393)
[error]         at dotty.tools.dotc.core.Types$OrType.join(Types.scala:3546)
[error]         at dotty.tools.dotc.core.Types$Type.goOr$1(Types.scala:916)
[error]         at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:789)
[error]         at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:932)
[error]         at dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:726)
[error]         at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:716)
[error]         at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:2508)
[error]         at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2841)
[error]         at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2856)
[error]         at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2789)
[error]         at dotty.tools.dotc.ast.tpd$TypedTreeCopier.Select(tpd.scala:640)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:241)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:291)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
[error]         at dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:247)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:252)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
[error]         at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:461)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:461)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:372)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:268)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
[error]         at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:461)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:461)
[error]         at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:392)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:395)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
[error]         at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:477)
[error]         at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:489)
[error]         at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:354)
[error]         at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error]         at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error]         at scala.collection.immutable.List.foreach(List.scala:333)
[error]         at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:360)
[error]         at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:315)
[error]         at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error]         at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error]         at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error]         at dotty.tools.dotc.Run.runPhases$1(Run.scala:337)
[error]         at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:348)
[error]         at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:357)
[error]         at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:71)
[error]         at dotty.tools.dotc.Run.compileUnits(Run.scala:357)
[error]         at dotty.tools.dotc.Run.compileSources(Run.scala:261)
[error]         at dotty.tools.dotc.Run.compile(Run.scala:246)
[error]         at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
[error]         at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
[error]         at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error]         at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:193)
[error]         at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:248)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:183)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
[error]         at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:211)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:534)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:534)
[error]         at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:180)
[error]         at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:178)
[error]         at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:464)
[error]         at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error]         at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error]         at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error]         at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
[error]         at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:419)
[error]         at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:506)
[error]         at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:406)
[error]         at sbt.internal.inc.Incremental$.apply(Incremental.scala:172)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:534)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:488)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:425)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error]         at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2371)
[error]         at sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2321)
[error]         at sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:31)
[error]         at sbt.internal.io.Retry$.apply(Retry.scala:47)
[error]         at sbt.internal.io.Retry$.apply(Retry.scala:29)
[error]         at sbt.internal.io.Retry$.apply(Retry.scala:24)
[error]         at sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error]         at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2319)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]         at sbt.Execute.work(Execute.scala:292)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error]         at java.base/java.lang.Thread.run(Thread.java:1589)
[error] (Compile / compileIncremental) java.lang.AssertionError: assertion failed: ExprType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class Int)) in in intersection () ?=> Any & => Int
@ChenCMD ChenCMD added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 27, 2024
@WojciechMazur
Copy link
Contributor

Thank you for the minimisation, it seems to be one of regressions hidden for ling time
Bisect points to 81cbe32

Last good release: 3.1.2-RC1-bin-20220125-a83a0a7-NIGHTLY
First bad release: 3.1.3-RC1-bin-20220126-8ae2962-NIGHTLY

@WojciechMazur WojciechMazur added area:typer regression This worked in a previous version but doesn't anymore and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 29, 2024
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 29, 2024
There's a window of vulnerability between ElimByName and Erasure where some
ExprTypes `=> T` that appear as parameters of function types are not yet converted
to by-name functions `() ?=> T`. These would cause an assertion violation when
used as operands of & or |. We fix this on the fly when forming these types in TypeComparer.
As explained in ElimByName, we can't fix it beforehand by mapping all occurrences of `=> T` to
`() ?=> T` since that could lead to cycles.

Fixes scala#19548
odersky added a commit that referenced this issue Jan 31, 2024
There's a window of vulnerability between ElimByName and Erasure where
some ExprTypes `=> T` that appear as parameters of function types are
not yet converted to by-name functions `() ?=> T`. These would cause an
assertion violation when used as operands of & or |. We fix this on the
fly when forming these types in TypeComparer. As explained in
ElimByName, we can't fix it beforehand by mapping all occurrences of `=>
T` to `() ?=> T` since that could lead to cycles.

Fixes #19548
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
WojciechMazur pushed a commit that referenced this issue Jun 28, 2024
There's a window of vulnerability between ElimByName and Erasure where some
ExprTypes `=> T` that appear as parameters of function types are not yet converted
to by-name functions `() ?=> T`. These would cause an assertion violation when
used as operands of & or |. We fix this on the fly when forming these types in TypeComparer.
As explained in ElimByName, we can't fix it beforehand by mapping all occurrences of `=> T` to
`() ?=> T` since that could lead to cycles.

Fixes #19548

[Cherry-picked 1ea4c86]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer itype:bug itype:crash regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants