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

Integer literal 0x8000000000000000 interpretted as 0x80000000000000c0 #4435

Closed
Shapedsundew9 opened this issue Jan 10, 2023 · 3 comments
Closed
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@Shapedsundew9
Copy link

Shapedsundew9 commented Jan 10, 2023

Issue

image
pylance seems to have trouble with an unsigned 64 bit literal. Notice the value it is interpreting is 0x80000000000000c0 (9223372036854776000)

Environment data

Pylance language server 2023.1.10 (pyright bbf0ae7)

Ubuntu 22.04.1 LTS

VS Code
Version: 1.74.2
Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161
Date: 2022-12-20T10:27:19.253Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.15.0-57-generic
Sandboxed: No

Python 3.10.6

Code Snippet

_GL_GC: Literal[9223372036854775808] = 0x8000000000000000

Expected behavior

Not identified as an error

Actual behavior

Error reported:

Expression of type "Literal[9223372036854776000]" cannot be assigned to declared type "Literal[9223372036854775808]"
"Literal[9223372036854776000]" cannot be assigned to type "Literal[9223372036854775808]"PylancereportGeneralTypeIssues

Logs

[Info  - 3:03:18 p.m.] (76782) Pylance language server 2023.1.10 (pyright bbf0ae78) starting
[Info  - 3:03:18 p.m.] (76782) Server root directory: /home/shapedsundew9/.vscode/extensions/ms-python.vscode-pylance-2023.1.10/dist
[Info  - 3:03:18 p.m.] (76782) Starting service instance "egp-types"
[Info  - 3:03:18 p.m.] (76782) Notebook support: LSP
[Info  - 3:03:18 p.m.] (76782) Interactive window support: LSP
[Info  - 3:03:18 p.m.] (76782) No configuration file found.
[Info  - 3:03:18 p.m.] (76782) pyproject.toml file found at /home/shapedsundew9/Projects/egp-types.
[Info  - 3:03:18 p.m.] (76782) Setting pythonPath for service "egp-types": "/home/shapedsundew9/Projects/venv/bin/python3"
[Info  - 3:03:18 p.m.] (76782) Loading pyproject.toml file at /home/shapedsundew9/Projects/egp-types/pyproject.toml
[Error - 3:03:18 p.m.] (76782) Pyproject file "/home/shapedsundew9/Projects/egp-types/pyproject.toml" is missing "[tool.pyright]" section.
[Error - 3:03:18 p.m.] (76782) venvPath /home/shapedsundew9/Projects/egp-types/~/Projects is not a valid directory.
[Warn  - 3:03:18 p.m.] (76782) stubPath /home/shapedsundew9/Projects/egp-types/typings is not a valid directory.
[Info  - 3:03:18 p.m.] (76782) Assuming Python version 3.10
[Info  - 3:03:18 p.m.] (76782) Assuming Python platform Linux
[Info  - 3:03:18 p.m.] (76782) Searching for source files
[Info  - 3:03:18 p.m.] (76782) Found 21 source files
[Info  - 3:03:19 p.m.] (76782) Background analysis(1) root directory: /home/shapedsundew9/.vscode/extensions/ms-python.vscode-pylance-2023.1.10/dist
[Info  - 3:03:19 p.m.] (76782) Background analysis(1) started
[Info  - 3:03:19 p.m.] (76782) Indexer background runner(2) root directory: /home/shapedsundew9/.vscode/extensions/ms-python.vscode-pylance-2023.1.10/dist (index)
[Info  - 3:03:19 p.m.] (76782) Indexing(2) started
[Info  - 3:03:19 p.m.] (76782) scanned(2) 240 files over 1 exec env
[Info  - 3:03:23 p.m.] (76782) [IDX(2)] Long operation: index execution environment /home/shapedsundew9/Projects/egp-types (3649ms)
[Info  - 3:03:23 p.m.] (76782) [IDX(2)] Long operation: index packages /home/shapedsundew9/Projects/egp-types (3652ms)
[Info  - 3:03:23 p.m.] (76782) indexed(2) 154 files over 1 exec env
[Info  - 3:03:23 p.m.] (76782) Indexing finished(2).
[Info  - 3:58:25 p.m.] (76782) Indexer background runner(3) root directory: /home/shapedsundew9/.vscode/extensions/ms-python.vscode-pylance-2023.1.10/dist (refresh)
[Info  - 3:58:25 p.m.] (76782) Indexing(3) started
[Info  - 3:58:26 p.m.] (76782) scanned(3) 240 files over 1 exec env

... [truncated as too long to post]

(76782) Background analysis message: getDiagnosticsForRange
(76782) [FG] parsing: /home/shapedsundew9/Projects/egp-types/egp_types/reference.py (41ms)
(76782) [FG] parsing: /home/shapedsundew9/.vscode/extensions/ms-python.vscode-pylance-2023.1.10/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 0ms] (110ms)
(76782) [FG] binding: /home/shapedsundew9/.vscode/extensions/ms-python.vscode-pylance-2023.1.10/dist/typeshed-fallback/stdlib/builtins.pyi (12ms)
(76782) [FG] binding: /home/shapedsundew9/Projects/egp-types/egp_types/reference.py (0ms)
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background inlayHint message
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background inlayHint message
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background analysis message: getDiagnosticsForRange
(76782) Background inlayHint message
@erictraut
Copy link
Collaborator

Moving to pyright since this is a core type checker issue.

@erictraut erictraut transferred this issue from microsoft/pylance-release Jan 11, 2023
@erictraut erictraut added bug Something isn't working and removed triage-needed labels Jan 11, 2023
erictraut pushed a commit that referenced this issue Jan 11, 2023
…iteral value — one that doesn't fit within a 53-bit mantissa. This addresses #4435.
@erictraut
Copy link
Collaborator

Thanks for the bug report. This will be addressed in the next release.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Jan 11, 2023
@erictraut
Copy link
Collaborator

This is included in pyright 1.1.289, 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

3 participants