python / python/mypy

(🐞) An error should be reported when `reveal_type` is used but not called

Open
#12,285 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature priority-2-low topic-reveal-type
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

reveal_type
not_defined
main.py:2:1: error: Name "not_defined" is not defined  [name-defined]
Found 1 error in 1 file (checked 1 source file)
Issue:

When reveal_type is called (reveal_type(1)) mypy reports a note and exits with status 1, but when reveal_type is used as a value without being called mypy doesn't report any error or note.

reveal_type

actual:

Success: no issues found in 1 source file

expected:

main.py:1:1: error: reveal_type must be called [misc]
Found 1 error in 1 file (checked 1 source file)

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 reproducing the reveal_type example in main.py and trace how mypy handles reveal_type(1) compared with a bare reveal_type expression. Done means the bare use reports reveal_type must be called [misc] and the existing called form continues to report its note.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.