Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyright 1.1.289: str joining two sets #4470

Closed
FrancescElies opened this issue Jan 16, 2023 · 2 comments
Closed

pyright 1.1.289: str joining two sets #4470

FrancescElies opened this issue Jan 16, 2023 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@FrancescElies
Copy link

Describe the bug
The following snippet raises a pyright error, is this designed this way or a bug?

value = " ".join({f"{x}" for x in range(0, 10)} | {f"{x}" for x in range(5, 15)})
print(value)

To Reproduce

C:\s\mytest via 🐍 v3.11.1
❯ cat pyright_join_iter_literalstring.py
value = " ".join({f"{x}" for x in range(0, 10)} | {f"{x}" for x in range(5, 15)})
print(value)

C:\s\mytest via 🐍 v3.11.1
❯ python pyright_join_iter_literalstring.py
11 5 9 7 10 12 2 3 13 1 8 0 14 6 4

C:\s\mytest via 🐍 v3.11.1
❯ pyright pyright_join_iter_literalstring.py
No configuration file found.
No pyproject.toml file found.
stubPath C:\s\mytest\typings is not a valid directory.
Assuming Python platform Windows
Searching for source files
Found 1 source file
pyright 1.1.289
C:\s\mytest\pyright_join_iter_literalstring.py
  C:\s\mytest\pyright_join_iter_literalstring.py:1:18 - error: Operator "|" not supported for types "set[str]" and "set[str]"
    Operator "|" not supported for types "set[str]" and "set[str]" when expected type is "Iterable[LiteralString]" (reportGeneralTypeIssues)
1 error, 0 warnings, 0 informations
Completed in 0.612sec

C:\s\mytest via 🐍 v3.11.1 took 3s
❯ pyright --version
pyright 1.1.289

Expected behavior
For me it was surprising that pyright complained about operator not being supported, code as seen above runs, but maybe I am just missing something?

erictraut pushed a commit that referenced this issue Jan 16, 2023
…operator for two sets of str values within a `join` call. This addresses #4470.
@erictraut
Copy link
Collaborator

Thanks for the bug report. This was a long-standing bug that was recently unmasked by an unrelated change in pyright. It will be fixed in the next release.

@erictraut erictraut added bug Something isn't working addressed in next version Issue is fixed and will appear in next published version labels Jan 16, 2023
@erictraut
Copy link
Collaborator

This is included in pyright 1.1.290, which I just published. It will also be included in a future release of pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants