Skip to content

Commit 7520948

Browse files
committed
C#: Add test case for finding lambdas with explicit return types.
1 parent 83a5ef4 commit 7520948

File tree

1 file changed

+8
-0
lines changed
  • csharp/ql/test/library-tests/csharp10

1 file changed

+8
-0
lines changed

csharp/ql/test/library-tests/csharp10/lambda.ql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ query predicate lambdaDeclaration(string type, LocalVariable v, LambdaExpr lexp)
1515
query predicate lambdaDeclarationNatural(string type, LocalVariable v, LambdaExpr lexp) {
1616
exists(LocalVariableDeclAndInitExpr e | getLambda(e, type, v, lexp) and e.isImplicitlyTyped())
1717
}
18+
19+
query predicate lambdaDeclarationExplicitReturnType(
20+
string type, string explicit, string actual, LocalVariable v, LambdaExpr lexp
21+
) {
22+
getLambda(_, type, v, lexp) and
23+
explicit = lexp.getExplicitReturnType().toStringWithTypes() and
24+
actual = lexp.getReturnType().toStringWithTypes()
25+
}

0 commit comments

Comments
 (0)