File tree Expand file tree Collapse file tree 2 files changed +18
-21
lines changed Expand file tree Collapse file tree 2 files changed +18
-21
lines changed Original file line number Diff line number Diff line change @@ -79,27 +79,6 @@ class X3 {
79
79
override type T = A1 // error: overrides nothing
80
80
}
81
81
82
- package p3 {
83
-
84
- // Dotty change of rules: Toverrider#f does not
85
- // override TCommon#f, hence the accidental override rule
86
- // applies.
87
- trait TCommon {
88
- def f : String
89
- }
90
-
91
- class C1 extends TCommon {
92
- def f = " in C1"
93
- }
94
-
95
- trait TOverrider { this : TCommon =>
96
- override def f = " in TOverrider" // The overridden self-type member...
97
- }
98
-
99
- class C2 extends C1 with TOverrider // ... fails to override, here. // error: accidental override
100
-
101
- }
102
-
103
82
package p4 {
104
83
105
84
abstract class C [T ] { def head : T }
Original file line number Diff line number Diff line change
1
+ // Question: Does TOverrider#f override TCommon#f?
2
+ // If not, the accidental override rule applies.
3
+ // Dotty used to say no, but with the change to baseClasses in AndTypes says
4
+ // yes. Not sure what the right answer is. But in any case we should
5
+ // keep the test to notice if there's a difference in behavior.
6
+ trait TCommon {
7
+ def f : String
8
+ }
9
+ class C1 extends TCommon {
10
+ def f = " in C1"
11
+ }
12
+
13
+ trait TOverrider { this : TCommon =>
14
+ override def f = " in TOverrider" // The overridden self-type member...
15
+ }
16
+
17
+ class C2 extends C1 with TOverrider // ... failed to override, here. But now it is OK.
18
+
You can’t perform that action at this time.
0 commit comments