forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#10855 from lrytz/i20006-privateacc
No double def in Scala 2 for private[this] param and matching method
- Loading branch information
Showing
9 changed files
with
363 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
i20006d.scala:12: error: method x is defined twice; | ||
the conflicting value x was defined at line 11:22 | ||
def x: Int = 4 // err | ||
^ | ||
i20006d.scala:17: error: method x is defined twice; | ||
the conflicting value x was defined at line 16:28 | ||
def x: Int = 4 // err | ||
^ | ||
i20006d.scala:22: error: method x is defined twice; | ||
the conflicting value x was defined at line 21:24 | ||
def x: Int = 4 // err | ||
^ | ||
i20006d.scala:27: error: method x is defined twice; | ||
the conflicting value x was defined at line 26:30 | ||
def x: Int = 4 // err | ||
^ | ||
i20006d.scala:32: error: method x is defined twice; | ||
the conflicting value x was defined at line 31:14 | ||
def x: Int = 4 // err | ||
^ | ||
i20006d.scala:44: error: method x is defined twice; | ||
the conflicting value x was defined at line 43:22 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006d.scala:49: error: method x is defined twice; | ||
the conflicting value x was defined at line 48:28 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006d.scala:54: error: method x is defined twice; | ||
the conflicting value x was defined at line 53:24 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006d.scala:59: error: method x is defined twice; | ||
the conflicting value x was defined at line 58:30 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006d.scala:64: error: method x is defined twice; | ||
the conflicting value x was defined at line 63:14 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006d.scala:68: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006d.scala:72: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006d.scala:76: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006d.scala:81: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006d.scala:86: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006d.scala:91: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006d.scala:96: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
17 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
//> using options -Werror | ||
|
||
class C1(x: String) { | ||
def x: Int = 4 // ok in Scala 2 | ||
} | ||
|
||
class C2(private[this] val x: String) { | ||
def x: Int = 4 // ok in Scala 2 | ||
} | ||
|
||
class C3(private val x: String) { | ||
def x: Int = 4 // err | ||
} | ||
|
||
object o4 { | ||
class C4(private[o4] val x: String) { | ||
def x: Int = 4 // err | ||
} | ||
} | ||
|
||
class C5(protected val x: String) { | ||
def x: Int = 4 // err | ||
} | ||
|
||
object o6 { | ||
class C6(protected[o6] val x: String) { | ||
def x: Int = 4 // err | ||
} | ||
} | ||
|
||
class C7(val x: String) { | ||
def x: Int = 4 // err | ||
} | ||
|
||
class D1(x: String) { | ||
def x(): Int = 4 // ok | ||
} | ||
|
||
class D2(private[this] val x: String) { | ||
def x(): Int = 4 // ok | ||
} | ||
|
||
class D3(private val x: String) { | ||
def x(): Int = 4 // err | ||
} | ||
|
||
object p4 { | ||
class D4(private[p4] val x: String) { | ||
def x(): Int = 4 // err | ||
} | ||
} | ||
|
||
class D5(protected val x: String) { | ||
def x(): Int = 4 // err | ||
} | ||
|
||
object p6 { | ||
class D6(protected[p6] val x: String) { | ||
def x(): Int = 4 // err | ||
} | ||
} | ||
|
||
class D7(val x: String) { | ||
def x(): Int = 4 // err | ||
} | ||
|
||
class E1(x: String) { | ||
val x: Int = 4 // err | ||
} | ||
|
||
class E2(private[this] val x: String) { | ||
val x: Int = 4 // err | ||
} | ||
|
||
class E3(private val x: String) { | ||
val x: Int = 4 // err | ||
} | ||
|
||
object q4 { | ||
class E4(private[q4] val x: String) { | ||
val x: Int = 4 // err | ||
} | ||
} | ||
|
||
class E5(protected val x: String) { | ||
val x: Int = 4 // err | ||
} | ||
|
||
object q6 { | ||
class E6(protected[q6] val x: String) { | ||
val x: Int = 4 // err | ||
} | ||
} | ||
|
||
class E7(val x: String) { | ||
val x: Int = 4 // err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
i20006e.scala:12: error: method x is defined twice; | ||
the conflicting value x was defined at line 11:22 | ||
def x: Int = 4 // err | ||
^ | ||
i20006e.scala:17: error: method x is defined twice; | ||
the conflicting value x was defined at line 16:28 | ||
def x: Int = 4 // err | ||
^ | ||
i20006e.scala:22: error: method x is defined twice; | ||
the conflicting value x was defined at line 21:24 | ||
def x: Int = 4 // err | ||
^ | ||
i20006e.scala:27: error: method x is defined twice; | ||
the conflicting value x was defined at line 26:30 | ||
def x: Int = 4 // err | ||
^ | ||
i20006e.scala:32: error: method x is defined twice; | ||
the conflicting value x was defined at line 31:14 | ||
def x: Int = 4 // err | ||
^ | ||
i20006e.scala:44: error: method x is defined twice; | ||
the conflicting value x was defined at line 43:22 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006e.scala:49: error: method x is defined twice; | ||
the conflicting value x was defined at line 48:28 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006e.scala:54: error: method x is defined twice; | ||
the conflicting value x was defined at line 53:24 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006e.scala:59: error: method x is defined twice; | ||
the conflicting value x was defined at line 58:30 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006e.scala:64: error: method x is defined twice; | ||
the conflicting value x was defined at line 63:14 | ||
def x(): Int = 4 // err | ||
^ | ||
i20006e.scala:68: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006e.scala:72: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006e.scala:76: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006e.scala:81: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006e.scala:86: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006e.scala:91: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006e.scala:96: error: x is already defined as value x | ||
val x: Int = 4 // err | ||
^ | ||
i20006e.scala:4: error: Double definition will be detected in Scala 3; the conflicting value x is defined at 3:10 | ||
Scala 3 migration messages are issued as errors under -Xsource:3. Use -Wconf or @nowarn to demote them to warnings or suppress. | ||
Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration, site=C1 | ||
def x: Int = 4 // warn in Xsource:3 | ||
^ | ||
i20006e.scala:8: error: Double definition will be detected in Scala 3; the conflicting value x is defined at 7:28 | ||
Scala 3 migration messages are issued as errors under -Xsource:3. Use -Wconf or @nowarn to demote them to warnings or suppress. | ||
Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration, site=C2 | ||
def x: Int = 4 // warn in Xsource:3 | ||
^ | ||
i20006e.scala:36: error: Double definition will be detected in Scala 3; the conflicting value x is defined at 35:10 | ||
Scala 3 migration messages are issued as errors under -Xsource:3. Use -Wconf or @nowarn to demote them to warnings or suppress. | ||
Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration, site=D1 | ||
def x(): Int = 4 // warn in Xsource:3 | ||
^ | ||
i20006e.scala:40: error: Double definition will be detected in Scala 3; the conflicting value x is defined at 39:28 | ||
Scala 3 migration messages are issued as errors under -Xsource:3. Use -Wconf or @nowarn to demote them to warnings or suppress. | ||
Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration, site=D2 | ||
def x(): Int = 4 // warn in Xsource:3 | ||
^ | ||
21 errors |
Oops, something went wrong.