Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9597932

Browse files
tamasvajkigfoo
authored andcommitted
Add test that calls a local function multiple times
1 parent ea74803 commit 9597932

4 files changed

Lines changed: 56 additions & 30 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[INVALID_KEY_SET] predicate isAnonymClass(@class classid, @classinstancexpr parent): The key set {classid} does not functionally determine all fields.
2+
Here is a pair of tuples that agree on the key set but differ at index 1:
3+
Tuple 1 in row 28: (3797,3825)
4+
Tuple 2 in row 29: (3797,3842)

java/ql/test/kotlin/library-tests/exprs/PrintAst.expected

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,12 +2337,23 @@ localFunctionCalls.kt:
23372337
# 10| -3: [TypeAccess] C1<Integer>
23382338
# 10| 0: [TypeAccess] Integer
23392339
# 10| 1: [IntegerLiteral] 42
2340-
# 13| 2: [Class,GenericType,ParameterizedType] C1
2340+
# 11| 7: [ExprStmt] <Expr>;
2341+
# 11| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
2342+
# 11| 0: [TypeAccess] Unit
2343+
# 11| 1: [MethodAccess] f1(...)
2344+
# 11| -2: [TypeAccess] Integer
2345+
# 11| -1: [ClassInstanceExpr] new (...)
2346+
# 11| -3: [TypeAccess] Object
2347+
# 11| 0: [ClassInstanceExpr] new C1<Integer>(...)
2348+
# 11| -3: [TypeAccess] C1<Integer>
2349+
# 11| 0: [TypeAccess] Integer
2350+
# 11| 1: [IntegerLiteral] 42
2351+
# 14| 2: [Class,GenericType,ParameterizedType] C1
23412352
#-----| -2: (Generic Parameters)
2342-
# 13| 0: [TypeVariable] T
2343-
# 13| 1: [Constructor] C1
2344-
# 13| 5: [BlockStmt] { ... }
2345-
# 13| 0: [SuperConstructorInvocationStmt] super(...)
2353+
# 14| 0: [TypeVariable] T
2354+
# 14| 1: [Constructor] C1
2355+
# 14| 5: [BlockStmt] { ... }
2356+
# 14| 0: [SuperConstructorInvocationStmt] super(...)
23462357
samConversion.kt:
23472358
# 0| [CompilationUnit] samConversion
23482359
# 0| 1: [Class] SamConversionKt

