Skip to content

Commit 882b435

Browse files
committed
Look for synthetic applies also under type applications
Fixes #15567
1 parent 6062192 commit 882b435

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ object Typer {
103103
*/
104104
private[typer] def isSyntheticApply(tree: tpd.Tree): Boolean = tree match {
105105
case tree: tpd.Select => tree.hasAttachment(InsertedApply)
106+
case TypeApply(fn, _) => isSyntheticApply(fn)
106107
case _ => false
107108
}
108109

tests/neg/i15567.scala

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
object Test:
2+
object Foo { def apply[A]: Foo.type = this }
3+
Foo() // error
4+
5+
case class Bar() { def apply[A]: Bar = this }
6+
Bar()() // error
7+
8+
case class Qux() { def apply[F[_]]: Qux = this }
9+
Qux()() // error

0 commit comments

Comments
 (0)