Skip to content

Commit 775f9ce

Browse files
authored
Merge pull request #15742 from dotty-staging/fix-15738
2 parents 718576c + b5bcb30 commit 775f9ce

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3730,16 +3730,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
37303730
missingArgs(wtp)
37313731
}
37323732

3733-
def isContextFunctionRef(wtp: Type): Boolean = wtp match {
3734-
case RefinedType(parent, nme.apply, _) =>
3735-
isContextFunctionRef(parent) // apply refinements indicate a dependent CFT
3736-
case _ =>
3737-
val underlying = wtp.underlyingClassRef(refinementOK = false) // other refinements are not OK
3738-
defn.isContextFunctionClass(underlying.classSymbol)
3739-
}
3740-
37413733
def adaptNoArgsOther(wtp: Type, functionExpected: Boolean): Tree = {
3742-
val implicitFun = isContextFunctionRef(wtp) && !untpd.isContextualClosure(tree)
3734+
val implicitFun = defn.isContextFunctionType(wtp) && !untpd.isContextualClosure(tree)
37433735
def caseCompanion =
37443736
functionExpected &&
37453737
tree.symbol.is(Module) &&

tests/pos/i15738.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
object Test {
2+
trait Transaction
3+
type Transactional[T] = (t: Transaction) ?=> T
4+
5+
def ff(x: Int): Transactional[Int] = {
6+
summon[Transaction]
7+
x
8+
}
9+
10+
def fff(x: Int): Transactional[Int] = {
11+
summon[Transaction]
12+
val x1 = ff(x)
13+
x1
14+
}
15+
16+
}

0 commit comments

Comments
 (0)