Skip to content

Commit 44c0122

Browse files
committed
Add Type annotations
1 parent 27b766b commit 44c0122

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/run-with-compiler-custom-args/staged-streams_1.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object Test {
4040
case class Linear[A](producer: Producer[A]) extends StagedStream[A]
4141
case class Nested[A, B](producer: Producer[B], nestedf: B => StagedStream[A]) extends StagedStream[A]
4242

43-
case class Stream[A](stream: StagedStream[Expr[A]]) {
43+
case class Stream[A: Type](stream: StagedStream[Expr[A]]) {
4444

4545
def fold[W: Type](z: Expr[W], f: ((Expr[W], Expr[A]) => Expr[W])): Expr[W] = {
4646
Var(z) { s: Var[W] => '{
@@ -101,7 +101,7 @@ object Test {
101101
* @tparam B the element type of the resulting stream
102102
* @return a new stream resulting from applying `f` in the `step` function of the input stream's producer.
103103
*/
104-
private def mapRaw[A, B](f: (A => (B => Expr[Unit]) => Expr[Unit]), stream: StagedStream[A]): StagedStream[B] = {
104+
private def mapRaw[A: Type, B: Type](f: (A => (B => Expr[Unit]) => Expr[Unit]), stream: StagedStream[A]): StagedStream[B] = {
105105
stream match {
106106
case Linear(producer) => {
107107
val prod = new Producer[B] {
@@ -194,7 +194,7 @@ object Test {
194194
* @return the stream with the new producer. If the passed stream was linear, the new termination is added
195195
* otherwise the new termination is propagated to all nested ones, recursively.
196196
*/
197-
private def addTerminationCondition[A](condition: Expr[Boolean] => Expr[Boolean], stream: StagedStream[A]): StagedStream[A] = {
197+
private def addTerminationCondition[A: Type](condition: Expr[Boolean] => Expr[Boolean], stream: StagedStream[A]): StagedStream[A] = {
198198
def addToProducer[A](f: Expr[Boolean] => Expr[Boolean], producer: Producer[A]): Producer[A] = {
199199
producer.card match {
200200
case Many =>
@@ -267,7 +267,7 @@ object Test {
267267
* @tparam A the type of the producer's elements.
268268
* @return a linear or nested stream aware of the variable reference to decrement.
269269
*/
270-
private def takeRaw[A](n: Expr[Int], stream: StagedStream[A]): StagedStream[A] = {
270+
private def takeRaw[A: Type](n: Expr[Int], stream: StagedStream[A]): StagedStream[A] = {
271271
stream match {
272272
case linear: Linear[A] => {
273273
val enhancedProducer: Producer[(Var[Int], A)] = addCounter[A](n, linear.producer)
@@ -298,7 +298,7 @@ object Test {
298298
/** A stream containing the first `n` elements of this stream. */
299299
def take(n: Expr[Int]): Stream[A] = Stream(takeRaw[Expr[A]](n, stream))
300300

301-
private def zipRaw[A, B](stream1: StagedStream[A], stream2: StagedStream[B]): StagedStream[(A, B)] = {
301+
private def zipRaw[A: Type, B: Type](stream1: StagedStream[A], stream2: StagedStream[B]): StagedStream[(A, B)] = {
302302
(stream1, stream2) match {
303303

304304
case (Linear(producer1), Linear(producer2)) =>
@@ -321,7 +321,7 @@ object Test {
321321
* @tparam A
322322
* @return
323323
*/
324-
private def makeLinear[A](stream: StagedStream[A]): StagedStream[A] = {
324+
private def makeLinear[A: Type](stream: StagedStream[A]): StagedStream[A] = {
325325
stream match {
326326
case Linear(producer) => stream
327327
case Nested(producer, nestedf) => {
@@ -406,7 +406,7 @@ object Test {
406406
}
407407
}
408408

409-
private def pushLinear[A, B, C](producer: Producer[A], nestedProducer: Producer[B], nestedf: (B => StagedStream[C])): StagedStream[(A, C)] = {
409+
private def pushLinear[A: Type, B, C: Type](producer: Producer[A], nestedProducer: Producer[B], nestedf: (B => StagedStream[C])): StagedStream[(A, C)] = {
410410
val newProducer = new Producer[(Var[Boolean], producer.St, B)] {
411411

412412
type St = (Var[Boolean], producer.St, nestedProducer.St)
@@ -440,7 +440,7 @@ object Test {
440440
})
441441
}
442442

443-
private def zip_producer[A, B](producer1: Producer[A], producer2: Producer[B]) = {
443+
private def zip_producer[A: Type, B: Type](producer1: Producer[A], producer2: Producer[B]) = {
444444
new Producer[(A, B)] {
445445

446446
type St = (producer1.St, producer2.St)

0 commit comments

Comments
 (0)