Fix kotlin tests

This commit is contained in:
Owen Mansel-Chan
2024-11-22 12:05:43 +00:00
parent 3f5886ef7a
commit 5e0c3ab715
12 changed files with 44 additions and 44 deletions

View File

@@ -1,8 +1,8 @@
| Test.kt:3:8:80:1 | { ... } | 0 | Test.kt:3:8:80:1 | { ... } |
| Test.kt:3:8:80:1 | { ... } | 1 | Test.kt:3:1:80:1 | super(...) |
| Test.kt:3:8:80:1 | { ... } | 2 | Test.kt:3:8:80:1 | { ... } |
| Test.kt:3:8:80:1 | { ... } | 3 | Test.kt:3:8:80:1 | Test |
| Test.kt:4:2:79:2 | test | 0 | Test.kt:4:2:79:2 | test |
| Test.kt:3:8:80:1 | { ... } | 3 | Test.kt:3:8:80:1 | Exit |
| Test.kt:4:2:79:2 | Exit | 0 | Test.kt:4:2:79:2 | Exit |
| Test.kt:4:13:79:2 | { ... } | 0 | Test.kt:4:13:79:2 | { ... } |
| Test.kt:4:13:79:2 | { ... } | 1 | Test.kt:5:7:5:7 | var ...; |
| Test.kt:4:13:79:2 | { ... } | 2 | Test.kt:5:16:5:16 | 0 |
@@ -102,7 +102,7 @@
| Test.kt:43:3:43:3 | <Expr>; | 8 | Test.kt:77:3:77:8 | ...=... |
| Test.kt:43:3:43:3 | <Expr>; | 9 | Test.kt:78:3:78:8 | INSTANCE |
| Test.kt:43:3:43:3 | <Expr>; | 10 | Test.kt:78:3:78:8 | return ... |
| Test.kt:82:1:89:1 | t1 | 0 | Test.kt:82:1:89:1 | t1 |
| Test.kt:82:1:89:1 | Exit | 0 | Test.kt:82:1:89:1 | Exit |
| Test.kt:82:21:89:1 | { ... } | 0 | Test.kt:82:21:89:1 | { ... } |
| Test.kt:82:21:89:1 | { ... } | 1 | Test.kt:83:2:88:2 | try ... |
| Test.kt:82:21:89:1 | { ... } | 2 | Test.kt:83:6:86:2 | { ... } |
@@ -117,7 +117,7 @@
| Test.kt:86:4:88:2 | catch (...) | 2 | Test.kt:86:34:88:2 | { ... } |
| Test.kt:86:4:88:2 | catch (...) | 3 | Test.kt:87:10:87:10 | 2 |
| Test.kt:86:4:88:2 | catch (...) | 4 | Test.kt:87:3:87:10 | return ... |
| Test.kt:91:1:98:1 | t2 | 0 | Test.kt:91:1:98:1 | t2 |
| Test.kt:91:1:98:1 | Exit | 0 | Test.kt:91:1:98:1 | Exit |
| Test.kt:91:22:98:1 | { ... } | 0 | Test.kt:91:22:98:1 | { ... } |
| Test.kt:91:22:98:1 | { ... } | 1 | Test.kt:92:2:97:2 | try ... |
| Test.kt:91:22:98:1 | { ... } | 2 | Test.kt:92:6:95:2 | { ... } |
@@ -132,7 +132,7 @@
| Test.kt:95:4:97:2 | catch (...) | 2 | Test.kt:95:36:97:2 | { ... } |
| Test.kt:95:4:97:2 | catch (...) | 3 | Test.kt:96:10:96:10 | 2 |
| Test.kt:95:4:97:2 | catch (...) | 4 | Test.kt:96:3:96:10 | return ... |
| Test.kt:100:1:110:1 | fn | 0 | Test.kt:100:1:110:1 | fn |
| Test.kt:100:1:110:1 | Exit | 0 | Test.kt:100:1:110:1 | Exit |
| Test.kt:100:25:110:1 | { ... } | 0 | Test.kt:100:25:110:1 | { ... } |
| Test.kt:100:25:110:1 | { ... } | 1 | Test.kt:101:5:103:5 | <Expr>; |
| Test.kt:100:25:110:1 | { ... } | 2 | Test.kt:101:5:103:5 | when ... |
@@ -165,7 +165,7 @@
| Test.kt:107:27:109:5 | { ... } | 1 | Test.kt:108:9:108:29 | <Expr>; |
| Test.kt:107:27:109:5 | { ... } | 2 | Test.kt:108:17:108:28 | "y not null" |
| Test.kt:107:27:109:5 | { ... } | 3 | Test.kt:108:9:108:29 | println(...) |
| Test.kt:112:1:116:1 | fn | 0 | Test.kt:112:1:116:1 | fn |
| Test.kt:112:1:116:1 | Exit | 0 | Test.kt:112:1:116:1 | Exit |
| Test.kt:112:32:116:1 | { ... } | 0 | Test.kt:112:32:116:1 | { ... } |
| Test.kt:112:32:116:1 | { ... } | 1 | Test.kt:113:5:115:5 | <Expr>; |
| Test.kt:112:32:116:1 | { ... } | 2 | Test.kt:113:5:115:5 | when ... |
@@ -174,7 +174,7 @@
| Test.kt:112:32:116:1 | { ... } | 5 | Test.kt:113:9:113:9 | x |
| Test.kt:113:14:113:14 | y | 0 | Test.kt:113:14:113:14 | y |
| Test.kt:113:17:115:5 | { ... } | 0 | Test.kt:113:17:115:5 | { ... } |
| Test.kt:118:1:124:1 | fn_when | 0 | Test.kt:118:1:124:1 | fn_when |
| Test.kt:118:1:124:1 | Exit | 0 | Test.kt:118:1:124:1 | Exit |
| Test.kt:118:37:124:1 | { ... } | 0 | Test.kt:118:37:124:1 | { ... } |
| Test.kt:118:37:124:1 | { ... } | 1 | Test.kt:119:2:123:12 | <Expr>; |
| Test.kt:118:37:124:1 | { ... } | 2 | Test.kt:119:2:123:12 | when ... |

