Skip to content

Commit 0c3b54c

Browse files
committed
lil enhancement
1 parent da13377 commit 0c3b54c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ final class ThrownExceptionNotInFunction(g: Global) extends AnalyzerRule(g, "thr
88
import global.*
99

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

analyzer/src/test/scala/com/avsystem/commons/analyzer/ThrownExceptionNotInFunctionTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class ThrownExceptionNotInFunctionTest extends AnyFunSuite with AnalyzerTe
2020
| f0(throw ex)
2121
|
2222
| //ok
23-
// | f0(identity)
23+
| f0(identity)
2424
|}""".stripMargin)
2525
}
2626

0 commit comments

Comments
 (0)