Skip to content

Commit d1bb8d3

Browse files
authored
Merge pull request #10988 from dotty-staging/fix-#10863
Fix #10863: Make show `AnyKind`ed
2 parents bcecfa5 + 17f396d commit d1bb8d3

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

library/src/scala/quoted/Type.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ end Type
1212
object Type:
1313

1414
/** Show a source code like representation of this type without syntax highlight */
15-
def show[T](using Type[T])(using Quotes): String =
15+
def show[T <: AnyKind](using Type[T])(using Quotes): String =
1616
import quotes.reflect._
1717
TypeTree.of[T].show
1818

tests/run-macros/i10863.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[A >: scala.Nothing <: scala.Any] => scala.collection.immutable.List[A]

tests/run-macros/i10863/Macro_1.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.quoted._
2+
3+
inline def showList: String =
4+
${ showListExpr }
5+
6+
private def showListExpr[T: Type](using Quotes): Expr[String] =
7+
Expr(Type.show[List])

tests/run-macros/i10863/Test_2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@main def Test =
2+
println(showList)

0 commit comments

Comments
 (0)