@@ -19,7 +19,7 @@ final class YIterateIterator[T](seed: T, hasNext: T => Boolean, next: T => T) ex
19
19
private var first = true
20
20
private var acc = seed
21
21
override def hasNext : Boolean = first || hasNext(acc) // error
22
- override def next (): T = { // error
22
+ override def next (): T = { // noerror
23
23
if (first) {
24
24
first = false
25
25
} else {
@@ -33,7 +33,7 @@ final class ZIterateIterator[T](seed: T, hasNext: T => Boolean, next: T => T) {
33
33
private var first = true
34
34
private var acc = seed
35
35
def hasNext : Boolean = first || hasNext(acc) // error
36
- def next (): T = { // error
36
+ def next (): T = { // noerror
37
37
if (first) {
38
38
first = false
39
39
} else {
@@ -53,94 +53,27 @@ class E(x: String) {
53
53
private [this ] var x : Int = 42 // error
54
54
}
55
55
class F (x : String ) {
56
- def x (): Int = 42 // error
56
+ def x (): Int = 42 // noerror
57
57
}
58
58
class G (x : String ) {
59
59
def x (i : Int ): Int = i
60
60
}
61
61
class H {
62
62
private [this ] val x : String = " "
63
- def x (): Int = 42 // error
63
+ def x (): Int = 42 // noerror
64
64
}
65
65
class I {
66
66
private [this ] def x : String = " "
67
67
def x (): Int = 42 // error
68
68
}
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