pylint-dev / pylint-dev/astroid

Use UnionType when having multiple return values

Open
#154 0 comments 0 reactions 0 assignees View on GitHub
Enhancement ✨
Dominant language
Python
Stars
582
Forks
357
Avg merge
1d 1h
Merged PRs (30d)
23

Description

Originally reported by: **Claudiu Popa (BitBucket: [PCManticore](http://bitbucket.org/PCManticore), GitHub: @PCManticore)**

---

This is partially related to #153.

Currently, in lot of places where we are expecting multiple values as an inference result, we either retrieve the first one, using next, or we are returning to the upstream caller an YES object, in case we have multiple values returned.
This is partially a problem, because it leads to a partial understanding of the code by astroid.
In this case, we should return an UnionType with all the possible values and we should operate on that UnionType result.

---
- Bitbucket: https://bitbucket.org/logilab/astroid/issue/154

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the inference paths that currently retrieve only the first value with next or return a YES object when multiple values are possible, and review the related issue #153. Done means those paths preserve all possible inferred values in a UnionType and operate on that result rather than losing alternatives.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.