Skip to content

Regression in scalalandio/chimney - missing span #23022

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

Closed
WojciechMazur opened this issue Apr 21, 2025 · 4 comments · Fixed by #23372
Closed

Regression in scalalandio/chimney - missing span #23022

WojciechMazur opened this issue Apr 21, 2025 · 4 comments · Fixed by #23372
Assignees
Labels
area:typer itype:bug itype:crash regression This worked in a previous version but doesn't anymore

Comments

@WojciechMazur
Copy link
Contributor

Based on OpenCB failure in scalalandio/chimney - OpenCB logs

Compiler version

Last good revision: 3.7.1-RC1-bin-20250411-f4847cc-NIGHTLY
First bad revision: 3.7.1-RC1-bin-20250412-e70ea84-NIGHTLY

Bisect points to either:
d72e5ea
19dcfa2
However these 2 fail with different errors. The exact commit that introduced regression is not yet known

Not yet minimized

Needs minimisation, unfortunately I won't be able to provide one before 28th April

Output (click arrow to expand)

Error:  java.lang.AssertionError: assertion failed
Error:  scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
Error:  dotty.tools.dotc.util.Spans$Span$.start$extension(Spans.scala:45)
Error:  dotty.tools.dotc.typer.Migrations.implicitParams(Migrations.scala:137)
Error:  dotty.tools.dotc.typer.Migrations.implicitParams$(Migrations.scala:28)
Error:  dotty.tools.dotc.typer.Typer.implicitParams(Typer.scala:154)
Error:  dotty.tools.dotc.typer.Typer.adaptToArgs$1(Typer.scala:4204)
....
[info] 
[info]   exception occurred while typechecking /build/repo/chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/patcher/rules/PatchCollectionWithOptionCollectionRuleModule.scala
[info] 
[info]   An unhandled exception was thrown in the compiler.
[info]   Please file a crash report here:
[info]   https://github.com/scala/scala3/issues/new/choose
[info]   For non-enriched exceptions, compile with -Xno-enrich-error-messages.
[info] 
[info] 
[info]      while compiling: /build/repo/chimney/src/main/scala/io/scalaland/chimney/internal/compiletime/derivation/patcher/rules/PatchCollectionWithOptionCollectionRuleModule.scala
[info]         during phase: typer
[info]                 mode: Mode(ImplicitsEnabled)
[info]      library version: version 2.13.16
[info]     compiler version: version 3.7.1-RC1-bin-20250417-05b102a-NIGHTLY-git-05b102a
[info]             settings: -Wconf List(msg=Unreachable case:s, msg=Missing symbol position:s, msg=can be rewritten automatically under:s) -Wnonunit-statement true -Wunused List(privates, locals, explicits, implicits, params) -Wvalue-discard true -Xcheck-macros true -Xkind-projector underscores -classpath /build/repo/chimney/target/jvm-3/classes:/build/repo/chimney-macro-commons/target/jvm-3/classes:/root/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.7.1-RC1-bin-20250417-05b102a-NIGHTLY/scala3-library_3-3.7.1-RC1-bin-20250417-05b102a-NIGHTLY.jar:/root/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-collection-compat_3/2.13.0/scala-collection-compat_3-2.13.0.jar:/root/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.16/scala-library-2.13.16.jar -d /build/repo/chimney/target/jvm-3/classes -explain true -explain-types true -no-indent true -rewrite Some(dotty.tools.dotc.rewrites.Rewrites@18e19f68) -source 3.3-migration
Error:  ## Exception when compiling 140 sources to /build/repo/chimney/target/jvm-3/classes
Error:  java.lang.AssertionError: assertion failed
Error:  scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
Error:  dotty.tools.dotc.util.Spans$Span$.start$extension(Spans.scala:45)
Error:  dotty.tools.dotc.typer.Migrations.implicitParams(Migrations.scala:137)
Error:  dotty.tools.dotc.typer.Migrations.implicitParams$(Migrations.scala:28)
Error:  dotty.tools.dotc.typer.Typer.implicitParams(Typer.scala:154)
Error:  dotty.tools.dotc.typer.Typer.adaptToArgs$1(Typer.scala:4204)
Error:  dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4872)
Error:  dotty.tools.dotc.typer.Typer.adapt(Typer.scala:4107)
Error:  dotty.tools.dotc.typer.Typer.readapt$1(Typer.scala:4117)
Error:  dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4865)
Error:  dotty.tools.dotc.typer.Typer.adapt(Typer.scala:4107)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3843)
Error:  dotty.tools.dotc.typer.Applications.tryWithProto$1(Applications.scala:1534)
Error:  dotty.tools.dotc.typer.Applications.tryWithTypeArgs$1$$anonfun$1(Applications.scala:1546)
Error:  dotty.tools.dotc.typer.Typer$.tryEither(Typer.scala:127)
Error:  dotty.tools.dotc.typer.Applications.tryWithTypeArgs$1(Applications.scala:1554)
Error:  dotty.tools.dotc.typer.Applications.tryWithName$1(Applications.scala:1561)
Error:  dotty.tools.dotc.typer.Applications.trySelectUnapply$1(Applications.scala:1575)
Error:  dotty.tools.dotc.typer.Applications.typedUnApply(Applications.scala:1583)
Error:  dotty.tools.dotc.typer.Applications.typedUnApply$(Applications.scala:465)
Error:  dotty.tools.dotc.typer.Typer.typedUnApply(Typer.scala:154)
Error:  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3562)
Error:  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3650)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Applications$UnapplyArgs.typedPatterns$$anonfun$2(Applications.scala:289)
Error:  scala.collection.LazyZip2$$anon$1$$anon$2.next(LazyZipOps.scala:42)
Error:  scala.collection.immutable.List.prependedAll(List.scala:153)
Error:  scala.collection.immutable.List$.from(List.scala:685)
Error:  scala.collection.immutable.List$.from(List.scala:682)
Error:  scala.collection.BuildFromLowPriority2$$anon$11.fromSpecific(BuildFrom.scala:115)
Error:  scala.collection.BuildFromLowPriority2$$anon$11.fromSpecific(BuildFrom.scala:112)
Error:  scala.collection.LazyZip2.map(LazyZipOps.scala:37)
Error:  dotty.tools.dotc.typer.Applications$UnapplyArgs.typedPatterns(Applications.scala:289)
Error:  dotty.tools.dotc.typer.Applications.typedUnApply(Applications.scala:1680)
Error:  dotty.tools.dotc.typer.Applications.typedUnApply$(Applications.scala:465)
Error:  dotty.tools.dotc.typer.Typer.typedUnApply(Typer.scala:154)
Error:  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3562)
Error:  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3650)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Typer.typedTuple(Typer.scala:3461)
Error:  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3600)
Error:  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3650)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Typer.typedPattern(Typer.scala:3864)
Error:  dotty.tools.dotc.typer.Typer.typedCase(Typer.scala:2286)
Error:  dotty.tools.dotc.typer.Typer.typedCases$$anonfun$1(Typer.scala:2212)
Error:  dotty.tools.dotc.core.Decorators$.loop$1(Decorators.scala:99)
Error:  dotty.tools.dotc.core.Decorators$.mapconserve(Decorators.scala:115)
Error:  dotty.tools.dotc.typer.Typer.typedCases(Typer.scala:2211)
Error:  dotty.tools.dotc.typer.Typer.$anonfun$39(Typer.scala:2194)
Error:  dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:2663)
Error:  dotty.tools.dotc.typer.Applications.harmonic$(Applications.scala:465)
Error:  dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:154)
Error:  dotty.tools.dotc.typer.Typer.typedMatchFinish(Typer.scala:2194)
Error:  dotty.tools.dotc.typer.Typer.typedMatch(Typer.scala:2122)
Error:  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3577)
Error:  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3650)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3843)
Error:  dotty.tools.dotc.typer.Typer.$anonfun$66(Typer.scala:2954)
Error:  dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
Error:  dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2954)
Error:  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3544)
Error:  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3649)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3754)
Error:  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3800)
Error:  dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3222)
Error:  dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3550)
Error:  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3554)
Error:  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3649)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3754)
Error:  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3800)
Error:  dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3222)
Error:  dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3550)
Error:  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3554)
Error:  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3649)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3754)
Error:  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3800)
Error:  dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3355)
Error:  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3596)
Error:  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3650)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
Error:  dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
Error:  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3843)
Error:  dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
Error:  scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
Error:  scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
Error:  dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:510)
Error:  dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
Error:  dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
Error:  scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
Error:  scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
Error:  scala.collection.immutable.List.prependedAll(List.scala:155)
Error:  scala.collection.immutable.List$.from(List.scala:685)
Error:  scala.collection.immutable.List$.from(List.scala:682)
Error:  scala.collection.IterableOps$WithFilter.map(Iterable.scala:900)
Error:  dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
Error:  dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:368)
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:1324)
Error:  dotty.tools.dotc.Run.runPhases$1(Run.scala:361)
Error:  dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:408)
Error:  dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:408)
Error:  scala.Function0.apply$mcV$sp(Function0.scala:42)
Error:  dotty.tools.dotc.Run.showProgress(Run.scala:470)
Error:  dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:408)
Error:  dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:420)
Error:  dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
Error:  dotty.tools.dotc.Run.compileUnits(Run.scala:420)
Error:  dotty.tools.dotc.Run.compileSources(Run.scala:307)
Error:  dotty.tools.dotc.Run.compile(Run.scala:292)
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:196)
Error:  scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
Error:  sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:252)
Error:  sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:186)
Error:  sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:166)
Error:  sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:241)
Error:  sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:166)
Error:  sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:214)
Error:  sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:542)
Error:  sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:542)
Error:  sbt.internal.inc.Incremental$.$anonfun$apply$3(Incremental.scala:182)
Error:  sbt.internal.inc.Incremental$.$anonfun$apply$3$adapted(Incremental.scala:180)
Error:  sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:458)
Error:  sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:117)
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:413)
Error:  sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:500)
Error:  sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:400)
Error:  sbt.internal.inc.Incremental$.apply(Incremental.scala:208)
Error:  sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:542)
Error:  sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:496)
Error:  sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
Error:  sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:433)
Error:  sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
Error:  sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2443)
Error:  sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2393)
Error:  sbt.internal.server.BspCompileTask$.$anonfun$compute$1(BspCompileTask.scala:41)
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:41)
Error:  sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2391)
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:572)
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:1583)
@WojciechMazur WojciechMazur added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 21, 2025
@Gedochao Gedochao added area:typer stat:needs minimization Needs a self contained minimization 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 Apr 24, 2025
@WojciechMazur
Copy link
Contributor Author

