Skip to content

Commit b7b4746

Browse files
committed
Integrate tests in method where they are needed
1 parent 5dd0ba5 commit b7b4746

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,21 +1154,17 @@ class Namer { typer: Typer =>
11541154
.flatMap(path.tpe.memberBasedOnFlags(_, excluded = Private|Given|ConstructorProxy).alternatives)
11551155
.foreach(addForwarder(name, _, span)) // ignore if any are not added
11561156

1157-
val fromCaseClass = path.tpe.widen.classSymbols.exists(_.is(Case))
1158-
1159-
/** Is symbol from a base trait of a case class so that it will be synthesized
1160-
* in the case class itself. Such members are treated like synthetic members,
1161-
* i.e. they don't get export forwarders.
1162-
*/
1163-
def isCaseClassSynthesized(mbr: Symbol) =
1164-
fromCaseClass && defn.caseClassSynthesized.contains(mbr)
1165-
11661157
def addWildcardForwarders(seen: List[TermName], span: Span): Unit =
11671158
val nonContextual = mutable.HashSet(seen: _*)
1159+
val fromCaseClass = path.tpe.widen.classSymbols.exists(_.is(Case))
1160+
def isCaseClassSynthesized(mbr: Symbol) =
1161+
fromCaseClass && defn.caseClassSynthesized.contains(mbr)
11681162
for mbr <- path.tpe.membersBasedOnFlags(required = EmptyFlags, excluded = PrivateOrSynthetic) do
11691163
if !mbr.symbol.isSuperAccessor && !isCaseClassSynthesized(mbr.symbol) then
11701164
// Scala 2 superaccessors have neither Synthetic nor Artfact set, so we
11711165
// need to filter them out here (by contrast, Scala 3 superaccessors are Artifacts)
1166+
// Symbols from base traits of case classes that will get synthesized implementations
1167+
// at PostTyper are also excluded.
11721168
val alias = mbr.name.toTermName
11731169
if mbr.symbol.is(Given) then
11741170
if !seen.contains(alias) && mbr.matchesImportBound(givenBound) then

0 commit comments

Comments
 (0)