Skip to content

Commit 6440993

Browse files
wjoeltgodzik
authored andcommitted
Handle type aliases in contextFunctionResultTypeAfter (scala#21517)
Closes scala#21433
1 parent 1a9e6e4 commit 6440993

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/transform/ContextFunctionResults.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ object ContextFunctionResults:
104104
def contextFunctionResultTypeAfter(meth: Symbol, depth: Int)(using Context) =
105105
def recur(tp: Type, n: Int): Type =
106106
if n == 0 then tp
107-
else tp match
107+
else tp.dealias match
108108
case defn.ContextFunctionType(_, resTpe) => recur(resTpe, n - 1)
109109
recur(meth.info.finalResultType, depth)
110110

tests/pos/i21433.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
trait A[T]:
2+
type R = T ?=> Unit
3+
def f: R = ()
4+
5+
class B extends A[Int]:
6+
override def f: R = ()

0 commit comments

Comments
 (0)