Skip to content

Make subclasses of scala.quoted.Expr covariant #4896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions library/src/scala/quoted/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ object Expr {
*/
object Exprs {
/** An Expr backed by a pickled TASTY tree */
final class TastyExpr[T](val tasty: Pickled, val args: Seq[Any]) extends Expr[T] {
final class TastyExpr[+T](val tasty: Pickled, val args: Seq[Any]) extends Expr[T] {
override def toString: String = s"Expr(<pickled tasty>)"
}

/** An Expr backed by a lifted value.
* Values can only be of type Boolean, Byte, Short, Char, Int, Long, Float, Double, Unit, String or Null.
*/
final class LiftedExpr[T](val value: T) extends Expr[T] {
final class LiftedExpr[+T](val value: T) extends Expr[T] {
override def toString: String = s"Expr($value)"
}

Expand All @@ -54,7 +54,7 @@ object Exprs {
}

/** An Expr representing `'{(~f).apply(~x)}` but it is beta-reduced when the closure is known */
final class FunctionAppliedTo[T, U](val f: Expr[T => U], val x: Expr[T]) extends Expr[U] {
final class FunctionAppliedTo[T, +U](val f: Expr[T => U], val x: Expr[T]) extends Expr[U] {
override def toString: String = s"Expr($f <applied to> $x)"
}
}