Skip to content

Commit a186165

Browse files
authored
Merge pull request #6616 from dotty-staging/workaround-scala-2-package-import-limitation
Workaround Scala 2 package import limitation
2 parents 06c73c1 + 0d64b5d commit a186165

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

library/src-2.x/scala/quoted/Expr.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@ package quoted {
1717
package internal {
1818
package quoted {
1919

20-
import scala.quoted._
21-
2220
/** An Expr backed by a pickled TASTY tree */
23-
final class TastyExpr[+T](val tasty: scala.runtime.quoted.Unpickler.Pickled, val args: Seq[Any]) extends Expr[T] {
21+
final class TastyExpr[+T](val tasty: scala.runtime.quoted.Unpickler.Pickled, val args: Seq[Any]) extends scala.quoted.Expr[T] {
2422
override def toString: String = s"Expr(<pickled tasty>)"
2523
}
2624

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

@@ -38,15 +36,15 @@ package internal {
3836
*
3937
* May contain references to code defined outside this TastyTreeExpr instance.
4038
*/
41-
final class TastyTreeExpr[Tree](val tree: Tree) extends quoted.Expr[Any] {
39+
final class TastyTreeExpr[Tree](val tree: Tree) extends scala.quoted.Expr[Any] {
4240
override def toString: String = s"Expr(<tasty tree>)"
4341
}
4442

4543
// TODO Use a List in FunctionAppliedTo(val f: Expr[_], val args: List[Expr[_]])
4644
// FIXME: Having the List in the code above trigers an assertion error while testing dotty.tools.dotc.reporting.ErrorMessagesTests.i3187
4745
// This test does redefine `scala.collection`. Further investigation is needed.
4846
/** An Expr representing `'{($f).apply($x1, ..., $xn)}` but it is beta-reduced when the closure is known */
49-
final class FunctionAppliedTo[+R](val f: Expr[_], val args: Array[Expr[_]]) extends Expr[R] {
47+
final class FunctionAppliedTo[+R](val f: scala.quoted.Expr[_], val args: Array[scala.quoted.Expr[_]]) extends scala.quoted.Expr[R] {
5048
override def toString: String = s"Expr($f <applied to> ${args.toList})"
5149
}
5250

library/src-2.x/scala/quoted/Type.scala

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,36 @@ package quoted {
1515
def show(implicit toolbox: Toolbox): String = toolbox.show(tpe.asInstanceOf[Type[Any]])
1616
}
1717

18-
implicit def UnitTag: Type[Unit] = new TaggedType[Unit]
19-
implicit def BooleanTag: Type[Boolean] = new TaggedType[Boolean]
20-
implicit def ByteTag: Type[Byte] = new TaggedType[Byte]
21-
implicit def CharTag: Type[Char] = new TaggedType[Char]
22-
implicit def ShortTag: Type[Short] = new TaggedType[Short]
23-
implicit def IntTag: Type[Int] = new TaggedType[Int]
24-
implicit def LongTag: Type[Long] = new TaggedType[Long]
25-
implicit def FloatTag: Type[Float] = new TaggedType[Float]
26-
implicit def DoubleTag: Type[Double] = new TaggedType[Double]
18+
implicit def UnitTag: Type[Unit] = new scala.internal.quoted.TaggedType[Unit]
19+
implicit def BooleanTag: Type[Boolean] = new scala.internal.quoted.TaggedType[Boolean]
20+
implicit def ByteTag: Type[Byte] = new scala.internal.quoted.TaggedType[Byte]
21+
implicit def CharTag: Type[Char] = new scala.internal.quoted.TaggedType[Char]
22+
implicit def ShortTag: Type[Short] = new scala.internal.quoted.TaggedType[Short]
23+
implicit def IntTag: Type[Int] = new scala.internal.quoted.TaggedType[Int]
24+
implicit def LongTag: Type[Long] = new scala.internal.quoted.TaggedType[Long]
25+
implicit def FloatTag: Type[Float] = new scala.internal.quoted.TaggedType[Float]
26+
implicit def DoubleTag: Type[Double] = new scala.internal.quoted.TaggedType[Double]
2727
}
2828

2929
}
3030

3131
package internal {
3232
package quoted {
33-
import scala.quote.Type
3433
import scala.reflect.ClassTag
3534
import scala.runtime.quoted.Unpickler.Pickled
3635

3736
/** A Type backed by a pickled TASTY tree */
38-
final class TastyType[T](val tasty: Pickled, val args: Seq[Any]) extends Type[T] {
37+
final class TastyType[T](val tasty: Pickled, val args: Seq[Any]) extends scala.quoted.Type[T] {
3938
override def toString(): String = s"Type(<pickled tasty>)"
4039
}
4140

4241
/** An Type backed by a value */
43-
final class TaggedType[T](implicit val ct: ClassTag[T]) extends Type[T] {
42+
final class TaggedType[T](implicit val ct: ClassTag[T]) extends scala.quoted.Type[T] {
4443
override def toString: String = s"Type($ct)"
4544
}
4645

4746
/** An Type backed by a tree */
48-
final class TreeType[Tree](val typeTree: Tree) extends quoted.Type[Any] {
47+
final class TreeType[Tree](val typeTree: Tree) extends scala.quoted.Type[Any] {
4948
override def toString: String = s"Type(<tasty tree>)"
5049
}
5150

0 commit comments

Comments
 (0)