Skip to content

Commit 0543e34

Browse files
committed
C#: Address review comment
1 parent e0c7f32 commit 0543e34

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

csharp/ql/src/semmle/code/csharp/controlflow/internal/Completion.qll

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,19 +269,16 @@ private predicate typePatternCommonSubType(Type t, Type strippedType) {
269269
* constantly non-matches (`value = false`).
270270
*/
271271
private predicate isMatchingConstant(PatternExpr pe, boolean value) {
272-
exists(Expr e | mustHaveMatchingCompletion(e, pe) |
273-
exists(Expr stripped | stripped = e.stripCasts() |
274-
exists(string strippedValue, string patternValue |
275-
strippedValue = stripped.getValue() and
276-
patternValue = pe.getValue() and
277-
if strippedValue = patternValue then value = true else value = false
278-
)
279-
)
280-
or
281-
pe instanceof DiscardPatternExpr and
282-
value = true
272+
exists(Expr e, string exprValue, string patternValue |
273+
mustHaveMatchingCompletion(e, pe) and
274+
exprValue = e.stripCasts().getValue() and
275+
patternValue = pe.getValue() and
276+
if exprValue = patternValue then value = true else value = false
283277
)
284278
or
279+
pe instanceof DiscardPatternExpr and
280+
value = true
281+
or
285282
exists(Type t, Type strippedType |
286283
typePatternMustHaveMatchingCompletion(pe, t, strippedType) and
287284
not typePatternCommonSubType(t, strippedType) and

0 commit comments

Comments
 (0)