Skip to content

Commit

Permalink
Handle type aliases in contextFunctionResultTypeAfter
Browse files Browse the repository at this point in the history
Closes #21433
  • Loading branch information
wjoel committed Sep 2, 2024
1 parent 5e83606 commit a3bcfd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ object ContextFunctionResults:
def contextFunctionResultTypeAfter(meth: Symbol, depth: Int)(using Context) =
def recur(tp: Type, n: Int): Type =
if n == 0 then tp
else tp match
else tp.dealias match
case defn.FunctionTypeOfMethod(mt) => recur(mt.resType, n - 1)
recur(meth.info.finalResultType, depth)

Expand Down
6 changes: 6 additions & 0 deletions tests/pos/i21433.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
trait A[T]:
type R = T ?=> Unit
def f: R = ()

class B extends A[Int]:
override def f: R = ()

0 comments on commit a3bcfd9

Please sign in to comment.