Skip to content

Commit dec41d1

Browse files
committed
Fix #4380: Revert optimization that breaks owners
Implementation for optimization bf13d5b needs to be revisited.
1 parent ab58c2d commit dec41d1

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tests/pos/i4380a.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import scala.quoted._
2+
3+
object Test {
4+
5+
trait Producer[A] { self =>
6+
def step(k: (A => Expr[Unit])): Expr[Unit]
7+
}
8+
9+
trait Foo[A]
10+
case class Bar[A, B](producer: Producer[B], nestedf: B => Expr[Unit]) extends Foo[A]
11+
12+
def meth[A](stream: Foo[Expr[A]]): Producer[Expr[A]] = {
13+
stream match {
14+
case Bar(producer, nestedf) => {
15+
new Producer[Expr[A]] {
16+
def step(k: Expr[A] => Expr[Unit]): Expr[Unit] = '{
17+
val adv: Unit => Unit = { _ => ~producer.step((el) => nestedf(el))}
18+
}
19+
}
20+
}
21+
}
22+
}
23+
}

tests/pos/i4380b.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import scala.quoted._
2+
3+
object Test {
4+
def step(k: (String => Expr[Unit])): Expr[Unit] = '()
5+
def meth(): Unit = '{
6+
(i: Int) => ~step(el => '() )
7+
}
8+
}

0 commit comments

Comments
 (0)