Skip to content

Incorrect value for "infer-with-first-use" from pyrefly init on strict pyright config #3393

@JanEricNitschke

Description

@JanEricNitschke

Describe the Bug

I have the following pyright config:

[tool.pyright]
include                             = ["src"]
exclude                             = ["tests"]
typeCheckingMode                    = "strict"
deprecateTypingAliases              = true
reportCallInDefaultInitializer      = "error"
reportDeprecated                    = "error"
reportImplicitOverride              = "error"
reportImportCycles                  = "error"
reportPropertyTypeMismatch          = "error"
reportUnreachable                   = "error"
reportUnnecessaryTypeIgnoreComment  = "error"
reportMissingSuperCall              = "none"
reportUninitializedInstanceVariable = "none"
reportImplicitStringConcatenation   = "none"

and ran pyrefly init and it produced this config

[tool.pyrefly]
project-includes = ["src"]
project-excludes = ["tests"]
infer-with-first-use = false


[tool.pyrefly.errors]
implicitly-defined-attribute = "ignore"
deprecated = "error"

(note that additionally the tool.pyrefly section was at the very bottom of the pyproject.toml while the error one was somewhere in the middle in a fairly random place)

I think that is not correct, specifically the infer-with-first-use because pyright does not infer that as list[Any] but list[Unknown] and if reportUnknownMemberType is enabled we get errors there.

https://pyright-play.net/?pythonVersion=3.12&locale=en-us&reportUnknownMemberType=true&code=B4AgvCDaC6CwBQwB0BDADmgpgOwCYAoBGASgWXSz3wCIAma4oA

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions