Skip to content

Commit ee30499

Browse files
committed
Add support for Scala 3.0.0-RC2
1 parent 6ac8835 commit ee30499

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
- "'++2.12.12 test'"
3333
- "'++2.12.13 test' scripted"
3434
- "'++2.13.4 test'"
35-
- "'++3.0.0-M3 test'"
3635
- "'++3.0.0-RC1 test'"
36+
- "'++3.0.0-RC2 test'"
3737
steps:
3838
- uses: actions/checkout@v2
3939
- uses: olafurpg/setup-scala@v10

bin/test-release.sh

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ coursier fetch \
1313
org.scalameta:mdoc_3.0.0-M2:$version \
1414
org.scalameta:mdoc_3.0.0-M3:$version \
1515
org.scalameta:mdoc_3.0.0-RC1:$version \
16+
org.scalameta:mdoc_3.0.0-RC2:$version \
1617
org.scalameta:mdoc-js_2.11:$version \
1718
org.scalameta:mdoc-js_2.12.12:$version \
1819
org.scalameta:mdoc-js_2.12:$version \

build.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import scala.collection.mutable
33
def scala212 = "2.12.13"
44
def scala211 = "2.11.12"
55
def scala213 = "2.13.4"
6-
def scala3 = List("3.0.0-RC1", "3.0.0-M3", "3.0.0-M2")
6+
def scala3 = List("3.0.0-RC2", "3.0.0-RC1", "3.0.0-M3", "3.0.0-M2")
77

88
def scalajs = "1.5.0"
99
def scalajsBinaryVersion = "1"
@@ -111,7 +111,7 @@ lazy val sharedSettings = List(
111111

112112
val V = new {
113113
val scalameta = "4.4.10"
114-
val munit = "0.7.22"
114+
val munit = "0.7.23"
115115
val coursier = "1.0.3"
116116
val scalacheck = "1.15.2"
117117
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package mdoc.internal.pprint
2+
3+
import scala.language.implicitConversions
4+
import scala.quoted._
5+
import scala.quoted.runtime.impl.printers.SyntaxHighlight
6+
7+
trait TPrint[T]{
8+
def render: String
9+
}
10+
11+
object TPrint {
12+
inline given default[T]: TPrint[T] = ${ TypePrinter.typeString[T] }
13+
}
14+
15+
object TypePrinter{
16+
17+
def typeString[T](using ctx: Quotes, tpe: Type[T]): Expr[TPrint[T]] = {
18+
import ctx.reflect._
19+
20+
val valueType = TypeTree.of[T](using tpe).tpe.show(using Printer.TypeReprShortCode)
21+
22+
'{ new TPrint[T]{ def render: String = ${ Expr(valueType) } } }
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package mdoc.internal.sourcecode
2+
3+
import scala.language.implicitConversions
4+
import scala.quoted._
5+
6+
trait StatementMacro {
7+
inline implicit def generate[T](v: => T): SourceStatement[T] = ${ Macros.text('v) }
8+
inline def apply[T](v: => T): SourceStatement[T] = ${ Macros.text('v) }
9+
}
10+
11+
object Macros{
12+
13+
def text[T: Type](v: Expr[T])(using ctx: Quotes): Expr[SourceStatement[T]] = {
14+
import ctx.reflect.{_, given}
15+
val txt = v.asTerm.pos.sourceCode.getOrElse("")
16+
'{SourceStatement[T]($v, ${Expr(txt)})}
17+
}
18+
}

0 commit comments

Comments
 (0)