View File

@@ -3,5 +3,5 @@ import default
from BasicBlock b, int i, ControlFlowNode n
where
b.getNode(i) = n and
b.getFile().(CompilationUnit).fromSource()
b.getLocation().getFile().(CompilationUnit).fromSource()
select b, i, n

View File

@@ -1,4 +1,4 @@
| Test.kt:4:13:79:2 | { ... } | Test.kt:4:2:79:2 | test |
| Test.kt:4:13:79:2 | { ... } | Test.kt:4:2:79:2 | Exit |
| Test.kt:4:13:79:2 | { ... } | Test.kt:11:3:16:3 | ... -> ... |
| Test.kt:4:13:79:2 | { ... } | Test.kt:11:14:14:3 | { ... } |
| Test.kt:4:13:79:2 | { ... } | Test.kt:18:3:18:3 | <Expr>; |
@@ -9,7 +9,7 @@
| Test.kt:4:13:79:2 | { ... } | Test.kt:38:9:38:9 | x |
| Test.kt:4:13:79:2 | { ... } | Test.kt:38:16:41:3 | { ... } |
| Test.kt:4:13:79:2 | { ... } | Test.kt:43:3:43:3 | <Expr>; |
| Test.kt:18:3:18:3 | <Expr>; | Test.kt:4:2:79:2 | test |
| Test.kt:18:3:18:3 | <Expr>; | Test.kt:4:2:79:2 | Exit |
| Test.kt:18:3:18:3 | <Expr>; | Test.kt:21:3:24:9 | ... -> ... |
| Test.kt:18:3:18:3 | <Expr>; | Test.kt:22:4:22:4 | <Expr>; |
| Test.kt:18:3:18:3 | <Expr>; | Test.kt:30:15:33:3 | { ... } |
@@ -27,13 +27,13 @@
| Test.kt:35:3:35:3 | <Expr>; | Test.kt:43:3:43:3 | <Expr>; |
| Test.kt:38:9:38:9 | x | Test.kt:38:16:41:3 | { ... } |
| Test.kt:38:9:38:9 | x | Test.kt:43:3:43:3 | <Expr>; |
| Test.kt:82:21:89:1 | { ... } | Test.kt:82:1:89:1 | t1 |
| Test.kt:82:21:89:1 | { ... } | Test.kt:82:1:89:1 | Exit |
| Test.kt:82:21:89:1 | { ... } | Test.kt:84:7:84:7 | x |
| Test.kt:82:21:89:1 | { ... } | Test.kt:86:4:88:2 | catch (...) |
| Test.kt:91:22:98:1 | { ... } | Test.kt:91:1:98:1 | t2 |
| Test.kt:91:22:98:1 | { ... } | Test.kt:91:1:98:1 | Exit |
| Test.kt:91:22:98:1 | { ... } | Test.kt:93:7:93:7 | x |
| Test.kt:91:22:98:1 | { ... } | Test.kt:95:4:97:2 | catch (...) |
| Test.kt:100:25:110:1 | { ... } | Test.kt:100:1:110:1 | fn |
| Test.kt:100:25:110:1 | { ... } | Test.kt:100:1:110:1 | Exit |
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:22 | y |
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:33:103:5 | { ... } |
| Test.kt:100:25:110:1 | { ... } | Test.kt:105:5:109:5 | <Expr>; |
@@ -45,11 +45,11 @@
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:107:16:109:5 | ... -> ... |
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:107:27:109:5 | { ... } |
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:107:27:109:5 | { ... } |
| Test.kt:112:32:116:1 | { ... } | Test.kt:112:1:116:1 | fn |
| Test.kt:112:32:116:1 | { ... } | Test.kt:112:1:116:1 | Exit |
| Test.kt:112:32:116:1 | { ... } | Test.kt:113:14:113:14 | y |
| Test.kt:112:32:116:1 | { ... } | Test.kt:113:17:115:5 | { ... } |
| Test.kt:113:14:113:14 | y | Test.kt:113:17:115:5 | { ... } |
| Test.kt:118:37:124:1 | { ... } | Test.kt:118:1:124:1 | fn_when |
| Test.kt:118:37:124:1 | { ... } | Test.kt:118:1:124:1 | Exit |
| Test.kt:118:37:124:1 | { ... } | Test.kt:121:9:121:9 | <Expr>; |
| Test.kt:118:37:124:1 | { ... } | Test.kt:122:12:122:16 | ... -> ... |
| Test.kt:118:37:124:1 | { ... } | Test.kt:123:8:123:10 | { ... } |

