summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-02-01 17:32:11 -0800
committerPaul Phillips <paulp@improving.org>2013-02-01 17:38:14 -0800
commit08aed64c0b88aecfb88e8e8024582b278d29f39a (patch)
tree20f2335ffd22d7d84ff3b858f4b23d49030e603e /test/files/pos
parent5b4a6bf82be1444bd9c5616eaff45dc3a59f22c8 (diff)
parentccd7abe897ab23056e6bf66f02c279647dfe3a57 (diff)
downloadscala-08aed64c0b88aecfb88e8e8024582b278d29f39a.tar.gz
scala-08aed64c0b88aecfb88e8e8024582b278d29f39a.tar.bz2
scala-08aed64c0b88aecfb88e8e8024582b278d29f39a.zip
Merge commit 'ccd7abe897' into wip/fresh-merge2
Conflicts: src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/t6516.scala19
-rw-r--r--test/files/pos/t6651.scala33
2 files changed, 52 insertions, 0 deletions
diff --git a/test/files/pos/t6516.scala b/test/files/pos/t6516.scala
new file mode 100644
index 0000000000..c004055de2
--- /dev/null
+++ b/test/files/pos/t6516.scala
@@ -0,0 +1,19 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+import scala.collection.TraversableLike
+
+// This one compiles
+object Test {
+ type Alias[T, CC[_]] = Context { type PrefixType = TraversableLike[T, CC[T]] }
+ def f() = macro f_impl
+ def f_impl(c: Alias[Int, List])() = ???
+}
+
+// This one doesn't
+object Test2 {
+ type Ctx = scala.reflect.macros.Context
+ type Alias[T, CC[_]] = Ctx { type PrefixType = TraversableLike[T, CC[T]] }
+
+ def f() = macro f_impl
+ def f_impl(c: Alias[Int, List])() = ???
+}
diff --git a/test/files/pos/t6651.scala b/test/files/pos/t6651.scala
new file mode 100644
index 0000000000..55a3b74e4c
--- /dev/null
+++ b/test/files/pos/t6651.scala
@@ -0,0 +1,33 @@
+class YouAreYourself[A <: AnyRef](val you: A) extends AnyVal {
+ def yourself: you.type = you
+}
+
+object Test {
+ val s = ""
+ val s1: s.type = new YouAreYourself[s.type](s).yourself
+}
+
+trait Path {
+ type Dep <: AnyRef
+}
+
+final class ValueClass[P <: Path](val path: P) extends AnyVal {
+ import path.Dep
+
+ def apply(dep: Dep)(d2: dep.type, foo: Int): (Dep, d2.type) = (d2, d2)
+
+ // This generates dodgy code; note `ValueClass.this`:
+ //
+ // final def bounds$extension[D >: Nothing <: ValueClass.this.path.Dep,
+ // P >: Nothing <: Path]
+ // ($this: ValueClass[P])
+ // (dep: D)
+ // (d2: dep.type, foo: Int): (D, d2.type) = scala.Tuple2.apply[D, d2.type](d2, d2);
+ //
+ // Nothing crashes down the line, but it certainly doesn't conform to best-practices.
+ //
+ // An better alternative would be to add a type parameter for the (singleton) type of
+ // the wrapped value.
+ def bounds[D <: Dep](dep: D)(d2: dep.type, foo: Int): (D, d2.type) = (d2, d2)
+}
+