aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/i2064.scala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pos/i2064.scala')
-rw-r--r--tests/pos/i2064.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/pos/i2064.scala b/tests/pos/i2064.scala
new file mode 100644
index 000000000..909923372
--- /dev/null
+++ b/tests/pos/i2064.scala
@@ -0,0 +1,15 @@
+object p {
+
+class Foo[T] {
+ // Crashes:
+ def f(): Foo[T] = (if (true) this else this).bar
+
+ // Works:
+ // def f(): Foo[T] = new Bar(if (true) this else this).bar
+}
+
+implicit class Bar[A](val self: A) {
+ def bar(): A = self
+}
+
+}