Skip to content

Commit c33cb51

Browse files
committed
Fix rebase errors
1 parent b60d505 commit c33cb51

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

library/src-bootstrapped/scala/tasty/reflect/utils/TreeUtils.scala

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,17 @@ trait TreeUtils {
99
import reflect._
1010

1111
/** Bind the `rhs` to a `val` and use it in `body` */
12-
def let(rhs: Term)(bodyType: Type)(body: Term.Ident => Term): Term = {
13-
// Recover all lost type information
12+
def let(rhs: Term)(body: Term.Ident => Term): Term = {
1413
type T // TODO probably it is better to use the Sealed contruct rather than let the user create their own existential type
15-
type U // TODO probably it is better to use the Sealed contruct rather than let the user create their own existential type
16-
implicit val bodyTpe: quoted.Type[U] = bodyType.seal.asInstanceOf[quoted.Type[U]]
1714
implicit val rhsTpe: quoted.Type[T] = rhs.tpe.seal.asInstanceOf[quoted.Type[T]]
1815
val rhsExpr = rhs.seal[T]
19-
20-
let[T, U](rhsExpr) { x =>
21-
val id = ('(x)).unseal.asInstanceOf[Term.Ident]
22-
id.withPos(rhs.pos)
23-
body(id).seal[U]
24-
}.unseal
25-
}
26-
27-
private def let[T: quoted.Type, U: quoted.Type](rhs: Expr[T])(in: Expr[T] => Expr[U]): Expr[U] = '{
28-
val x = ~rhs
29-
~in('(x))
16+
val expr = '{
17+
val x = ~rhsExpr
18+
~{
19+
val id = ('(x)).unseal.asInstanceOf[Term.Ident]
20+
body(id).seal[Any]
21+
}
22+
}
23+
expr.unseal
3024
}
3125
}

0 commit comments

Comments
 (0)