Skip to content

Placeholder types are pinned too early #363

Closed as duplicate
Closed as duplicate

Description

@hurryabit

Describe the Bug

Consider the following code snippet:

def f[T](xs: list[T], y: T) -> None: pass

f([True], 42)

This should type check just fine since specialising T to int in the call to f is compatible with both arguments. However, pyrefly does not like this code and complains:

ERROR 3:11-13: Argument `Literal[42]` is not assignable to parameter `y` with type `bool` in function `f` [bad-argument-type]

My educated guess is that you're pinning the placeholder type introduced for the call to f too early.

Sandbox Link

https://pyrefly.org/sandbox/?code=CYUwZgBGDaAqC6AKAHgZwFwQDYEtUBc54AaCAT01gEoIBaAPggDkB7AOxEwAcBDVVAFACwiOACcAriBIQALACYqQA

(Only applicable for extension issues) IDE Information

No response

Activity

  1. yangdanny97 commented on May 26, 2025

    @yangdanny97
    Collaborator

    Thanks for reporting! I think this issue is being tracked by #105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    googleissues from google

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions