Skip to content

Commit 36c9541

Browse files
committed
addopted to dotty 3.1.0, dotty-cps-async 0.9.4
1 parent af1a492 commit 36c9541

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//val dottyVersion = "3.0.0-RC2-bin-SNAPSHOT"
2-
val dottyVersion = "3.1.0-RC2"
2+
val dottyVersion = "3.1.0"
33
//val dottyVersion = dottyLatestNightlyBuild.get
44

55
ThisBuild/version := "2.1.1-SNAPSHOT"
@@ -10,7 +10,7 @@ val sharedSettings = Seq(
1010
scalaVersion := dottyVersion,
1111
name := "scala-gopher",
1212
resolvers += "Local Ivy Repository" at "file://"+Path.userHome.absolutePath+"/.ivy2/local",
13-
libraryDependencies += "com.github.rssh" %%% "dotty-cps-async" % "0.9.3",
13+
libraryDependencies += "com.github.rssh" %%% "dotty-cps-async" % "0.9.4",
1414
libraryDependencies += "org.scalameta" %%% "munit" % "0.7.27" % Test,
1515
)
1616

jvm/src/main/scala/gopher/impl/GuardedSPSCBufferedChannel.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package gopher.impl
22

3-
import cps._
4-
import gopher._
3+
import cps.*
4+
import gopher.*
55
import java.util.concurrent.ExecutorService
66
import java.util.concurrent.atomic.AtomicReferenceArray
77
import java.util.concurrent.atomic.AtomicInteger

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.2")
22
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
33
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
44
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
5-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0")
6-
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.0")
5+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1")
6+
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1")

shared/src/main/scala/gopher/SelectMacro.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import cps._
66
import scala.quoted._
77
import scala.compiletime._
88
import scala.concurrent.duration._
9+
import scala.util.control.NonFatal
910

1011

1112

@@ -194,7 +195,13 @@ object SelectMacro:
194195
else
195196
reportError("Incorrect select pattern, expected or x:channel.{read,write} or Channel.{Read,Write}",chObj.asExpr)
196197

197-
198+
def safeShow(t:Tree): String =
199+
try
200+
t.show
201+
catch
202+
case NonFatal(ex) =>
203+
ex.printStackTrace()
204+
s"(exception durign show:${ex.getMessage()})"
198205

199206
caseDef.pattern match
200207
case Inlined(_,List(),body) =>
@@ -232,7 +239,7 @@ object SelectMacro:
232239
"unapply"),targs),
233240
impl,List(b@Bind(e,ePat),Bind(ch,chPat))) =>
234241
handleUnapply(chObj, nameReadOrWrite, b, e, ePat, ch)
235-
case pat@Typed(Unapply(TypeApply(quotes.reflect.Select(
242+
case pat@TypedOrTest(Unapply(TypeApply(quotes.reflect.Select(
236243
quotes.reflect.Select(chobj,nameReadOrWrite),
237244
"unapply"),targs),
238245
impl,List(b@Bind(e,ePat),Bind(ch,chPat))),a) =>
@@ -245,7 +252,7 @@ object SelectMacro:
245252
v: channel.write if v == expr
246253
v: Time.after if v == expr
247254
we have
248-
${caseDef.pattern.show}
255+
${safeShow(caseDef.pattern)}
249256
(tree: ${caseDef.pattern})
250257
""", caseDef.pattern.asExpr)
251258
reportError(s"unparsed caseDef pattern: ${caseDef.pattern}", caseDef.pattern.asExpr)

0 commit comments

Comments
 (0)