View File

@@ -4,7 +4,7 @@
| Test.kt:11:14:14:3 | { ... } | Test.kt:18:3:18:3 | <Expr>; |
| Test.kt:18:3:18:3 | <Expr>; | Test.kt:21:3:24:9 | ... -> ... |
| Test.kt:18:3:18:3 | <Expr>; | Test.kt:22:4:22:4 | <Expr>; |
| Test.kt:21:3:24:9 | ... -> ... | Test.kt:4:2:79:2 | test |
| Test.kt:21:3:24:9 | ... -> ... | Test.kt:4:2:79:2 | Exit |
| Test.kt:22:4:22:4 | <Expr>; | Test.kt:30:15:33:3 | { ... } |
| Test.kt:22:4:22:4 | <Expr>; | Test.kt:35:3:35:3 | <Expr>; |
| Test.kt:30:15:33:3 | { ... } | Test.kt:35:3:35:3 | <Expr>; |
@@ -12,34 +12,34 @@
| Test.kt:38:9:38:9 | x | Test.kt:38:16:41:3 | { ... } |
| Test.kt:38:9:38:9 | x | Test.kt:43:3:43:3 | <Expr>; |
| Test.kt:38:16:41:3 | { ... } | Test.kt:38:9:38:9 | x |
| Test.kt:43:3:43:3 | <Expr>; | Test.kt:4:2:79:2 | test |
| Test.kt:43:3:43:3 | <Expr>; | Test.kt:4:2:79:2 | Exit |
| Test.kt:82:21:89:1 | { ... } | Test.kt:84:7:84:7 | x |
| Test.kt:82:21:89:1 | { ... } | Test.kt:86:4:88:2 | catch (...) |
| Test.kt:84:7:84:7 | x | Test.kt:82:1:89:1 | t1 |
| Test.kt:86:4:88:2 | catch (...) | Test.kt:82:1:89:1 | t1 |
| Test.kt:84:7:84:7 | x | Test.kt:82:1:89:1 | Exit |
| Test.kt:86:4:88:2 | catch (...) | Test.kt:82:1:89:1 | Exit |
| Test.kt:91:22:98:1 | { ... } | Test.kt:93:7:93:7 | x |
| Test.kt:91:22:98:1 | { ... } | Test.kt:95:4:97:2 | catch (...) |
| Test.kt:93:7:93:7 | x | Test.kt:91:1:98:1 | t2 |
| Test.kt:95:4:97:2 | catch (...) | Test.kt:91:1:98:1 | t2 |
| Test.kt:93:7:93:7 | x | Test.kt:91:1:98:1 | Exit |
| Test.kt:95:4:97:2 | catch (...) | Test.kt:91:1:98:1 | Exit |
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:22 | y |
| Test.kt:100:25:110:1 | { ... } | Test.kt:105:5:109:5 | <Expr>; |
| Test.kt:101:22:101:22 | y | Test.kt:101:33:103:5 | { ... } |
| Test.kt:101:22:101:22 | y | Test.kt:105:5:109:5 | <Expr>; |
| Test.kt:101:33:103:5 | { ... } | Test.kt:100:1:110:1 | fn |
| Test.kt:101:33:103:5 | { ... } | Test.kt:100:1:110:1 | Exit |
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:105:20:107:5 | { ... } |
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:107:16:109:5 | ... -> ... |
| Test.kt:105:20:107:5 | { ... } | Test.kt:100:1:110:1 | fn |
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:100:1:110:1 | fn |
| Test.kt:105:20:107:5 | { ... } | Test.kt:100:1:110:1 | Exit |
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:100:1:110:1 | Exit |
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:107:27:109:5 | { ... } |
| Test.kt:107:27:109:5 | { ... } | Test.kt:100:1:110:1 | fn |
| Test.kt:112:32:116:1 | { ... } | Test.kt:112:1:116:1 | fn |
| Test.kt:107:27:109:5 | { ... } | Test.kt:100:1:110:1 | Exit |
| Test.kt:112:32:116:1 | { ... } | Test.kt:112:1:116:1 | Exit |
| Test.kt:112:32:116:1 | { ... } | Test.kt:113:14:113:14 | y |
| Test.kt:113:14:113:14 | y | Test.kt:112:1:116:1 | fn |
| Test.kt:113:14:113:14 | y | Test.kt:112:1:116:1 | Exit |
| Test.kt:113:14:113:14 | y | Test.kt:113:17:115:5 | { ... } |
| Test.kt:113:17:115:5 | { ... } | Test.kt:112:1:116:1 | fn |
| Test.kt:113:17:115:5 | { ... } | Test.kt:112:1:116:1 | Exit |
| Test.kt:118:37:124:1 | { ... } | Test.kt:121:9:121:9 | <Expr>; |
| Test.kt:118:37:124:1 | { ... } | Test.kt:122:12:122:16 | ... -> ... |
| Test.kt:121:9:121:9 | <Expr>; | Test.kt:118:1:124:1 | fn_when |
| Test.kt:121:9:121:9 | <Expr>; | Test.kt:118:1:124:1 | Exit |
| Test.kt:121:9:121:9 | <Expr>; | Test.kt:123:8:123:10 | { ... } |
| Test.kt:122:12:122:16 | ... -> ... | Test.kt:118:1:124:1 | fn_when |
| Test.kt:123:8:123:10 | { ... } | Test.kt:118:1:124:1 | fn_when |
| Test.kt:122:12:122:16 | ... -> ... | Test.kt:118:1:124:1 | Exit |
| Test.kt:123:8:123:10 | { ... } | Test.kt:118:1:124:1 | Exit |

