-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1193 from mrdziuban/remove-shapeless-scala-3
Remove shapeless dependency in scala 3
- Loading branch information
Showing
10 changed files
with
42 additions
and
67 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
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
14 changes: 7 additions & 7 deletions
14
modules/core/shared/src/main/scala-3.0+/eu/timepit/refined/internal/ToInt.scala
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
package eu.timepit.refined.internal | ||
|
||
import scala.compiletime.erasedValue | ||
import shapeless.{_0, Nat, Succ} | ||
import scala.compiletime.ops.int.S | ||
|
||
trait ToInt[N <: Nat] { | ||
trait ToInt[N <: Int] { | ||
def apply(): Int | ||
} | ||
|
||
object ToInt { | ||
def apply[N <: Nat](implicit toInt: ToInt[N]): ToInt[N] = toInt | ||
def apply[N <: Int](implicit toInt: ToInt[N]): ToInt[N] = toInt | ||
|
||
inline implicit def materialize[N <: Nat]: ToInt[N] = | ||
inline implicit def materialize[N <: Int]: ToInt[N] = | ||
new ToInt[N] { override def apply(): Int = toInt[N] } | ||
|
||
private inline def toInt[N <: Nat]: Int = | ||
private inline def toInt[N <: Int]: Int = | ||
inline erasedValue[N] match { | ||
case _: _0 => 0 | ||
case _: Succ[n] => toInt[n] + 1 | ||
case _: 0 => 0 | ||
case _: S[n] => toInt[n] + 1 | ||
} | ||
} |
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
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