Bisect points to b4a802a

Minimization:

//> using options -Ykind-projector:underscores

trait PatchCollectionWithOptionCollectionRuleModule { self: Derivation =>
  protected object PatchCollectionWithOptionCollectionRule extends Rule {
    def expand[Patch, A]: DerivationResult[ExpansionResult[A]] = {
      // given Type[A] = ??? 
      Type[A] match {
        case TotallyOrPartiallyBuildIterable(_) => ??? // couses crash, for some reason it compiles even if not given Type[A]
        case _                                  => ???
      }
    }
  }
}
 
trait Derivation:
  trait DerivationResult[+A]
  
  abstract protected class Rule:
    def expand[From, To]: DerivationResult[ExpansionResult[To]]
  sealed trait ExpansionResult[+A]

  final protected type Type[A] = scala.quoted.Type[A]
  object Type:
    final def apply[A]: Type[A] = ???

  final protected type Existential[F[_]] = Existential.Bounded[Nothing, Any, F]
  protected object Existential:
    sealed trait Bounded[L, U >: L, F[_ >: L <: U]]

  abstract protected class TotallyOrPartiallyBuildIterable[Collection, Item]
  object TotallyOrPartiallyBuildIterable:
    def unapply[M](implicit M: Type[M]): Option[Existential[TotallyOrPartiallyBuildIterable[M, *]]] = ???

