Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look for synthetic applies also under type applications #15572

Merged
merged 1 commit into from
Jul 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ object Typer {
*/
private[typer] def isSyntheticApply(tree: tpd.Tree): Boolean = tree match {
case tree: tpd.Select => tree.hasAttachment(InsertedApply)
case TypeApply(fn, _) => isSyntheticApply(fn)
case _ => false
}

Expand Down
9 changes: 9 additions & 0 deletions tests/neg/i15567.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
object Test:
object Foo { def apply[A]: Foo.type = this }
Foo() // error

case class Bar() { def apply[A]: Bar = this }
Bar()() // error

case class Qux() { def apply[F[_]]: Qux = this }
Qux()() // error