Kotlin: Add FP test case for dead code queries

This commit is contained in:
Tamas Vajk
2022-11-16 16:18:37 +01:00
parent c70f3d35d0
commit 983851fc60
8 changed files with 51 additions and 0 deletions

View File

@@ -14,6 +14,8 @@ import semmle.code.java.deadcode.DeadCode
from DeadClass c, Element origin, string reason
where
not c.getFile().isKotlinSourceFile() and
not origin.getFile().isKotlinSourceFile() and
if exists(DeadRoot root | root = c.getADeadRoot() | not root = c.getACallable())
then (
// Report a list of the dead roots.

View File

@@ -15,6 +15,8 @@ import semmle.code.java.deadcode.DeadCode
from DeadField f, Element origin, string reason
where
not f.getFile().isKotlinSourceFile() and
not origin.getFile().isKotlinSourceFile() and
not f.isInDeadScope() and
if f.getAnAccess() instanceof FieldRead
then (

View File

@@ -15,6 +15,8 @@ import semmle.code.java.deadcode.DeadCode
from DeadMethod c, Callable origin, string reason
where
not c.getFile().isKotlinSourceFile() and
not origin.getFile().isKotlinSourceFile() and
not c.isInDeadScope() and
if exists(DeadRoot deadRoot | deadRoot = getADeadRoot(c) | deadRoot.getSourceDeclaration() != c)
then (