python / python/mypy

Errors from new parser can be worse (compared to old parser)

Open
#21,947 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-parser
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

This is a follow-up for https://github.com/python/mypy/pull/21823. Most notably something like this causes two errors with different error codes:

x = 0  # type: x y  # E: Syntax error in type comment "x y"  [syntax] \
                    # E: Invalid type comment or annotation  [valid-type]

Potentially we may want to add some filtering logic to improve/simplify syntax errors.
cc @JukkaL

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing pull request 21823 and reproducing the type-comment example shown here. Trace how the new parser reports its syntax and validity errors, then determine how diagnostics can be filtered or simplified so the result is not duplicated or contradictory; the issue does not specify an exact final message.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.