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

Debug failure for invalid type alias statement #7933

Closed
dhruvmanila opened this issue May 16, 2024 · 1 comment
Closed

Debug failure for invalid type alias statement #7933

dhruvmanila opened this issue May 16, 2024 · 1 comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@dhruvmanila
Copy link

Describe the bug

It seems like the server is failing to possibly log the syntax error for the following code:

type def = 1

Here, def is a keyword but is not allowed in that position, only soft keywords are allowed there.

Code or Screenshots

The code is mentioned above. The error traceback is:

2024-05-16 07:51:24 [ERROR] An internal error occurred while parsing file "/Users/dhruv/playground/ruff/parser/_.py": Error: Debug Failure. False expression.
    at C._parseTypeAliasStatement (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/parser/parser.ts:481:9)
    at C._parseSmallStatement (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/parser/parser.ts:2982:33)
    at C._parseSimpleStatement (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/parser/parser.ts:2891:41)
    at C._parseStatement (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/parser/parser.ts:449:21)
    at callback (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/parser/parser.ts:267:44)
    at a.timeOperation (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/common/timing.ts:44:28)
    at C.parseSourceFile (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/parser/parser.ts:252:35)
    at t.SourceFile._parseFile (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/analyzer/sourceFile.ts:1414:23)
    at callback (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/analyzer/sourceFile.ts:647:47)
    at t.LogTracker.log (/opt/homebrew/lib/node_modules/pyright/dist/pyright-internal/src/common/logTracker.ts:61:20)

VS Code extension or command-line

I've tried it using both and I'm getting the same error on both:

  • Pyright version (via the CLI): pyright 1.1.363
  • Pylance version (via VS Code): v2024.5.1
@dhruvmanila dhruvmanila added the bug Something isn't working label May 16, 2024
erictraut added a commit that referenced this issue May 16, 2024
…5 type alias uses a keyword as a name. This addresses #7933.
@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label May 16, 2024
@erictraut
Copy link
Collaborator

This is addressed in pyright 1.1.364.

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