java/ql/test/kotlin/library-tests/exprs/exprs.expected

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,35 +1395,45 @@
13951395
| funcExprs.kt:69:12:69:22 | Integer | funcExprs.kt:68:5:70:5 | call | TypeAccess |
13961396
| funcExprs.kt:69:12:69:22 | String | funcExprs.kt:68:5:70:5 | call | TypeAccess |
13971397
| funcExprs.kt:69:20:69:20 | a | funcExprs.kt:69:12:69:22 | invoke | StringLiteral |
1398-
| localFunctionCalls.kt:4:5:4:13 | x | localFunctionCalls.kt:3:1:11:1 | x | LocalVariableDeclExpr |
1399-
| localFunctionCalls.kt:4:13:4:13 | 5 | localFunctionCalls.kt:3:1:11:1 | x | IntegerLiteral |
1398+
| localFunctionCalls.kt:4:5:4:13 | x | localFunctionCalls.kt:3:1:12:1 | x | LocalVariableDeclExpr |
1399+
| localFunctionCalls.kt:4:13:4:13 | 5 | localFunctionCalls.kt:3:1:12:1 | x | IntegerLiteral |
14001400
| localFunctionCalls.kt:5:25:5:25 | i | localFunctionCalls.kt:5:5:5:29 | a | VarAccess |
14011401
| localFunctionCalls.kt:5:25:5:29 | ... + ... | localFunctionCalls.kt:5:5:5:29 | a | AddExpr |
14021402
| localFunctionCalls.kt:5:29:5:29 | x | localFunctionCalls.kt:5:5:5:29 | a | VarAccess |
1403-
| localFunctionCalls.kt:6:5:6:5 | x | localFunctionCalls.kt:3:1:11:1 | x | VarAccess |
1404-
| localFunctionCalls.kt:6:5:6:9 | ...=... | localFunctionCalls.kt:3:1:11:1 | x | AssignExpr |
1405-
| localFunctionCalls.kt:6:9:6:9 | 6 | localFunctionCalls.kt:3:1:11:1 | x | IntegerLiteral |
1406-
| localFunctionCalls.kt:7:5:7:17 | <implicit coercion to unit> | localFunctionCalls.kt:3:1:11:1 | x | ImplicitCoercionToUnitExpr |
1407-
| localFunctionCalls.kt:7:5:7:17 | Object | localFunctionCalls.kt:3:1:11:1 | x | TypeAccess |
1408-
| localFunctionCalls.kt:7:5:7:17 | String | localFunctionCalls.kt:3:1:11:1 | x | TypeAccess |
1409-
| localFunctionCalls.kt:7:5:7:17 | Unit | localFunctionCalls.kt:3:1:11:1 | x | TypeAccess |
1410-
| localFunctionCalls.kt:7:5:7:17 | a(...) | localFunctionCalls.kt:3:1:11:1 | x | MethodAccess |
1411-
| localFunctionCalls.kt:7:5:7:17 | new (...) | localFunctionCalls.kt:3:1:11:1 | x | ClassInstanceExpr |
1412-
| localFunctionCalls.kt:7:15:7:16 | 42 | localFunctionCalls.kt:3:1:11:1 | x | IntegerLiteral |
1413-
| localFunctionCalls.kt:8:5:8:5 | x | localFunctionCalls.kt:3:1:11:1 | x | VarAccess |
1414-
| localFunctionCalls.kt:8:5:8:9 | ...=... | localFunctionCalls.kt:3:1:11:1 | x | AssignExpr |
1415-
| localFunctionCalls.kt:8:9:8:9 | 7 | localFunctionCalls.kt:3:1:11:1 | x | IntegerLiteral |
1403+
| localFunctionCalls.kt:6:5:6:5 | x | localFunctionCalls.kt:3:1:12:1 | x | VarAccess |
1404+
| localFunctionCalls.kt:6:5:6:9 | ...=... | localFunctionCalls.kt:3:1:12:1 | x | AssignExpr |
1405+
| localFunctionCalls.kt:6:9:6:9 | 6 | localFunctionCalls.kt:3:1:12:1 | x | IntegerLiteral |
1406+
| localFunctionCalls.kt:7:5:7:17 | <implicit coercion to unit> | localFunctionCalls.kt:3:1:12:1 | x | ImplicitCoercionToUnitExpr |
1407+
| localFunctionCalls.kt:7:5:7:17 | Object | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1408+
| localFunctionCalls.kt:7:5:7:17 | String | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1409+
| localFunctionCalls.kt:7:5:7:17 | Unit | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1410+
| localFunctionCalls.kt:7:5:7:17 | a(...) | localFunctionCalls.kt:3:1:12:1 | x | MethodAccess |
1411+
| localFunctionCalls.kt:7:5:7:17 | new (...) | localFunctionCalls.kt:3:1:12:1 | x | ClassInstanceExpr |
1412+
| localFunctionCalls.kt:7:15:7:16 | 42 | localFunctionCalls.kt:3:1:12:1 | x | IntegerLiteral |
1413+
| localFunctionCalls.kt:8:5:8:5 | x | localFunctionCalls.kt:3:1:12:1 | x | VarAccess |
1414+
| localFunctionCalls.kt:8:5:8:9 | ...=... | localFunctionCalls.kt:3:1:12:1 | x | AssignExpr |
1415+
| localFunctionCalls.kt:8:9:8:9 | 7 | localFunctionCalls.kt:3:1:12:1 | x | IntegerLiteral |
14161416
| localFunctionCalls.kt:9:34:9:34 | 5 | localFunctionCalls.kt:9:5:9:34 | f1 | IntegerLiteral |
1417-
| localFunctionCalls.kt:10:5:10:13 | C1<Integer> | localFunctionCalls.kt:3:1:11:1 | x | TypeAccess |
1418-
| localFunctionCalls.kt:10:5:10:13 | Integer | localFunctionCalls.kt:3:1:11:1 | x | TypeAccess |
1419-
| localFunctionCalls.kt:10:5:10:13 | new C1<Integer>(...) | localFunctionCalls.kt:3:1:11:1 | x | ClassInstanceExpr |
1420-
| localFunctionCalls.kt:10:15:10:20 | <implicit coercion to unit> | localFunctionCalls.kt:3:1:11:1 | x | ImplicitCoercionToUnitExpr |
1421-
| localFunctionCalls.kt:10:15:10:20 | Integer | localFunctionCalls.kt:3:1:11:1 | x | TypeAccess |
1422-
| localFunctionCalls.kt:10:15:10:20 | Object | localFunctionCalls.kt:3:1:11:1 | x | TypeAccess |
1423-
| localFunctionCalls.kt:10:15:10:20 | Unit | localFunctionCalls.kt:3:1:11:1 | x | TypeAccess |
1424-
| localFunctionCalls.kt:10:15:10:20 | f1(...) | localFunctionCalls.kt:3:1:11:1 | x | MethodAccess |
1425-
| localFunctionCalls.kt:10:15:10:20 | new (...) | localFunctionCalls.kt:3:1:11:1 | x | ClassInstanceExpr |
1426-
| localFunctionCalls.kt:10:18:10:19 | 42 | localFunctionCalls.kt:3:1:11:1 | x | IntegerLiteral |
1417+
| localFunctionCalls.kt:10:5:10:13 | C1<Integer> | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1418+
| localFunctionCalls.kt:10:5:10:13 | Integer | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1419+
| localFunctionCalls.kt:10:5:10:13 | new C1<Integer>(...) | localFunctionCalls.kt:3:1:12:1 | x | ClassInstanceExpr |
1420+
| localFunctionCalls.kt:10:15:10:20 | <implicit coercion to unit> | localFunctionCalls.kt:3:1:12:1 | x | ImplicitCoercionToUnitExpr |
1421+
| localFunctionCalls.kt:10:15:10:20 | Integer | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1422+
| localFunctionCalls.kt:10:15:10:20 | Object | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1423+
| localFunctionCalls.kt:10:15:10:20 | Unit | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1424+
| localFunctionCalls.kt:10:15:10:20 | f1(...) | localFunctionCalls.kt:3:1:12:1 | x | MethodAccess |
1425+
| localFunctionCalls.kt:10:15:10:20 | new (...) | localFunctionCalls.kt:3:1:12:1 | x | ClassInstanceExpr |
1426+
| localFunctionCalls.kt:10:18:10:19 | 42 | localFunctionCalls.kt:3:1:12:1 | x | IntegerLiteral |
1427+
| localFunctionCalls.kt:11:5:11:13 | C1<Integer> | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1428+
| localFunctionCalls.kt:11:5:11:13 | Integer | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1429+
| localFunctionCalls.kt:11:5:11:13 | new C1<Integer>(...) | localFunctionCalls.kt:3:1:12:1 | x | ClassInstanceExpr |
1430+
| localFunctionCalls.kt:11:15:11:20 | <implicit coercion to unit> | localFunctionCalls.kt:3:1:12:1 | x | ImplicitCoercionToUnitExpr |
1431+
| localFunctionCalls.kt:11:15:11:20 | Integer | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1432+
| localFunctionCalls.kt:11:15:11:20 | Object | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1433+
| localFunctionCalls.kt:11:15:11:20 | Unit | localFunctionCalls.kt:3:1:12:1 | x | TypeAccess |
1434+
| localFunctionCalls.kt:11:15:11:20 | f1(...) | localFunctionCalls.kt:3:1:12:1 | x | MethodAccess |
1435+
| localFunctionCalls.kt:11:15:11:20 | new (...) | localFunctionCalls.kt:3:1:12:1 | x | ClassInstanceExpr |
1436+
| localFunctionCalls.kt:11:18:11:19 | 42 | localFunctionCalls.kt:3:1:12:1 | x | IntegerLiteral |
14271437
| samConversion.kt:2:5:2:45 | isEven | samConversion.kt:1:1:14:1 | main | LocalVariableDeclExpr |
14281438
| samConversion.kt:2:18:2:45 | (...)... | samConversion.kt:1:1:14:1 | main | CastExpr |
14291439
| samConversion.kt:2:18:2:45 | ...=... | samConversion.kt:2:18:2:45 | | AssignExpr |

java/ql/test/kotlin/library-tests/exprs/localFunctionCalls.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ fun x() {
88
x = 7
99
fun <T1> C1<T1>.f1(i: Int) = 5
1010
C1<Int>().f1(42)
11+
C1<Int>().f1(42)
1112
}
1213

1314
class C1<T> {}

0 commit comments

Comments
 (0)