Skip to content

calls_argument_type: literal None rejected for a X | None parameter #439

Description

@MelbourneDeveloper

Version

basilisk 0.35.0 (also present on 0.39.0).

What happens

Passing the literal None to a parameter declared dict[str, Any] | None is
reported as an error:

warning[calls_argument_type]: Argument `body` of `_probe` expects `dict[str, Any] | None`
but received a scalar literal where `dict[str, Any] | None` is required
— no type-variable assignment makes it valid

Minimal reproduction

from typing import Any


def probe(body: dict[str, Any] | None) -> None: ...


probe(None)  # warning[calls_argument_type]

Expected

No diagnostic. None is a member of dict[str, Any] | None by definition, so
the call is well-typed.

Notes

The message calls None "a scalar literal", which suggests the argument check
is comparing the literal against the dict[str, Any] member of the union only
and never trying the None member. A non-literal None-typed variable is
accepted at the same call site, so it looks specific to the literal path.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions