Skip to content

Commit 366ae80

Browse files
Merge pull request #7587 from dotty-staging/fix-tasty-reflect-isInstanceOf-type
Fix TASTy Reflect IsInstanceOf[Type]
2 parents f41acb1 + 25d5c9a commit 366ae80

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

library/src/scala/tasty/reflect/SourceCodePrinter.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
10551055
printType(lo)
10561056
this += " <: "
10571057
printType(hi)
1058-
case IsType(tpe) => printType(tpe)
1058+
case tpe: Type => printType(tpe)
10591059
}
10601060

10611061
/** Print type
@@ -1089,7 +1089,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
10891089
this += "#"
10901090
case ThisType(TermRef(cdef, _)) if elideThis.nonEmpty && cdef == elideThis.get =>
10911091
case ThisType(TypeRef(cdef, _)) if elideThis.nonEmpty && cdef == elideThis.get =>
1092-
case IsType(prefix) =>
1092+
case prefix: Type =>
10931093
printType(prefix)
10941094
this += "."
10951095
}
@@ -1266,7 +1266,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
12661266
case ByNameType(t) =>
12671267
this += ": "
12681268
printType(t)
1269-
case IsType(tp) =>
1269+
case tp: Type =>
12701270
this += ": "
12711271
printType(tp)
12721272
}
@@ -1282,7 +1282,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
12821282
case ByNameType(_) | MethodType(_, _, _) | TypeLambda(_, _, _) =>
12831283
this += highlightKeyword("def ") += highlightTypeDef(name)
12841284
printMethodicType(info)
1285-
case IsType(info) =>
1285+
case info: Type =>
12861286
this += highlightKeyword("val ") += highlightValDef(name)
12871287
printMethodicType(info)
12881288
}
@@ -1298,7 +1298,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
12981298
def printMethodicTypeParams(paramNames: List[String], params: List[TypeOrBounds])(given elideThis: Option[Symbol]): Unit = {
12991299
def printInfo(info: TypeOrBounds) = info match {
13001300
case info: TypeBounds => printBounds(info)
1301-
case IsType(info) =>
1301+
case info: Type =>
13021302
this += ": "
13031303
printType(info)
13041304
}
@@ -1444,8 +1444,8 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
14441444

14451445
object Sequence {
14461446
def unapply(tpe: Type)(given ctx: Context): Option[Type] = tpe match {
1447-
case AppliedType(TypeRef(prefix: TermRef, "Seq"), IsType(tp) :: Nil) if prefix.termSymbol.fullName == "scala.collection" => Some(tp)
1448-
case AppliedType(TypeRef(prefix: TypeRef, "Seq"), IsType(tp) :: Nil) if prefix.typeSymbol.fullName == "scala.collection" => Some(tp)
1447+
case AppliedType(TypeRef(prefix: TermRef, "Seq"), (tp: Type) :: Nil) if prefix.termSymbol.fullName == "scala.collection" => Some(tp)
1448+
case AppliedType(TypeRef(prefix: TypeRef, "Seq"), (tp: Type) :: Nil) if prefix.typeSymbol.fullName == "scala.collection" => Some(tp)
14491449
case _ => None
14501450
}
14511451
}
@@ -1460,7 +1460,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
14601460

14611461
object Repeated {
14621462
def unapply(tpe: Type)(given ctx: Context): Option[Type] = tpe match {
1463-
case AppliedType(TypeRef(ScalaPackage(), "<repeated>"), IsType(tp) :: Nil) => Some(tp)
1463+
case AppliedType(TypeRef(ScalaPackage(), "<repeated>"), (tp: Type) :: Nil) => Some(tp)
14641464
case _ => None
14651465
}
14661466
}

library/src/scala/tasty/reflect/TypeOrBoundsOps.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,11 @@ trait TypeOrBoundsOps extends Core {
6363
def isDependentFunctionType(given ctx: Context): Boolean = internal.Type_isDependentFunctionType(self)
6464
}
6565

66-
// FIXME: needs #7532 fixed in the reference compiler
67-
// given (given Context): IsInstanceOf[Type] = internal.isInstanceOfType
66+
given (given Context): IsInstanceOf[Type] = internal.isInstanceOfType
6867

6968
object IsType
70-
// FIXME: Add depecation. Needs #7532 fixed in the reference compiler
71-
// @deprecated("Use _: Type", "")
72-
def unapply(x: TypeOrBounds)(given ctx: Context): Option[Type] =
69+
@deprecated("Use _: Type", "")
70+
def unapply(x: Type)(given ctx: Context): Option[Type] =
7371
internal.isInstanceOfType.unapply(x)
7472

7573
object Type {

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ object MyScalaJSPlugin extends AutoPlugin {
5858
}
5959

6060
object Build {
61-
val referenceVersion = "0.20.0-RC1"
61+
val referenceVersion = "0.21.0-bin-20191119-7c7fffa-NIGHTLY"
6262

6363
val baseVersion = "0.21.0"
6464
val baseSbtDottyVersion = "0.3.5"

tests/run-macros/tasty-simplified/quoted_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object Macros {
1111
def unpackTuple(tp: Type): List[Type] = {
1212
@tailrec
1313
def loop(tp: Type, acc: List[Type]): List[Type] = tp.dealias.simplified match {
14-
case AppliedType(_, List(IsType(hd), IsType(tl))) =>
14+
case AppliedType(_, List(hd: Type, tl: Type)) =>
1515
loop(tl, hd.dealias.simplified :: acc)
1616
case other => acc
1717
}

0 commit comments

Comments
 (0)