Skip to content

Commit be72554

Browse files
committed
Fix some type applies not being mapped to proxies correctly
1 parent e806cab commit be72554

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

compiler/src/dotty/tools/dotc/inlines/Inliner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ class Inliner(val call: tpd.Tree)(using Context):
570570
// LambdaTypeTree parameters also have the inlineMethod as owner. C.f. i13460.scala.
571571
&& !paramProxy.contains(tpe) =>
572572
paramBinding.get(tpe.name) match
573-
case Some(bound) => paramProxy(tpe) = bound
573+
case Some(bound) => paramProxy(tpe) = mapOpaques.typeMap(bound)
574574
case _ => // can happen for params bound by type-lambda trees.
575575

576576
// The widened type may contain param types too (see tests/pos/i12379a.scala)

tests/pos/i22974c.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
object other:
2+
sealed abstract class Absent
3+
case object Absent extends Absent
4+
case class PresentAbsent(val depth: Int)
5+
opaque type Present[+A] = A | PresentAbsent
6+
opaque type Maybe[+A] >: (Absent | Present[A]) = Absent | Present[A]
7+
8+
extension [A](self: Maybe[A]) {
9+
inline def flatten[B]: Maybe[B] = if self.isEmpty then Absent else ???
10+
def isEmpty: Boolean = self.isInstanceOf[Absent]
11+
}
12+
13+
class Test {
14+
def main(): Unit =
15+
import other.Maybe
16+
val res: Maybe[Maybe[Int]] = ???
17+
res.flatten
18+
}

0 commit comments

Comments
 (0)