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