Skip to content

Commit 3ff850d

Browse files
committed
refactor: simplify applyOfAnnotatedCompanion method logic
1 parent 297baac commit 3ff850d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

analyzer/src/main/scala/com/avsystem/commons/analyzer/ExplicitGenerics.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ class ExplicitGenerics(g: Global) extends AnalyzerRule(g, "explicitGenerics") {
1717
def requiresExplicitGenerics(sym: Symbol): Boolean =
1818
sym != NoSymbol && (sym :: sym.overrides).flatMap(_.annotations).exists(_.tree.tpe <:< explicitGenericsAnnotTpe)
1919

20-
def applyOfAnnotatedCompanion(preSym: Symbol): Boolean = {
21-
if (preSym != NoSymbol && preSym.isMethod && preSym.name == TermName("apply")) {
20+
def applyOfAnnotatedCompanion(preSym: Symbol): Boolean =
21+
preSym != NoSymbol && preSym.isMethod && preSym.name == TermName("apply") && {
2222
val owner = preSym.owner
2323
val companionCls =
2424
if (owner.isModuleClass) owner.companionClass
2525
else if (owner.isModule) owner.moduleClass.companionClass
2626
else NoSymbol
2727
requiresExplicitGenerics(companionCls)
28-
} else false
29-
}
28+
}
3029

3130
def analyzeTree(tree: Tree): Unit = analyzer.macroExpandee(tree) match {
3231
case `tree` | EmptyTree =>

0 commit comments

Comments
 (0)