-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement struct support for scala 3
- Loading branch information
1 parent
3d9d4b9
commit 7318a7f
Showing
6 changed files
with
603 additions
and
74 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
23 changes: 23 additions & 0 deletions
23
core/src/test/scala/com/github/tminglei/slickpg/TypeTagSupportSuite.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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.github.tminglei.slickpg | ||
|
||
import izumi.reflect.Tag | ||
import izumi.reflect.macrortti.LightTypeTag | ||
import org.scalatest.funsuite.AnyFunSuite | ||
|
||
class TypeTagSupportSuite extends AnyFunSuite { | ||
case class Foo(x: Int) | ||
class Around { | ||
case class Inner(y: String) | ||
} | ||
type AroundInner = Around#Inner | ||
def classFromTypeTag(tag: LightTypeTag): Class[_] = { | ||
val mungedRef = tag.ref.repr.replace("::", "$") | ||
Class.forName(mungedRef) | ||
} | ||
test("class from type tag") { | ||
classFromTypeTag(Tag[String].tag) === classOf[String] | ||
classFromTypeTag(Tag[Foo].tag) === classOf[Foo] | ||
classFromTypeTag(Tag[Around#Inner].tag) === classOf[Around#Inner] | ||
classFromTypeTag(Tag[AroundInner].tag) === classOf[Around#Inner] | ||
} | ||
} |
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
Oops, something went wrong.