You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing error for inconsistent TypeVar ordering in base classes #2371
When a class inherits from two bases that use the same TypeVars in different orders, pyrefly
should report an error. Currently it silently accepts this.
from typing import Generic, TypeVar
T1 = TypeVar("T1")
T2 = TypeVar("T2")
class Grandparent(Generic[T1, T2]): ...
class Parent(Grandparent[T1, T2]): ...
class BadChild(Parent[T1, T2], Grandparent[T2, T1]): ... # should error
Unittest already available in the codebase: pyrefly/lib/test/generic_basic.rs — test_inconsistent_type_var_ordering_in_bases
It seems that we have to make additional checks for ancestor class types when we iterate in MRO to see whether there already exist class type arguments. I can send a PR if you would like.
Activity
oopscompiled commentedon Feb 10, 2026
It seems that we have to make additional checks for ancestor class types when we iterate in MRO to see whether there already exist class type arguments. I can send a PR if you would like.
migeed-z commentedon Feb 10, 2026
@oopscompiled yeah, that approach makes sense to me. I will assign it to you! thank you so much!
fix class_metadata and regression test (facebook#2379)