diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 1960eb69269a..a6af5395d3f8 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -3704,16 +3704,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer missingArgs(wtp) } - def isContextFunctionRef(wtp: Type): Boolean = wtp match { - case RefinedType(parent, nme.apply, _) => - isContextFunctionRef(parent) // apply refinements indicate a dependent CFT - case _ => - val underlying = wtp.underlyingClassRef(refinementOK = false) // other refinements are not OK - defn.isContextFunctionClass(underlying.classSymbol) - } - def adaptNoArgsOther(wtp: Type, functionExpected: Boolean): Tree = { - val implicitFun = isContextFunctionRef(wtp) && !untpd.isContextualClosure(tree) + val implicitFun = defn.isContextFunctionType(wtp) && !untpd.isContextualClosure(tree) def caseCompanion = functionExpected && tree.symbol.is(Module) && diff --git a/tests/pos/i15738.scala b/tests/pos/i15738.scala new file mode 100644 index 000000000000..1cc2bb5a9e15 --- /dev/null +++ b/tests/pos/i15738.scala @@ -0,0 +1,16 @@ +object Test { + trait Transaction + type Transactional[T] = (t: Transaction) ?=> T + + def ff(x: Int): Transactional[Int] = { + summon[Transaction] + x + } + + def fff(x: Int): Transactional[Int] = { + summon[Transaction] + val x1 = ff(x) + x1 + } + +} \ No newline at end of file