We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6cb65d2 + 5e9f086 commit 2b0e4a1Copy full SHA for 2b0e4a1
compiler/src/dotty/tools/dotc/typer/Checking.scala
@@ -744,7 +744,10 @@ trait Checking {
744
def checkDecl(decl: Symbol): Unit = {
745
for (other <- seen(decl.name)) {
746
typr.println(i"conflict? $decl $other")
747
- if (decl.matches(other)) {
+ def javaFieldMethodPair =
748
+ decl.is(JavaDefined) && other.is(JavaDefined) &&
749
+ decl.is(Method) != other.is(Method)
750
+ if (decl.matches(other) && !javaFieldMethodPair) {
751
def doubleDefError(decl: Symbol, other: Symbol): Unit =
752
if (!decl.info.isErroneous && !other.info.isErroneous)
753
ctx.error(DoubleDeclaration(decl, other), decl.sourcePos)
tests/pos/i4739.java
@@ -0,0 +1,6 @@
1
+public class i4739 {
2
+ int foo;
3
+ int foo() {
4
+ return this.foo;
5
+ }
6
+}
0 commit comments