Skip to content

(🎁) Report when generic base class specified multiple times with incompatible types #15348

@KotlinIsland

Description

@KotlinIsland
from typing import Generic, TypeVar

T = TypeVar("T")

class A(Generic[T]): 
    a: T

class B(A[float], A[int])  # error

class C(A[float]):
    pass 

class D(C, A[int]):  # no error
    pass

d = D()
d.a = 1.1  # What the heck?
c: C = d  # fishy
c.a = 1.1

This scenario seems quite fishy (🐟). What do you think? Leave a comment below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions