aboutsummaryrefslogtreecommitdiff
path: root/tests/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-08 14:01:29 +0100
committerMartin Odersky <odersky@gmail.com>2017-03-08 14:01:40 +0100
commitebc316272deb2e2c3cd00659af453d5ac6a9a6ee (patch)
tree348b5b601a530dba15595bc66817ddec39d31a5c /tests/pos
parent3c4d29eabaa71c30ccc2c7b62517d771d6f9d8f5 (diff)
downloaddotty-ebc316272deb2e2c3cd00659af453d5ac6a9a6ee.tar.gz
dotty-ebc316272deb2e2c3cd00659af453d5ac6a9a6ee.tar.bz2
dotty-ebc316272deb2e2c3cd00659af453d5ac6a9a6ee.zip
Fix #2064: Avoid illegal types in OrDominator
Need to skip type bounds in `underlying` chain, since TypeBounds is not a legal operand type for OrType.
Diffstat (limited to 'tests/pos')
-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
+}
+
+}