File tree 2 files changed +3
-13
lines changed
compiler/src/dotty/tools/dotc
2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,11 @@ class Compiler {
35
35
protected def frontendPhases : List [List [Phase ]] =
36
36
List (new Parser ) :: // Compiler frontend: scanner, parser
37
37
List (new TyperPhase ) :: // Compiler frontend: namer, typer
38
+ List (new CheckUnused .PostTyper ) :: // Check for unused elements
39
+ List (new CheckShadowing ) :: // Check shadowing elements
38
40
List (new YCheckPositions ) :: // YCheck positions
39
41
List (new sbt.ExtractDependencies ) :: // Sends information on classes' dependencies to sbt via callbacks
40
42
List (new semanticdb.ExtractSemanticDB ) :: // Extract info into .semanticdb files
41
- List (new CheckUnused .PostTyper , new CheckShadowing ) :: // Check for unused elements and shadowing elements
42
43
List (new PostTyper ) :: // Additional checks and cleanups after type checking
43
44
List (new sjs.PrepJSInterop ) :: // Additional checks and transformations for Scala.js (Scala.js only)
44
45
List (new sbt.ExtractAPI ) :: // Sends a representation of the API of classes to sbt via callbacks
Original file line number Diff line number Diff line change @@ -645,17 +645,6 @@ object CheckUnused:
645
645
imp.expr.tpe.member(sel.name.toTypeName).alternatives.exists(_.symbol.isOneOf(GivenOrImplicit ))
646
646
)
647
647
648
- /** Returns some inherited symbol with the same type and name as the given "symDecl" */
649
- private def lookForInheritedDecl (symDecl : Symbol )(using Context ): Option [Symbol ] =
650
- val symDeclType = symDecl.info
651
- val bClasses = symDecl.owner.info.baseClasses
652
- bClasses match
653
- case _ :: inherited =>
654
- inherited
655
- .map(classSymbol => symDecl.denot.matchingDecl(classSymbol, symDeclType))
656
- .find(sym => sym.name == symDecl.name)
657
- case Nil =>
658
- None
659
648
660
649
661
650
extension (tree : ImportSelector )
@@ -732,7 +721,7 @@ object CheckUnused:
732
721
733
722
/** A function is overriden. Either has `override flags` or parent has a matching member (type and name) */
734
723
private def isOverriden (using Context ): Boolean =
735
- sym.is(Flags .Override ) || lookForInheritedDecl (sym).isDefined
724
+ sym.is(Flags .Override ) || (sym.exists && sym.owner.thisType.parents.exists(p => sym.matchingMember(p).exists))
736
725
737
726
end extension
738
727
You can’t perform that action at this time.
0 commit comments