PatternAnalysis class
Defined in module l0_check_patterns (l0_check_patterns.py).
Case literals, validated enum patterns, and match coverage diagnostics.
Public static attributes
- static SemanticLookup lookup
- static CheckerState state
Protected functions
- auto _case_literal_info(self, Expr expr) -> tuple[Type, object]|None
- Get type and value for a case arm literal.
- auto _decode_escaped_bytes(self, str text, Node node) -> bytes|None
- Decode a string literal, reporting errors.
- auto _validate_match_variant_pattern(self, VariantPattern pattern, EnumType scrutinee_ty, EnumInfo|None enum_info) -> str|None
- Validate one match variant and return its canonical enum name.
- auto _match_coverage(self, MatchStmt stmt, EnumType scrutinee_ty, EnumInfo|None enum_info) -> MatchCoverage
- Validate patterns and compute coverage before traversing arm bodies.
- auto _check_exhaustiveness(self, MatchStmt stmt, EnumType scrutinee_ty, MatchCoverage coverage) -> bool
- Report match coverage diagnostics after checking all arm bodies.
Function documentation
MatchCoverage l0_check_patterns:: PatternAnalysis:: _match_coverage(self,
MatchStmt stmt,
EnumType scrutinee_ty,
EnumInfo|None enum_info) protected
Validate patterns and compute coverage before traversing arm bodies.
| Parameters | |
|---|---|
| stmt | Match statement being checked. |
| scrutinee_ty | Resolved enum type of the scrutinee. |
| enum_info | Resolved enum metadata, when available. |
| Returns | Validated variant names, wildcard reachability, and coverage sets. |
bool l0_check_patterns:: PatternAnalysis:: _check_exhaustiveness(self,
MatchStmt stmt,
EnumType scrutinee_ty,
MatchCoverage coverage) protected
Report match coverage diagnostics after checking all arm bodies.
| Parameters | |
|---|---|
| stmt | Match statement being checked. |
| scrutinee_ty | Resolved enum type of the scrutinee. |
| coverage | Validated patterns and reachability from before traversal. |
| Returns | Whether a wildcard or explicit variants cover the complete enum. |