Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check defined in src for cache in companion
- Loading branch information
1 parent
2333316
commit 6532bb5
Showing
8 changed files
with
61 additions
and
11 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
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,7 @@ | ||
scala> enum I14540 { case A } | ||
// defined class I14540 | ||
scala> summon[scala.deriving.Mirror.SumOf[I14540]] eq I14540 | ||
val res0: Boolean = true | ||
scala> enum I14540B { case A }; summon[scala.deriving.Mirror.SumOf[I14540B]] eq I14540B | ||
// defined class I14540B | ||
val res1: Boolean = true |
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,7 @@ | ||
package lib | ||
|
||
sealed trait Top | ||
object Top // companion is necessary | ||
|
||
case class Middle() extends Top with Bottom | ||
sealed trait Bottom extends Top |
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,6 @@ | ||
import scala.deriving.Mirror | ||
|
||
@main def Test = | ||
val mirrorTop = summon[Mirror.SumOf[lib.Top]] | ||
assert(mirrorTop eq lib.Top) // cached in companion - previous run, tasty dependency | ||
assert(mirrorTop.ordinal(lib.Middle()) == 0) |
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,7 @@ | ||
package lib | ||
|
||
sealed trait Top | ||
object Top // companion is necessary | ||
|
||
case class Middle() extends Top with Bottom | ||
sealed trait Bottom extends Top |
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,6 @@ | ||
import scala.deriving.Mirror | ||
|
||
@main def Test = | ||
val mirrorTop = summon[Mirror.SumOf[lib.Top]] | ||
assert(mirrorTop eq lib.Top) // cached in companion - same run, source dependency | ||
assert(mirrorTop.ordinal(lib.Middle()) == 0) |