Skip to content

Less strict checking *args + **kwargs call with known positional + keyword params #2864

@grievejia

Description

@grievejia

Describe the Bug

Minimal repro:

from typing import Any
def get_content(
    service_instance: Any,
    obj_type: str,
    property_list: list[str] | None = None,
    container_ref: Any = None,
) -> dict[str, Any]:
    return {}


def call_get_content(instance: Any, obj_type: str) -> dict[str, Any]:
    args: list[Any] = [instance, obj_type]
    kwargs = {
        "property_list": ["name"],
        "container_ref": None,
    }
    return get_content(*args, **kwargs)  # pyrefly: Multiple values for property_list, container_ref

I can see why we want to emit this error: we don't really know how long args is just from the types so we were being conservative. On the other hand, no other type checker chooses to emit errors for this example by default, so this might be more suitable as a strict-mode-only check.

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEALqcROgOZ0Q3G6UN0BBdKQA6WGGDpsYDAPoBjXOgYxlACjF0tdODEoA3CPJizWcBhmOJBwgDSbtubACtZTYjGvnK99NrrE1B58pLJQEObW4eYA2t4AunQAPnQAckowdAC8aRm%2B-orKqKx6spQS1kKk2bnoML4AlHQAtAB8dJhGDHEMPjak8YgOWuUMAK6UfsAAvmJz4pLyqFBQstJyhSrqZhboVv22dE6u7p46vU1tHV09fVWDw3SolGxwURHd9zUxO5b1Ry43MwYPFHgBrADuz1eNWAj38IhAgVwwSYYQ%2BiOsMUR6FQNBgiPi%2BX82kRm2KdUoZQkmNq9Uesz82lGEz86wUSi2DDUACpoXBDjyeZD%2BU06ABiAKkcpgKCkawAWTGUAYEGIsDo%2BmWY3gdDAvACQT0aOiDEO5JKVJlIFsSOlEjlhAYtCgFElAAV7bLqmgsHh8HRCpA2BNUKqlIQxJKAMowTIACwYDGIbwA9KmyDLHbw2KnVKnMLh5HBU0GICHKGGIEpU3qDagtdBUNgNWWK1WlEdiOH0HBI%2BgyAx40pmvo9HBq34coiAMyEACMACZEWIYnpqJQ4KD0GN0FweHwYJhmp1yvJVWOagBycvoXgwK9iO8MZrlACOYwg5WPYJgpGaqDyMYcBwNeUKTI%2B6AgNMtqAReMAAGLQDAFC%2BjgBAkOQ0xAA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    typecheckingusabilityUsability & readiness issues identified with running Pyrefly on top OSS projectsv1-consider-addingTop-ranked but not in V1 milestone (consider adding)

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions