Skip to content

pyrefly report ignores function declared in stub file #2259

@MarcoGorelli

Description

@MarcoGorelli

I have these two files:

(tmp-repo) marcogorelli@DESKTOP-U8OKFP3:~/tmp-repo$ cat foo/__init__.py
def one():
    return None

(tmp-repo) marcogorelli@DESKTOP-U8OKFP3:~/tmp-repo$ cat foo/__init__.pyi
from typing import Callable

one: Callable[[], None]

If I run pyrefly report foo, then I get:

{
  "/home/marcogorelli/tmp-repo/foo/__init__.pyi": {
    "line_count": 5,
    "functions": [],
    "suppressions": []
  },
  "/home/marcogorelli/tmp-repo/foo/__init__.py": {
    "line_count": 4,
    "functions": [
      {
        "name": "foo.one",
        "return_annotation": null,
        "parameters": [],
        "location": {
          "start": {
            "line": 1,
            "column": 1
          },
          "end": {
            "line": 2,
            "column": 16
          }
        }
      }
    ],
    "suppressions": []
  }
}

Note how we don't get any information for the function one in the stub file

pyright verifytypes includes:

        "symbols": [
            {
                "category": "function",
                "name": "foo.one",
                "referenceCount": 1,
                "isExported": true,
                "isTypeKnown": true,
                "isTypeAmbiguous": false,
                "diagnostics": []
            }
        ]

Metadata

Metadata

Assignees

Labels

needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions