Minimal repro:
def foo[T](a: T, b: T) -> T:
...
def test(x: int | None, y: int | None) -> int | None:
if x is None:
return foo(x, y)
return None
Expected: No error
Actual: Argument int | None is not assignable to parameter b with type None in function foo [bad-argument-type]