Skip to content

invalid "object is not assignable" with class-scoped generic #1228

@KotlinIsland

Description

@KotlinIsland

Summary

from __future__  import annotations

class A[T]:
    def __init__(self, value: T) -> None:
        self.t: T = value
    def f(self, value: A[T]):
        _: A[T | int] = A(value.t)  # Object of type `A[T@A]` is not assignable to `A[T@A | int]`

Version

No response

Metadata

Metadata

Assignees

Labels

bidirectional inferenceInference of types that takes into account the context of a declared type or expected typegenericsBugs or features relating to ty's generics implementation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions