File tree 3 files changed +21
-0
lines changed
compiler/src/dotty/tools/dotc/core
3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -309,6 +309,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
309
309
thirdTryNamed(tp2)
310
310
else
311
311
( (tp1.name eq tp2.name)
312
+ && ! sym1.is(Private )
312
313
&& tp2.isPrefixDependentMemberRef
313
314
&& isSubPrefix(tp1.prefix, tp2.prefix)
314
315
&& tp1.signature == tp2.signature
Original file line number Diff line number Diff line change
1
+ -- [E007] Type Mismatch Error: tests/neg/i16850.scala:7:33 -------------------------------------------------------------
2
+ 7 | def add(elm: Y): Unit = list = elm :: list // error
3
+ | ^^^
4
+ | Found: (elm : Y)
5
+ | Required: Class.this.Y²
6
+ |
7
+ | where: Y is a type in class Class
8
+ | Y² is a type in trait Trait
9
+ |
10
+ | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change
1
+
2
+ trait Trait :
3
+ type Y
4
+ var list : List [Y ] = Nil
5
+
6
+ class Class [Y ] extends Trait :
7
+ def add (elm : Y ): Unit = list = elm :: list // error
8
+
9
+ object Object extends Class [Int ] :
10
+ add(42 )
You can’t perform that action at this time.
0 commit comments