Skip to content

Commit 590691b

Browse files
authored
Handle type aliases in contextFunctionResultTypeAfter (#21517)
Closes #21433
1 parent b908d81 commit 590691b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ object ContextFunctionResults:
101101
def contextFunctionResultTypeAfter(meth: Symbol, depth: Int)(using Context) =
102102
def recur(tp: Type, n: Int): Type =
103103
if n == 0 then tp
104-
else tp match
104+
else tp.dealias match
105105
case defn.FunctionTypeOfMethod(mt) => recur(mt.resType, n - 1)
106106
recur(meth.info.finalResultType, depth)
107107

tests/pos/i21433.scala

+6
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)