Skip to content

Commit

Permalink
lil enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
halotukozak committed Jun 24, 2024
1 parent da13377 commit 32644de
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ final class ThrownExceptionNotInFunction(g: Global) extends AnalyzerRule(g, "thr
import global.*

def analyze(unit: CompilationUnit): Unit = unit.body.foreach(analyzeTree {
case Apply(f: TypeApply, args: List[Tree]) =>
case Apply(f: Tree, args: List[Tree]) =>
args.zip(f.tpe.params).foreach {
case (arg: Throw, param) if definitions.isFunctionType(param.tpe) =>
case (arg, param) if definitions.isFunctionType(param.tpe) && arg.tpe <:< definitions.NothingTpe =>
report(arg.pos, "exception thrown in place of function definition")
case (_, _) =>
}
Expand Down

0 comments on commit 32644de

Please sign in to comment.