We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3c4d29e commit ebc3162Copy full SHA for ebc3162
compiler/src/dotty/tools/dotc/core/TypeOps.scala
@@ -239,7 +239,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
239
case tp1: RecType =>
240
tp1.rebind(approximateOr(tp1.parent, tp2))
241
case tp1: TypeProxy if !isClassRef(tp1) =>
242
- orDominator(tp1.superType | tp2)
+ orDominator(tp1.superType.bounds.hi | tp2)
243
case _ =>
244
tp2 match {
245
case tp2: RecType =>
tests/pos/i2064.scala
@@ -0,0 +1,15 @@
1
+object p {
2
+
3
+class Foo[T] {
4
+ // Crashes:
5
+ def f(): Foo[T] = (if (true) this else this).bar
6
7
+ // Works:
8
+ // def f(): Foo[T] = new Bar(if (true) this else this).bar
9
+}
10
11
+implicit class Bar[A](val self: A) {
12
+ def bar(): A = self
13
14
15
0 commit comments