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 @@ -1069,16 +1069,19 @@ object RefChecks {
1069
1069
target.nonPrivateMember(sym.name)
1070
1070
.filterWithPredicate:
1071
1071
member =>
1072
- val memberIsImplicit = member.info.hasImplicitParams
1073
- val paramTps =
1074
- if memberIsImplicit then methTp.stripPoly.firstParamTypes
1075
- else methTp.firstExplicitParamTypes
1076
-
1077
- paramTps.isEmpty || memberIsImplicit && ! methTp.hasImplicitParams || {
1078
- val memberParamTps = member.info.stripPoly.firstParamTypes
1079
- ! memberParamTps.isEmpty
1080
- && memberParamTps.lengthCompare(paramTps) == 0
1081
- && memberParamTps.lazyZip(paramTps).forall((m, x) => x frozen_<:< m)
1072
+ val memberIsPublic = (member.symbol.flags & AccessFlags ).isEmpty && ! member.symbol.privateWithin.exists
1073
+ memberIsPublic && {
1074
+ val memberIsImplicit = member.info.hasImplicitParams
1075
+ val paramTps =
1076
+ if memberIsImplicit then methTp.stripPoly.firstParamTypes
1077
+ else methTp.firstExplicitParamTypes
1078
+
1079
+ paramTps.isEmpty || memberIsImplicit && ! methTp.hasImplicitParams || {
1080
+ val memberParamTps = member.info.stripPoly.firstParamTypes
1081
+ ! memberParamTps.isEmpty
1082
+ && memberParamTps.lengthCompare(paramTps) == 0
1083
+ && memberParamTps.lazyZip(paramTps).forall((m, x) => x frozen_<:< m)
1084
+ }
1082
1085
}
1083
1086
.exists
1084
1087
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