KotlinIsland / KotlinIsland/basedmypy

Parenthesis on ambiguous types

Open
#438 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Currently in the output of messages, we show:
```
() -> A | B
```

```
A & B | C
```

Currently both these possible types render the same.

I wonder if we could also throw an error on denotation without parens in certain cases.
```py
a: A & B | C # error: This type annotation is ambiguous, you should change it to (A & B) | C
```

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests; start by tracing the type-rendering and annotation-denotation paths responsible for the shown output. Compare the two ambiguous forms and determine where parenthesized rendering or an ambiguity error belongs. Done means the forms render distinctly and the unparenthesized annotation reports the suggested parentheses.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.