File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -1071,8 +1071,12 @@ object Denotations {
10711071
10721072 final def matches (other : SingleDenotation )(implicit ctx : Context ): Boolean = {
10731073 val d = signature.matchDegree(other.signature)
1074- d == Signature .FullMatch ||
1075- d >= Signature .ParamMatch && info.matches(other.info)
1074+ (// fast path: signatures are the same and neither denotation is a PolyType
1075+ // For polytypes, signatures alone do not tell us enough to be sure about matching.
1076+ d == Signature .FullMatch && ! info.isInstanceOf [PolyType ] && ! other.info.isInstanceOf [PolyType ]
1077+ ||
1078+ // slow path
1079+ d >= Signature .ParamMatch && info.matches(other.info))
10761080 }
10771081
10781082 def mapInherited (ownDenots : PreDenotation , prevDenots : PreDenotation , pre : Type )(implicit ctx : Context ): SingleDenotation =
Original file line number Diff line number Diff line change 1+ trait P [A ]{
2+ def a [T ]: A
3+ }
4+ class C extends P [Int ]{ // error: class C needs to be abstract
5+ def a = 1
6+ }
7+ object O {
8+ def main (args : Array [String ]) = {
9+ val p : P [Int ] = new C
10+ println(p.a)
11+ }
12+ }
You can’t perform that action at this time.
0 commit comments