@@ -19,7 +19,7 @@ final class YIterateIterator[T](seed: T, hasNext: T => Boolean, next: T => T) ex
1919 private var first = true
2020 private var acc = seed
2121 override def hasNext : Boolean = first || hasNext(acc) // error
22- override def next (): T = { // error
22+ override def next (): T = { // noerror
2323 if (first) {
2424 first = false
2525 } else {
@@ -33,7 +33,7 @@ final class ZIterateIterator[T](seed: T, hasNext: T => Boolean, next: T => T) {
3333 private var first = true
3434 private var acc = seed
3535 def hasNext : Boolean = first || hasNext(acc) // error
36- def next (): T = { // error
36+ def next (): T = { // noerror
3737 if (first) {
3838 first = false
3939 } else {
@@ -53,94 +53,27 @@ class E(x: String) {
5353 private [this ] var x : Int = 42 // error
5454}
5555class F (x : String ) {
56- def x (): Int = 42 // error
56+ def x (): Int = 42 // noerror
5757}
5858class G (x : String ) {
5959 def x (i : Int ): Int = i
6060}
6161class H {
6262 private [this ] val x : String = " "
63- def x (): Int = 42 // error
63+ def x (): Int = 42 // noerror
6464}
6565class I {
6666 private [this ] def x : String = " "
6767 def x (): Int = 42 // error
6868}
69-
70- /*
71- -- [E120] Naming Error: test/files/neg/i20006.scala:8:15 ---------------------------------------------------------------
72- 8 | override def hasNext: Boolean = first || hasNext(acc)
73- | ^
74- | Double definition:
75- | val hasNext: T => Boolean in class XIterateIterator at line 6 and
76- | override def hasNext: Boolean in class XIterateIterator at line 8
77- -- [E120] Naming Error: test/files/neg/i20006.scala:9:15 ---------------------------------------------------------------
78- 9 | override def next(): T = {
79- | ^
80- | Double definition:
81- | val next: T => T in class XIterateIterator at line 7 and
82- | override def next(): T in class XIterateIterator at line 9
83- -- [E120] Naming Error: test/files/neg/i20006.scala:22:15 --------------------------------------------------------------
84- 22 | override def hasNext: Boolean = first || hasNext(acc)
85- | ^
86- | Double definition:
87- | private[this] val hasNext: T => Boolean in class YIterateIterator at line 19 and
88- | override def hasNext: Boolean in class YIterateIterator at line 22
89- -- [E120] Naming Error: test/files/neg/i20006.scala:23:15 --------------------------------------------------------------
90- 23 | override def next(): T = {
91- | ^
92- | Double definition:
93- | private[this] val next: T => T in class YIterateIterator at line 19 and
94- | override def next(): T in class YIterateIterator at line 23
95- -- [E120] Naming Error: test/files/neg/i20006.scala:36:6 ---------------------------------------------------------------
96- 36 | def hasNext: Boolean = first || hasNext(acc)
97- | ^
98- | Double definition:
99- | private[this] val hasNext: T => Boolean in class ZIterateIterator at line 33 and
100- | def hasNext: Boolean in class ZIterateIterator at line 36
101- -- [E120] Naming Error: test/files/neg/i20006.scala:37:6 ---------------------------------------------------------------
102- 37 | def next(): T = {
103- | ^
104- | Double definition:
105- | private[this] val next: T => T in class ZIterateIterator at line 33 and
106- | def next(): T in class ZIterateIterator at line 37
107- -- [E120] Naming Error: test/files/neg/i20006.scala:48:6 ---------------------------------------------------------------
108- 48 | val x: String = "member" // error
109- | ^
110- | Double definition:
111- | private[this] val x: String in class C at line 47 and
112- | val x: String in class C at line 48
113- -- [E120] Naming Error: test/files/neg/i20006.scala:51:14 --------------------------------------------------------------
114- 51 | private var x: Int = 42 // error
115- | ^
116- | Double definition:
117- | private[this] val x: String in class D at line 50 and
118- | private[this] var x: Int in class D at line 51
119- -- [E120] Naming Error: test/files/neg/i20006.scala:54:20 --------------------------------------------------------------
120- 54 | private[this] var x: Int = 42 // error
121- | ^
122- | Double definition:
123- | private[this] val x: String in class E at line 53 and
124- | private[this] var x: Int in class E at line 54
125- -- [E120] Naming Error: test/files/neg/i20006.scala:57:6 ---------------------------------------------------------------
126- 57 | def x(): Int = 42 // error
127- | ^
128- | Double definition:
129- | private[this] val x: String in class F at line 56 and
130- | def x(): Int in class F at line 57
131- -- [E120] Naming Error: test/files/neg/i20006.scala:65:6 ---------------------------------------------------------------
132- 65 | def x(): Int = 42
133- | ^
134- | Double definition:
135- | val x: String in class H at line 63 and
136- | def x(): Int in class H at line 65
137- -- Warning: test/files/neg/i20006.scala:54:16 --------------------------------------------------------------------------
138- 54 | private[this] var x: Int = 42 // error
139- | ^
140- | Ignoring [this] qualifier.
141- | This syntax will be deprecated in the future; it should be dropped.
142- | See: https://docs.scala-lang.org/scala3/reference/dropped-features/this-qualifier.html
143- | This construct can be rewritten automatically under -rewrite -source 3.4-migration.
144- 1 warning found
145- 11 errors found
146- */
69+ class PrivateConflict {
70+ private [this ] var x = 42
71+ def x (): Int = x
72+ def x_= (n : Int ) = x = n
73+ }
74+ class LocalConflict {
75+ def f (): Unit = {
76+ var x = 42
77+ def x (): Int = x // error
78+ }
79+ }
0 commit comments