Skip to content

Commit 63a5e8a

Browse files
baywetmichaelnebel
andauthored
chore: applies review suggestions
Co-authored-by: Michael Nebel <michaelnebel@github.com>
1 parent 1617ace commit 63a5e8a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

csharp/ql/lib/Linq/Helpers.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ private predicate returnsDefaultValueAfterForeach(ForeachStmt fes) {
3535
enclosingBlock.getStmt(i + 1) = ret and
3636
elementType = fes.getVariable().getType()
3737
|
38-
ret.getExpr().stripCasts() instanceof NullLiteral and
38+
ret.getExpr().stripImplicit() instanceof NullLiteral and
3939
hasNullDefault(elementType)
4040
or
4141
exists(DefaultValueExpr defaultValue |
42-
defaultValue = ret.getExpr().stripCasts() and
42+
defaultValue = ret.getExpr().stripImplicit() and
4343
(
4444
defaultValue.getType() = elementType
4545
or
@@ -202,6 +202,7 @@ predicate missedFirstOrDefaultOpportunity(ForeachStmtGenericEnumerable fes, IfSt
202202
va = is.getCondition().getAChildExpr*()
203203
) and
204204
not is.getCondition().getAChildExpr*() instanceof AwaitExpr and
205+
not fes.isAsync() and
205206
returnsLoopVariable(fes, is.getThen()) and
206207
returnsDefaultValueAfterForeach(fes)
207208
}

0 commit comments

Comments
 (0)