Skip to content

Commit cbb6c43

Browse files
committed
Upgrade to Scala 3.0.0-M3
1 parent c9fd879 commit cbb6c43

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

build.sc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import $file.example.websockets3.build
2727
import $file.example.websockets4.build
2828

2929
val scala213 = "2.13.4"
30-
val scala3 = "3.0.0-M2"
30+
val scala3 = "3.0.0-M3"
3131
val dottyCustomVersion = Option(sys.props("dottyVersion"))
3232

3333
trait CaskModule extends CrossScalaModule with PublishModule{
@@ -51,7 +51,7 @@ class CaskMainModule(val crossScalaVersion: String) extends CaskModule {
5151
def ivyDeps = T{
5252
Agg(
5353
ivy"io.undertow:undertow-core:2.2.3.Final",
54-
ivy"com.lihaoyi::upickle:1.2.2"
54+
ivy"com.lihaoyi::upickle:1.2.3"
5555
) ++
5656
(if(!isDotty) Agg(ivy"org.scala-lang:scala-reflect:${scalaVersion()}") else Agg())
5757
}
@@ -62,7 +62,7 @@ class CaskMainModule(val crossScalaVersion: String) extends CaskModule {
6262
object test extends Tests{
6363
def testFrameworks = Seq("utest.runner.Framework")
6464
def ivyDeps = Agg(
65-
ivy"com.lihaoyi::utest::0.7.5",
65+
ivy"com.lihaoyi::utest::0.7.7",
6666
ivy"com.lihaoyi::requests::0.6.5"
6767
)
6868
}
@@ -81,9 +81,9 @@ object cask extends Cross[CaskMainModule]((Seq(scala213, scala3) ++ dottyCustomV
8181
millSourcePath / s"src-$platformSegment"
8282
)
8383
def ivyDeps = Agg(
84-
ivy"com.lihaoyi::sourcecode:0.2.1",
85-
ivy"com.lihaoyi::pprint:0.6.0",
86-
ivy"com.lihaoyi::geny:0.6.2"
84+
ivy"com.lihaoyi::sourcecode:0.2.3",
85+
ivy"com.lihaoyi::pprint:0.6.1",
86+
ivy"com.lihaoyi::geny:0.6.5"
8787
)
8888
}
8989
class UtilJvmModule(val crossScalaVersion: String) extends UtilModule {

cask/src-3/cask/router/Macros.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ object Macros {
7474

7575
val reader = Expr.summon(using inputReaderType) match {
7676
case None =>
77-
Reporting.error(
77+
report.error(
7878
s"no reader of type ${paramTpt.tpe.typeSymbol.fullName} found for parameter ${param.name}",
79-
param.pos
79+
param.pos.get
8080
)
8181
'{???}
8282
case Some(expr) => expr
@@ -111,7 +111,7 @@ object Macros {
111111
val paramss = method.paramSymss
112112

113113
if (paramss.isEmpty) {
114-
Reporting.error("At least one parameter list must be declared.", method.pos)
114+
report.error("At least one parameter list must be declared.", method.pos.get)
115115
return '{???}
116116
}
117117

@@ -170,7 +170,7 @@ object Macros {
170170

171171
val conversion = Expr.summon(using conversionTpe) match {
172172
case None =>
173-
Reporting.error(s"can't convert ${rtpt.tpe.typeSymbol.fullName} to a response", method.pos)
173+
report.error(s"can't convert ${rtpt.tpe.typeSymbol.fullName} to a response", method.pos.get)
174174
'{???}
175175
case Some(expr) => expr
176176
}
@@ -281,10 +281,10 @@ object Macros {
281281
}
282282

283283
Runtime.validateLists(parsedArgss).map{ validated =>
284-
val result = ${call(method, '{validated})}
284+
val result = ${call(using qctx)(method, '{validated})}
285285

286286
${
287-
convertToResponse(
287+
convertToResponse(using qctx)(
288288
method,
289289
endpoint,
290290
'{result}

cask/src-3/cask/router/RoutesEndpointMetadata.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ case class RoutesEndpointsMetadata[T](value: Seq[EndpointMetadata[T]])
66
object RoutesEndpointsMetadata{
77
import scala.quoted._
88

9-
inline given initialize[T] as RoutesEndpointsMetadata[T] = ${initializeImpl}
9+
inline given initialize[T]: RoutesEndpointsMetadata[T] = ${initializeImpl}
1010

1111
def setRoutesImpl[T](setter: Expr[RoutesEndpointsMetadata[T] => Unit])
1212
(using qctx: Quotes, tpe: Type[T]): Expr[Unit] = {
@@ -20,21 +20,21 @@ object RoutesEndpointsMetadata{
2020
import qctx.reflect._
2121

2222
val routeParts: List[Expr[EndpointMetadata[T]]] = for {
23-
m <- TypeRepr.of(using tpe).typeSymbol.methods
24-
annotations = m.annots.filter(_.tpe <:< TypeRepr.of[Decorator[_, _, _]])
23+
m <- TypeRepr.of(using tpe).typeSymbol.memberMethods
24+
annotations = m.annotations.filter(_.tpe <:< TypeRepr.of[Decorator[_, _, _]])
2525
if (annotations.nonEmpty)
2626
} yield {
2727

2828
if(!(annotations.head.tpe <:< TypeRepr.of[Endpoint[_, _, _]])) {
29-
Reporting.error(s"Last annotation applied to a function must be an instance of Endpoint, " +
29+
report.error(s"Last annotation applied to a function must be an instance of Endpoint, " +
3030
s"not ${annotations.head.tpe.show}",
3131
annotations.head.pos
3232
)
3333
return '{???} // in this case, we can't continue expansion of this macro
3434
}
3535
val allEndpoints = annotations.filter(_.tpe <:< TypeRepr.of[Endpoint[_, _, _]])
3636
if(allEndpoints.length > 1) {
37-
Reporting.error(
37+
report.error(
3838
s"You can only apply one Endpoint annotation to a function, not " +
3939
s"${allEndpoints.length} in ${allEndpoints.map(_.tpe.show).mkString(", ")}",
4040
annotations.last.pos,
@@ -52,7 +52,7 @@ object RoutesEndpointsMetadata{
5252
'{
5353

5454
val entrypoint: EntryPoint[T, cask.Request] = ${
55-
Macros.extractMethod[T](
55+
Macros.extractMethod[T](using qctx)(
5656
m,
5757
decorators,
5858
endpoint

0 commit comments

Comments
 (0)