forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…cala#21017) Before the changes, when comparing two `HKTypeLambda` result types, the list of binding pairs was lost when entering comparison of `AndOrType`s, which caused the `equals` to fail, and hence prevented hash-consing. Even though `M1` and `M2` in pos/i20858-min should still conform to one-another, we entered a deep-subtype comparison because of the order in which the TypeComparer does dealiasing of AppliedTypes, and comparison of MatchCases and AndTypes. Fix scala#20858
- Loading branch information
1 parent
fc1ce14
commit f2829c3
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
type M[F[_,_]] = Int match | ||
case 0 => String & M[F] | ||
|
||
type M1 = M[[x,y] =>> x | y] | ||
type M2 = M[[x,y] =>> x | y] | ||
|
||
def Test: Unit = | ||
val x: M1 = ??? | ||
val _: M2 = x // was error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import scala.compiletime.* | ||
import scala.deriving.* | ||
|
||
sealed trait ZIO[-R, +E, +A] | ||
sealed abstract class ZLayer[-RIn, +E, +ROut] | ||
object ZLayer: | ||
def apply[RIn, E, ROut](zio: => ZIO[RIn, E, ROut]): ZLayer[RIn, E, ROut] = ??? | ||
type URIO[-R, +A] = ZIO[R, Nothing, A] | ||
type IAnyType[T <: Tuple] = Tuple.Fold[T, Any, [x, y] =>> x & y] | ||
type UAnyType[T <: Tuple] = Tuple.Fold[T, Any, [x, y] =>> x | y] | ||
|
||
|
||
trait AutoLayer[A]: | ||
def zlayer(using | ||
p: Mirror.ProductOf[A] | ||
): ZLayer[IAnyType[p.MirroredElemTypes], Nothing, A] | ||
|
||
object AutoLayer: | ||
inline given derived[A](using p: Mirror.ProductOf[A]): AutoLayer[A] = { | ||
val a: ZIO[IAnyType[p.MirroredElemTypes], Nothing, A] = ??? | ||
new AutoLayer[A]: | ||
override def zlayer(using | ||
pp: Mirror.ProductOf[A] | ||
): ZLayer[IAnyType[pp.MirroredElemTypes], Nothing, A] = ZLayer { | ||
a.asInstanceOf[ZIO[IAnyType[pp.MirroredElemTypes], Nothing, A]] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
case class TestService(port: Int) derives AutoLayer // was error |