Skip to content

T: Never should be a subtype of Never #638

@dhruvmanila

Description

@dhruvmanila

Summary

Currently, the Type::has_relation_to has hardcoded the fact that no fully static type other than Never is a subtype of Never but that's incorrect because a type variable T with upper bound Never should also be a subtype of Never.

Playground: https://play.ty.dev/9b734d22-6fdf-4f20-a357-eea12caa5336

from typing import Never
from ty_extensions import static_assert, is_subtype_of

def _[T: Never]():
    # This is false, but should be true
    static_assert(is_subtype_of(T, Never))

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggenericsBugs or features relating to ty's generics implementationhelp wantedContributions especially welcometype propertiessubtyping, assignability, equivalence, and more

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions