File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -1168,8 +1168,9 @@ object RefChecks {
11681168 def strippedResultType = Applications .stripImplicit(tp.stripPoly, wildcardOnly = true ).resultType
11691169 def firstExplicitParamTypes = Applications .stripImplicit(tp.stripPoly, wildcardOnly = true ).firstParamTypes
11701170 def hasImplicitParams = tp.stripPoly match { case mt : MethodType => mt.isImplicitMethod case _ => false }
1171- val target = sym.info.firstExplicitParamTypes.head // required for extension method, the putative receiver
1171+ val target = sym.info.firstExplicitParamTypes.head.typeSymbol.info // required for extension method, the putative receiver
11721172 val methTp = sym.info.strippedResultType // skip leading implicits and the "receiver" parameter
1173+
11731174 def hidden =
11741175 target.nonPrivateMember(sym.name)
11751176 .filterWithPredicate:
@@ -1190,7 +1191,7 @@ object RefChecks {
11901191 }
11911192 }
11921193 .exists
1193- if ! target.typeSymbol.isOpaqueAlias && hidden
1194+ if hidden
11941195 then report.warning(ExtensionNullifiedByMember (sym, target.typeSymbol), sym.srcPos)
11951196 end checkExtensionMethods
11961197
Original file line number Diff line number Diff line change 1+ class C
2+ object C :
3+ extension (c : C ) def equals (that : Any ): Boolean = false // warn
4+
5+ object X :
6+ class C
7+ opaque type D <: C = C
8+ object D :
9+ extension (d : D ) def equals (that : Any ): Boolean = false // warn
10+
11+ object Upperbound :
12+ opaque type IArray [+ T ] <: String = String
13+ extension (arr : IArray [Byte ]) def length : Int = 0 // warn
14+ extension [T <: Int ](arr : T ) def length : Int = 0 // nowarn
15+
16+ object NonUpperbound :
17+ opaque type IArray [+ T ] = String
18+ extension (arr : IArray [Byte ]) def length : Int = 0 // nowarn
19+
You can’t perform that action at this time.
0 commit comments