[red-knot] Add control flow support for match statement (#13241)

## Summary

This PR adds support for control flow for match statement.

It also adds the necessary infrastructure required for narrowing
constraints in case blocks and implements the logic for
`PatternMatchSingleton` which is either `None` / `True` / `False`. Even
after this the inferred type doesn't get simplified completely, there's
a TODO for that in the test code.

## Test Plan

Add test cases for control flow for (a) when there's a wildcard pattern
and (b) when there isn't. There's also a test case to verify the
narrowing logic.

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
This commit is contained in:
Dhruv Manilawala 2024-09-10 02:14:19 +05:30 committed by GitHub
parent 6f53aaf931
commit 62c7d8f6ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 321 additions and 37 deletions

View file

@ -21,6 +21,7 @@ use crate::Db;
pub mod ast_ids;
mod builder;
pub(crate) mod constraint;
pub mod definition;
pub mod expression;
pub mod symbol;