Skip to content

Regression in 7mind/izumi for implicit search / typer #19942

Closed
@WojciechMazur

Description

@WojciechMazur

Based on Open CB failure found in 7mind/izumi - build logs
When the Identity type is placed in different scope then rest of the code, implicit cannot be found.

Compiler version

Last good release: 3.4.2-RC1-bin-20240222-98efdab-NIGHTLY
First bad release: 3.4.2-RC1-bin-20240226-e0cb1e7-NIGHTLY
Bisect points to 729e5ba

Minimized code

type LifecycleF = [_] =>> Any
trait Lifecycle[+F[_], +A]

trait LifecycleTag[R]
object LifecycleTag:
  implicit def resourceTag[R <: Lifecycle[F0, A0], F0[_], A0]: LifecycleTag[R] = ???

trait MakeDSL[T]:
  final def fromResource[R <: Lifecycle[LifecycleF, T]](implicit tag: LifecycleTag[R]): Any = ???

object distage:
  // Cannot be defined in the same scope as rest of code
  final type Identity[+A] = A
import distage.*

trait Resource
trait DependentResource() extends Lifecycle[Identity, Resource]

@main def Test =  {
  val dsl: MakeDSL[Resource] = ???
  val fails = dsl.fromResource[DependentResource]
  val works = dsl.fromResource[DependentResource](using LifecycleTag.resourceTag[DependentResource, Identity, Resource])
}

Output

Compiling project (Scala 3.4.2-RC1-bin-20240312-3694d95-NIGHTLY, JVM (17))
[error] ./test.scala:50:50
[error] No given instance of type LifecycleTag[DependentResource] was found for parameter tag of method fromResource in trait MakeDSL.
[error] I found:
[error] 
[error]     LifecycleTag.resourceTag[R, F0, A0]
[error] 
[error] But method resourceTag in object LifecycleTag does not match type LifecycleTag[DependentResource].
[error]   val fails = dsl.fromResource[DependentResource]
[error]                                                  ^
Error compiling project (Scala 3.4.2-RC1-bin-20240312-3694d95-NIGHTLY, JVM (17))

Expectation

Should compile

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions