File tree 2 files changed +30
-10
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -1169,16 +1169,19 @@ object RefChecks {
1169
1169
target.nonPrivateMember(sym.name)
1170
1170
.filterWithPredicate:
1171
1171
member =>
1172
- val memberIsImplicit = member.info.hasImplicitParams
1173
- val paramTps =
1174
- if memberIsImplicit then methTp.stripPoly.firstParamTypes
1175
- else methTp.firstExplicitParamTypes
1176
-
1177
- paramTps.isEmpty || memberIsImplicit && ! methTp.hasImplicitParams || {
1178
- val memberParamTps = member.info.stripPoly.firstParamTypes
1179
- ! memberParamTps.isEmpty
1180
- && memberParamTps.lengthCompare(paramTps) == 0
1181
- && memberParamTps.lazyZip(paramTps).forall((m, x) => x frozen_<:< m)
1172
+ val memberIsPublic = (member.symbol.flags & AccessFlags ).isEmpty && ! member.symbol.privateWithin.exists
1173
+ memberIsPublic && {
1174
+ val memberIsImplicit = member.info.hasImplicitParams
1175
+ val paramTps =
1176
+ if memberIsImplicit then methTp.stripPoly.firstParamTypes
1177
+ else methTp.firstExplicitParamTypes
1178
+
1179
+ paramTps.isEmpty || memberIsImplicit && ! methTp.hasImplicitParams || {
1180
+ val memberParamTps = member.info.stripPoly.firstParamTypes
1181
+ ! memberParamTps.isEmpty
1182
+ && memberParamTps.lengthCompare(paramTps) == 0
1183
+ && memberParamTps.lazyZip(paramTps).forall((m, x) => x frozen_<:< m)
1184
+ }
1182
1185
}
1183
1186
.exists
1184
1187
if ! target.typeSymbol.denot.isAliasType && ! target.typeSymbol.denot.isOpaqueAlias && hidden
Original file line number Diff line number Diff line change
1
+
2
+ case class CC (a : String , b : String ) extends Iterable [String ] {
3
+ override def iterator : Iterator [String ] = Iterator (a, b)
4
+ }
5
+
6
+ trait T {
7
+ extension (cc : CC ) def className : String = " foo"
8
+ }
9
+
10
+ object O extends T {
11
+ def foo = {
12
+ val cc = CC (" a" , " b" )
13
+ println(cc.className)
14
+ }
15
+ }
16
+
17
+ @ main def main () = O .foo
You can’t perform that action at this time.
0 commit comments