diff --git a/analyzer/src/main/scala/com/avsystem/commons/analyzer/ThrownExceptionNotInFunction.scala b/analyzer/src/main/scala/com/avsystem/commons/analyzer/ThrownExceptionNotInFunction.scala index 95178ec6c..98551c087 100644 --- a/analyzer/src/main/scala/com/avsystem/commons/analyzer/ThrownExceptionNotInFunction.scala +++ b/analyzer/src/main/scala/com/avsystem/commons/analyzer/ThrownExceptionNotInFunction.scala @@ -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 (_, _) => }