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

Skip to content

Commit 92e59a3

Browse files
tamasvajkigfoo
authored andcommitted
Add SAM conversion tests
1 parent eebfe56 commit 92e59a3

5 files changed

Lines changed: 268 additions & 193 deletions

File tree

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3079,6 +3079,49 @@ samConversion.kt:
30793079
# 43| 1: [IntegerLiteral] 22
30803080
# 43| -3: [TypeAccess] FunctionN<Boolean>
30813081
# 43| 0: [TypeAccess] Boolean
3082+
# 46| 3: [LocalVariableDeclStmt] var ...;
3083+
# 46| 1: [LocalVariableDeclExpr] d
3084+
# 46| 0: [CastExpr] (...)...
3085+
# 46| 0: [TypeAccess] SomePredicate<Integer>
3086+
# 46| 0: [TypeAccess] Integer
3087+
# 46| 1: [ClassInstanceExpr] new (...)
3088+
# 46| -4: [AnonymousClass] new SomePredicate<Integer>(...) { ... }
3089+
# 46| 1: [Constructor]
3090+
#-----| 4: (Parameters)
3091+
# 46| 0: [Parameter] <fn>
3092+
# 46| 5: [BlockStmt] { ... }
3093+
# 46| 0: [SuperConstructorInvocationStmt] super(...)
3094+
# 46| 1: [ExprStmt] <Expr>;
3095+
# 46| 0: [AssignExpr] ...=...
3096+
# 46| 0: [VarAccess] this.<fn>
3097+
# 46| -1: [ThisAccess] this
3098+
# 46| 1: [VarAccess] <fn>
3099+
# 46| 1: [FieldDeclaration] Function1<Integer,Boolean> <fn>;
3100+
# 46| -1: [TypeAccess] Function1<Integer,Boolean>
3101+
# 50| 3: [Method] fn
3102+
#-----| 4: (Parameters)
3103+
# 50| 0: [Parameter] i
3104+
# 46| 5: [BlockStmt] { ... }
3105+
# 46| 0: [ReturnStmt] return ...
3106+
# 46| 0: [MethodAccess] invoke(...)
3107+
# 46| -1: [VarAccess] <fn>
3108+
# 46| 0: [VarAccess] i
3109+
# 46| -3: [TypeAccess] SomePredicate<Integer>
3110+
# 46| 0: [TypeAccess] Integer
3111+
# 46| 0: [LambdaExpr] ...->...
3112+
# 46| -4: [AnonymousClass] new Function1<Integer,Boolean>(...) { ... }
3113+
# 46| 1: [Constructor]
3114+
# 46| 5: [BlockStmt] { ... }
3115+
# 46| 0: [SuperConstructorInvocationStmt] super(...)
3116+
# 46| 1: [Method] invoke
3117+
#-----| 4: (Parameters)
3118+
# 46| 0: [Parameter] a
3119+
# 46| 5: [BlockStmt] { ... }
3120+
# 46| 0: [ReturnStmt] return ...
3121+
# 46| 0: [BooleanLiteral] true
3122+
# 46| -3: [TypeAccess] Function1<Integer,Boolean>
3123+
# 46| 0: [TypeAccess] Integer
3124+
# 46| 1: [TypeAccess] Boolean
30823125
# 16| 2: [Interface] IntPredicate
30833126
# 17| 1: [Method] accept
30843127
#-----| 4: (Parameters)
@@ -3119,6 +3162,12 @@ samConversion.kt:
31193162
# 33| 20: [Parameter] i20
31203163
# 33| 21: [Parameter] i21
31213164
# 33| 22: [Parameter] i22
3165+
# 49| 6: [GenericType,Interface,ParameterizedType] SomePredicate
3166+
#-----| -2: (Generic Parameters)
3167+
# 49| 0: [TypeVariable] T
3168+
# 50| 1: [Method] fn
3169+
#-----| 4: (Parameters)
3170+
# 50| 0: [Parameter] i
31223171
whenExpr.kt:
31233172
# 0| [CompilationUnit] whenExpr
31243173
# 0| 1: [Class] WhenExprKt

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@
109109
| samConversion.kt:2:33:2:38 | ... % ... | samConversion.kt:2:33:2:34 | it | samConversion.kt:2:38:2:38 | 2 |
110110
| samConversion.kt:2:33:2:43 | ... (value equals) ... | samConversion.kt:2:33:2:38 | ... % ... | samConversion.kt:2:43:2:43 | 0 |
111111
| samConversion.kt:7:36:7:45 | ... (value equals) ... | samConversion.kt:7:36:7:39 | this | samConversion.kt:7:44:7:45 | |
112-
| samConversion.kt:10:14:10:18 | ... % ... | samConversion.kt:10:14:10:14 | j | samConversion.kt:10:18:10:18 | 2 |
113-
| samConversion.kt:10:14:10:23 | ... (value equals) ... | samConversion.kt:10:14:10:18 | ... % ... | samConversion.kt:10:23:10:23 | 0 |
114-
| samConversion.kt:12:14:12:18 | ... % ... | samConversion.kt:12:14:12:14 | j | samConversion.kt:12:18:12:18 | 2 |
115-
| samConversion.kt:12:14:12:23 | ... (value equals) ... | samConversion.kt:12:14:12:18 | ... % ... | samConversion.kt:12:23:12:23 | 1 |
112+
| samConversion.kt:10:18:10:22 | ... % ... | samConversion.kt:10:18:10:18 | j | samConversion.kt:10:22:10:22 | 2 |
113+
| samConversion.kt:10:18:10:27 | ... (value equals) ... | samConversion.kt:10:18:10:22 | ... % ... | samConversion.kt:10:27:10:27 | 0 |
114+
| samConversion.kt:12:18:12:22 | ... % ... | samConversion.kt:12:18:12:18 | j | samConversion.kt:12:22:12:22 | 2 |
115+
| samConversion.kt:12:18:12:27 | ... (value equals) ... | samConversion.kt:12:18:12:22 | ... % ... | samConversion.kt:12:27:12:27 | 1 |
116116
| whenExpr.kt:3:5:3:5 | ... (value equals) ... | whenExpr.kt:3:5:3:5 | tmp0_subject | whenExpr.kt:3:5:3:5 | 0 |
117117
| whenExpr.kt:4:5:4:5 | ... (value equals) ... | whenExpr.kt:4:5:4:5 | tmp0_subject | whenExpr.kt:4:5:4:5 | 1 |
118118
| whenExpr.kt:5:5:5:5 | ... (value equals) ... | whenExpr.kt:5:5:5:5 | tmp0_subject | whenExpr.kt:5:5:5:5 | 2 |

0 commit comments

Comments
 (0)