summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-10-15 11:04:43 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-10-17 13:49:50 +0200
commitfbbc767b7a001436185c631b9fb7e688dbdf3a6a (patch)
tree9a7c79e643594e1e1524502b6817e61cff976296 /test/files/pos
parent810ce7e2790e4da4e3f1d9473ccad5a721847096 (diff)
downloadscala-fbbc767b7a001436185c631b9fb7e688dbdf3a6a.tar.gz
scala-fbbc767b7a001436185c631b9fb7e688dbdf3a6a.tar.bz2
scala-fbbc767b7a001436185c631b9fb7e688dbdf3a6a.zip
SI-7688 Fix AsSeenFrom of ThisType from TypeVar prefix
Restores behaviour for the AsSeenFrom before the refactoring in b457b6c477. This commit uniformly considered that a `TypeVar` prefix should not `matchesPrefixAndClass`; a condition that formerly was only applied if the type being viewed was a `TypeRef`. This condition was originally added in cc9e8eda3364d as a backstop for pos/t2797.scala. This commit leaves that backstop in place where it was, although it expresses it more directly by checking if `pre baseType clazz` is `NoType`, which was the case that cropped up in SI-2797: scala> type T = bc._1.type forSome { val bc: (AnyRef, AnyRef) } warning: there were 1 feature warning(s); re-run with -feature for details defined type alias T scala> val et = typeOf[T].dealias.asInstanceOf[ExistentialType] et: $r.intp.global.ExistentialType = bc._1.type forSome { val bc: (AnyRef, AnyRef) } scala> et.withTypeVars( { x => | println(x.prefix.typeSymbol) | println(x.prefix.typeSymbol.isSubClass(typeOf[Tuple2[_, _]].typeSymbol)) | println(x.prefix.baseType(typeOf[Tuple2[_, _]].typeSymbol)) | true | } , reflect.internal.Depth(0)) type bc.type true <notype> res98: Boolean = true
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/t7688.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/pos/t7688.scala b/test/files/pos/t7688.scala
new file mode 100644
index 0000000000..5a846b97e9
--- /dev/null
+++ b/test/files/pos/t7688.scala
@@ -0,0 +1,7 @@
+import scala.reflect.macros._
+
+class A[C <: Context with Singleton](position: C#Position)
+
+object A {
+ def apply(c: Context)(in: c.Tree): A[c.type] = new A(in.pos)
+}