Skip to content

Implement And and Or constraints#2977

Draft
zenlyj wants to merge 5 commits intopylint-dev:mainfrom
zenlyj:and-or-constraint
Draft

Implement And and Or constraints#2977
zenlyj wants to merge 5 commits intopylint-dev:mainfrom
zenlyj:and-or-constraint

Conversation

@zenlyj
Copy link
Copy Markdown
Contributor

@zenlyj zenlyj commented Feb 22, 2026

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
📜 Docs

Description

Add new And and Or constraints to aggregate existing constraints for expressions using and and or operators, enabling inference to combine multiple constraint patterns into a single composite constraint.

And/Or constraints are not derived if any operand in the boolean expression does not match a constraint pattern.

This does not directly fix a pylint issue, but imo it is a foundational change required for completeness before tackling pylint-dev/pylint#1498.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.32%. Comparing base (5e68b01) to head (51b9a95).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2977      +/-   ##
==========================================
+ Coverage   93.30%   93.32%   +0.02%     
==========================================
  Files          92       92              
  Lines       11301    11339      +38     
==========================================
+ Hits        10544    10582      +38     
  Misses        757      757              
Flag Coverage Δ
linux 93.18% <100.00%> (+0.02%) ⬆️
pypy 93.32% <100.00%> (+0.02%) ⬆️
windows 93.30% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
astroid/constraint.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zenlyj zenlyj marked this pull request as draft February 24, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant