File tree 3 files changed +14
-1
lines changed
compiler/src/dotty/tools/dotc/typer
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ object Typer {
64
64
65
65
private val ExprOwner = new Property .Key [Symbol ]
66
66
private val InsertedApply = new Property .Key [Unit ]
67
+ private val DroppedEmptyArgs = new Property .Key [Unit ]
67
68
}
68
69
69
70
class 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
1862
1863
*
1863
1864
* 0th strategy: If `tree` overrides a nullary method, mark the prototype
1864
1865
* so that the argument is dropped and return `tree` itself.
1866
+ * (but do this at most once per tree).
1865
1867
*
1866
1868
* After that, two strategies are tried, and the first that is successful is picked.
1867
1869
* 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
1899
1901
1900
1902
pt match {
1901
1903
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 , ())
1903
1907
pt.markAsDropped()
1904
1908
tree
1905
1909
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