Skip to content

Commit

Permalink
Merge pull request #10988 from dotty-staging/fix-#10863
Browse files Browse the repository at this point in the history
Fix #10863: Make show `AnyKind`ed
  • Loading branch information
liufengyun committed Jan 4, 2021
2 parents bcecfa5 + 17f396d commit d1bb8d3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/src/scala/quoted/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end Type
object Type:

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

Expand Down
1 change: 1 addition & 0 deletions tests/run-macros/i10863.check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[A >: scala.Nothing <: scala.Any] => scala.collection.immutable.List[A]
7 changes: 7 additions & 0 deletions tests/run-macros/i10863/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import scala.quoted._

inline def showList: String =
${ showListExpr }

private def showListExpr[T: Type](using Quotes): Expr[String] =
Expr(Type.show[List])
2 changes: 2 additions & 0 deletions tests/run-macros/i10863/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@main def Test =
println(showList)

0 comments on commit d1bb8d3

Please sign in to comment.