10000 var-annotated error not showing up unless --cache-fine-grained is used · Issue #14732 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
var-annotated error not showing up unless --cache-fine-grained is used #14732
Closed as not planned
@patjakdev

Description

@patjakdev

Bug Report

mypy produces a set of var-annotated errors when running with --cache-fine-grained that it does not when run plainly. As far as I can tell, mypy's documentation doesn't indicate that there should be any difference in the set of errors returned between the two caching modes.

I came across this because I noticed that despite mypy . returning no errors when run at the command line, VSCode was highlighting these var-annotated errors, which seem real enough. Eventually, I figured out that VSCode is using dmypy in the background, which uses the fine-grained cache and I was able to reproduce the errors by using --cache-fine-grained at the command line.

To Reproduce

  1. Create a file main.py:
foo = None
  1. Run mypy main.py
  2. Run mypy --cache-fine-grained main.py

Expected Behavior

The output of steps 2 and 3 are the same.

Actual Behavior

Step 2 output:

% mypy main.py 
Success: no issues found in 1 source file

Step 3 output:

% mypy --cache-fine-grained main.py
main.py:1: error: Need type annotation for "foo" (hint: "foo: <type> | None = ...")  [var-annotated]
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 0.991, 1.0.0, 1.0.1
  • Mypy command-line flags: See above
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.9, 3.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0