From ebc316272deb2e2c3cd00659af453d5ac6a9a6ee Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 8 Mar 2017 14:01:29 +0100 Subject: 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. --- tests/pos/i2064.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/pos/i2064.scala (limited to 'tests/pos') 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 +} + +} -- cgit v1.2.3