File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ object Typer {
6464
6565 private val ExprOwner = new Property .Key [Symbol ]
6666 private val InsertedApply = new Property .Key [Unit ]
67+ private val DroppedEmptyArgs = new Property .Key [Unit ]
6768}
6869
6970class Typer extends Namer with TypeAssigner with Applications with Implicits with Dynamic with Checking with Docstrings {
@@ -1862,6 +1863,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
18621863 *
18631864 * 0th strategy: If `tree` overrides a nullary method, mark the prototype
18641865 * so that the argument is dropped and return `tree` itself.
1866+ * (but do this at most once per tree).
18651867 *
18661868 * After that, two strategies are tried, and the first that is successful is picked.
18671869 * If neither of the strategies are successful, continues with`fallBack`.
@@ -1899,7 +1901,9 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
18991901
19001902 pt match {
19011903 case pt @ FunProto (Nil , _, _)
1902- if tree.symbol.allOverriddenSymbols.exists(_.info.isNullaryMethod) =>
1904+ if tree.symbol.allOverriddenSymbols.exists(_.info.isNullaryMethod) &&
1905+ tree.getAttachment(DroppedEmptyArgs ).isEmpty =>
1906+ tree.putAttachment(DroppedEmptyArgs , ())
19031907 pt.markAsDropped()
19041908 tree
19051909 case _ =>
Original file line number Diff line number Diff line change 1+ package fuz ;
2+ public interface Fuzbar {
3+ public String str ();
4+ }
Original file line number Diff line number Diff line change 1+
2+ object a extends fuz.Fuzbar {
3+ override def str = " "
4+ str()()()()()() // error: missing argument
5+ }
You can’t perform that action at this time.
0 commit comments