@WojciechMazur WojciechMazur removed the stat:needs minimization Needs a self contained minimization label Apr 28, 2025
bracevac added a commit to dotty-staging/dotty that referenced this issue Jun 15, 2025
bracevac added a commit to dotty-staging/dotty that referenced this issue Jun 16, 2025
@bracevac
Copy link
Contributor

@WojciechMazur my PR #23372 fixes the crash, but then your original example errors on

-- [E127] Pattern Match Error: local/i23022.scala:8:13 -------------------------
8 |        case TotallyOrPartiallyBuildIterable(_) => ??? // couses crash, for some reason it compiles even if not given Type[A]
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |TotallyOrPartiallyBuildIterable cannot be used as an extractor in a pattern because it lacks an unapply or unapplySeq method with the appropriate signature
  |
  | longer explanation available when compiling with `-explain`

Which can be fixed by removing the (_):

case TotallyOrPartiallyBuildIterable => ???

It's probably an artifact from minimzing.

@WojciechMazur
Copy link
Contributor Author

Which can be fixed by removing the (_):

I'm not sure if it's correct - wouldn't this mean we're just refering to object TotallyOrPartiallyBuildIterable instead of its unapply method?

Also, the code from minimisation correctly does compile in Scala 3.3 LTS and Next versions until 3.7.0 (crashes in 3.7.1) without any changes.

Proposed workaround (removing (_)) works since Scala 3.4, but fails to compile under 3.3 LTS - I'm not sure which behaviour is correct here.

@bracevac
Copy link
Contributor

Ah right, it'll actually try matching against the object. But the unapply is missing an argument for a concrete scrutinee, like

object TotallyOrPartiallyBuildIterable:
    def unapply[M](scrutinee: Type[M])(implicit M: Type[M]): Option[...] = ???

and at the call site we have to have the given in scope as well:

given Type[A] = ???
Type[A] match {
  case TotallyOrPartiallyBuildIterable(_) => ???
  case _                                  => ???
}

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.

3 participants