@@ -1099,10 +1099,14 @@ class Namer { typer: Typer =>
1099
1099
val sym = mbr.symbol
1100
1100
if ! sym.isAccessibleFrom(pathType) then
1101
1101
No (" is not accessible" )
1102
- else if sym.isConstructor || sym.is(ModuleClass ) || sym.is(Bridge ) || sym.is(ConstructorProxy ) then
1102
+ else if sym.isConstructor || sym.is(ModuleClass ) || sym.is(Bridge ) || sym.is(ConstructorProxy ) || sym.isAllOf( JavaModule ) then
1103
1103
Skip
1104
1104
else if cls.derivesFrom(sym.owner) && (sym.owner == cls || ! sym.is(Deferred )) then
1105
1105
No (i " is already a member of $cls" )
1106
+ else if pathMethod.exists && mbr.isType then
1107
+ No (" is a type, so it cannot be exported as extension method" )
1108
+ else if pathMethod.exists && sym.is(ExtensionMethod ) then
1109
+ No (" is already an extension method, cannot be exported into another one" )
1106
1110
else if targets.contains(alias) then
1107
1111
No (i " clashes with another export in the same export clause " )
1108
1112
else if sym.is(Override ) then
@@ -1111,12 +1115,6 @@ class Namer { typer: Typer =>
1111
1115
) match
1112
1116
case Some (other) => No (i " overrides ${other.showLocated}, which is already a member of $cls" )
1113
1117
case None => Yes
1114
- else if sym.isAllOf(JavaModule ) then
1115
- Skip
1116
- else if pathMethod.exists && mbr.isType then
1117
- No (" is a type, so it cannot be exported as extension method" )
1118
- else if pathMethod.exists && sym.is(ExtensionMethod ) then
1119
- No (" is already an extension method, cannot be exported into another one" )
1120
1118
else
1121
1119
Yes
1122
1120
}
@@ -1245,12 +1243,13 @@ class Namer { typer: Typer =>
1245
1243
val size = buf.size
1246
1244
val mbrs = List (name, name.toTypeName).flatMap(pathType.member(_).alternatives)
1247
1245
mbrs.foreach(addForwarder(alias, _, span))
1248
- targets += alias
1249
1246
if buf.size == size then
1250
1247
val reason = mbrs.map(canForward(_, alias)).collect {
1251
1248
case CanForward .No (whyNot) => i " \n $path. $name cannot be exported because it $whyNot"
1252
1249
}.headOption.getOrElse(" " )
1253
1250
report.error(i """ no eligible member $name at $path$reason""" , ctx.source.atSpan(span))
1251
+ else
1252
+ targets += alias
1254
1253
1255
1254
def addWildcardForwardersNamed (name : TermName , span : Span ): Unit =
1256
1255
List (name, name.toTypeName)
0 commit comments