Skip to content

Commit 1e520b8

Browse files
authored
Fix #20206 (#20210)
Fixes #20206
2 parents 093a50d + e673dd2 commit 1e520b8

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package transform
44

55
import core.*
66
import Contexts.*, Symbols.*, Types.*, Annotations.*, Constants.*, Phases.*
7+
import Decorators.*
78
import StdNames.nme
89
import ast.untpd
910
import ast.tpd.*
@@ -115,11 +116,9 @@ object ContextFunctionResults:
115116
else tree match
116117
case Select(qual, name) =>
117118
if name == nme.apply then
118-
qual.tpe.nn.dealias match
119+
qual.tpe.nn.widenDealias match
119120
case defn.FunctionTypeOfMethod(mt) if mt.isContextualMethod =>
120121
integrateSelect(qual, n + 1)
121-
case _ if defn.isContextFunctionClass(tree.symbol.maybeOwner) => // for TermRefs
122-
integrateSelect(qual, n + 1)
123122
case _ =>
124123
n > 0 && contextResultCount(tree.symbol) >= n
125124
else

tests/pos/i20206.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//> using options -experimental -Yno-experimental
2+
3+
import language.experimental.erasedDefinitions
4+
5+
erased trait A
6+
trait B
7+
8+
def foo1: A ?=> B ?=> Nothing = ???
9+
def foo2: (A, B) ?=> Nothing = ???
10+
def foo3: (B, A) ?=> Nothing = ???
11+
12+
def bar: (A, B) ?=> Nothing =
13+
foo1
14+
foo2
15+
foo3

0 commit comments

Comments
 (0)