C#: We can't do any reasoning based on unknown types on whether they match in a pattern.

This commit is contained in:
Michael Nebel
2025-03-05 11:14:23 +01:00
parent 5c0fc1f75b
commit b5ea34fcf3

View File

@@ -293,6 +293,8 @@ private predicate isMatchingConstant(PatternExpr pe, boolean value) {
value = true
or
exists(Type t, Type strippedType |
not t instanceof UnknownType and
not strippedType instanceof UnknownType and
typePatternMustHaveMatchingCompletion(pe, t, strippedType) and
not typePatternCommonSubType(t, strippedType) and
value = false