View File

@@ -2,5 +2,5 @@ import default
import semmle.code.java.controlflow.Dominance
from Stmt pre, Stmt post
where strictlyDominates(pre, post)
where strictlyDominates(pre.getControlFlowNode(), post.getControlFlowNode())
select pre, post

View File

@@ -2,5 +2,5 @@ import default
import semmle.code.java.controlflow.Dominance
from Stmt pre, Stmt post
where strictlyPostDominates(post, pre)
where strictlyPostDominates(post.getControlFlowNode(), pre.getControlFlowNode())
select post, pre

View File

@@ -4,6 +4,6 @@ import semmle.code.java.controlflow.Dominance
from IfStmt i, BlockStmt b
where
b = i.getThen() and
dominates(i.getThen(), b) and
dominates(i.getElse(), b)
dominates(i.getThen().getControlFlowNode(), b.getControlFlowNode()) and
dominates(i.getElse().getControlFlowNode(), b.getControlFlowNode())
select i, b

View File

@@ -17,5 +17,5 @@ predicate dominanceCounterExample(ControlFlowNode entry, ControlFlowNode dom, Co
from Callable c, ControlFlowNode dom, ControlFlowNode node
where
(strictlyDominates(dom, node) or bbStrictlyDominates(dom, node)) and
dominanceCounterExample(c.getBody(), dom, node)
dominanceCounterExample(c.getBody().getControlFlowNode(), dom, node)
select c, dom, node

View File

@@ -3,14 +3,14 @@ import default
import semmle.code.java.controlflow.Dominance
ControlFlowNode reachableIn(Method func) {
result = func.getBody() or
result = func.getBody().getControlFlowNode() or
result = reachableIn(func).getASuccessor()
}
from Method func, ControlFlowNode entry, ControlFlowNode node
where
func.getBody() = entry and
func.getBody().getControlFlowNode() = entry and
reachableIn(func) = node and
entry != node and
not strictlyDominates(func.getBody(), node)
not strictlyDominates(func.getBody().getControlFlowNode(), node)
select func, node

View File

@@ -44,7 +44,7 @@
| Test.kt:21:3:24:11 | true | Test.kt:24:11:24:11 | z |
| Test.kt:21:3:24:11 | when ... | Test.kt:21:3:24:11 | ... -> ... |
| Test.kt:21:7:21:7 | x | Test.kt:21:11:21:11 | 0 |
| Test.kt:21:7:21:11 | ... < ... | Test.kt:2:2:79:2 | test |
| Test.kt:21:7:21:11 | ... < ... | Test.kt:2:2:79:2 | Exit |
| Test.kt:21:7:21:11 | ... < ... | Test.kt:21:3:24:11 | ... -> ... |
| Test.kt:21:7:21:11 | ... < ... | Test.kt:22:4:22:4 | <Expr>; |
| Test.kt:21:11:21:11 | 0 | Test.kt:21:7:21:11 | ... < ... |
@@ -142,7 +142,7 @@
| Test.kt:92:4:93:9 | <Expr>; | Test.kt:92:4:93:9 | when ... |
| Test.kt:92:4:93:9 | when ... | Test.kt:92:4:93:9 | ... -> ... |
| Test.kt:92:8:92:8 | a | Test.kt:92:13:92:14 | 10 |
| Test.kt:92:8:92:14 | ... (value equals) ... | Test.kt:81:2:98:2 | test2 |
| Test.kt:92:8:92:14 | ... (value equals) ... | Test.kt:81:2:98:2 | Exit |
| Test.kt:92:8:92:14 | ... (value equals) ... | Test.kt:93:5:93:9 | break |
| Test.kt:92:8:92:14 | ... (value equals) ... | Test.kt:94:4:95:12 | <Expr>; |
| Test.kt:92:13:92:14 | 10 | Test.kt:92:8:92:14 | ... (value equals) ... |

View File

@@ -4,13 +4,13 @@ import semmle.code.java.controlflow.Dominance
/** transitive dominance */
ControlFlowNode reachableIn(Method func) {
result = func.getBody() or
result = func.getBody().getControlFlowNode() or
result = reachableIn(func).getASuccessor()
}
from Method func, ControlFlowNode node
where
node = reachableIn(func) and
node != func.getBody() and
node != func.getBody().getControlFlowNode() and
not iDominates(_, node)
select func, node

View File

@@ -5,7 +5,7 @@ class PathTestConf extends ActionConfiguration {
PathTestConf() { this = "PathTestConf" }
override predicate isAction(ControlFlowNode node) {
node.(MethodCall).getMethod().hasName("action")
node.asExpr().(MethodCall).getMethod().hasName("action")
}
}