Skip to content

Commit

Permalink
fix 3.5.0 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rssh committed Sep 7, 2024
1 parent 55a6875 commit f08dac1
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 91 deletions.
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val dottyVersion = "3.3.3"
val dottyVersion = "3.5.0"

import scala.scalanative.build._

Expand All @@ -12,7 +12,7 @@ ThisBuild/resolvers ++= Opts.resolver.sonatypeOssSnapshots
val sharedSettings = Seq(
organization := "com.github.rssh",
scalaVersion := dottyVersion,
name := "dotty-cps-async-for34"
name := "dotty-cps-async"
)


Expand Down Expand Up @@ -44,7 +44,7 @@ lazy val cps = crossProject(JSPlatform, JVMPlatform, NativePlatform)
scalacOptions ++= Seq( //"-Yexplicit-nulls",
"-unchecked", "-Ydebug-trace", "-Ydebug-names", "-Xprint-types",
"-Ydebug", "-uniqid", "-Xcheck-macros", "-Ycheck:macro", "-Yprint-syms",
"-Ysafe-init",
"-Wsafe-init",
),
// -explain
// -Ydebug-error
Expand Down
9 changes: 4 additions & 5 deletions js/src/main/scala/cps/stream/AsyncList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ sealed trait AsyncList[F[_]:CpsConcurrentMonad, +T]:
def takeAll[CC[_]](n:Int)(using Factory[T,CC[T]@uncheckedVariance]):F[CC[T]@uncheckedVariance] =
take[CC](-1)

//@infix
def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S]
infix def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S]

/**
* alias for merge
Expand Down Expand Up @@ -146,7 +145,7 @@ object AsyncList {
else
summon[CpsMonad[F]].flatMap(fs)(_.takeTo(buffer,n))

def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S] =
infix def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S] =
other match
case Wait(fs1) =>
val fs1cast = fs1.asInstanceOf[F[AsyncList[F,S]]]
Expand Down Expand Up @@ -268,7 +267,7 @@ object AsyncList {
}
next.takeTo(buffer, nRest)

def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S] =
infix def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S] =
Cons(head, ()=>other.merge(tailFun()))

def skip(n:Int): AsyncList[F,T] =
Expand Down Expand Up @@ -315,7 +314,7 @@ object AsyncList {
def takeTo[B <: Growable[Nothing]](buffer: B, n: Int):F[B] =
summon[CpsMonad[F]].pure(buffer)

def merge[S](other: AsyncList[F,S]): AsyncList[F,S] =
infix def merge[S](other: AsyncList[F,S]): AsyncList[F,S] =
other

def skip(n:Int): AsyncList[F,Nothing] = this
Expand Down
12 changes: 5 additions & 7 deletions jvm/src/main/scala/cps/stream/AsyncList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,15 @@ sealed trait AsyncList[F[_]:CpsConcurrentMonad, +T]:
def takeAll[CC[_]](n:Int)(using Factory[T,CC[T]@uncheckedVariance]):F[CC[T]@uncheckedVariance] =
take[CC](-1)

//@infix
def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S]
infix def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S]

/**
* alias for merge
* @param other
* @tparam S
* @return
*/
//@infix
def ><[S >: T](other: AsyncList[F,S]): AsyncList[F,S] = merge(other)
infix def ><[S >: T](other: AsyncList[F,S]): AsyncList[F,S] = merge(other)

def skip(n:Int): AsyncList[F,T]

Expand Down Expand Up @@ -146,7 +144,7 @@ object AsyncList {
else
summon[CpsMonad[F]].flatMap(fs)(_.takeTo(buffer,n))

def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S] =
infix def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S] =
other match
case Wait(fs1) =>
val fs1cast = fs1.asInstanceOf[F[AsyncList[F,S]]]
Expand Down Expand Up @@ -270,7 +268,7 @@ object AsyncList {
}
next.takeTo(buffer, nRest)

def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S] =
infix def merge[S >: T](other: AsyncList[F,S]): AsyncList[F,S] =
Cons(head, ()=>other.merge(tailFun()))

def skip(n:Int): AsyncList[F,T] =
Expand Down Expand Up @@ -317,7 +315,7 @@ object AsyncList {
def takeTo[B <: Growable[Nothing]](buffer: B, n: Int):F[B] =
summon[CpsMonad[F]].pure(buffer)

def merge[S](other: AsyncList[F,S]): AsyncList[F,S] =
infix def merge[S](other: AsyncList[F,S]): AsyncList[F,S] =
other

def skip(n:Int): AsyncList[F,Nothing] = this
Expand Down
8 changes: 4 additions & 4 deletions jvm/src/test/scala/cps/ComputationBound.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ object ComputationBound {
externalAsyncNotifier.notify()
}
} )
Wait(ref, fromTry[A] _ )
Wait(ref, fromTry[A] )
}

def spawn[A](op: =>ComputationBound[A]):ComputationBound[A] = {
val ref = new AtomicReference[Option[Try[A]]](None)
val waiter = Wait[A,A](ref, fromTry[A] _ )
val waiter = Wait[A,A](ref, fromTry[A] )
deferredQueue.add(Deferred(ref, Some(Thunk( () => op )) ))
waiter
}
Expand Down Expand Up @@ -442,10 +442,10 @@ case class Wait[R,T](ref: AtomicReference[Option[Try[R]]], op: Try[R] => Computa


override def flatMap[S](f: T => ComputationBound[S]): ComputationBound[S] =
Wait(ref, x => op(x) flatMap f)
Wait(ref, x => op(x) `flatMap` f)

override def flatMapTry[S](f: Try[T] => ComputationBound[S]): ComputationBound[S] =
Wait(ref, x => ComputationBound.tryOp(op(x)) flatMapTry f)
Wait(ref, x => ComputationBound.tryOp(op(x)) `flatMapTry` f)


override def map[S](f: T=>S): ComputationBound[S] =
Expand Down
Loading

0 comments on commit f08dac1

Please sign in to comment.