Hi Patrick,
I think you are on the right track. I don't think that anyone is working on this.
You probably need to find a collaborator who is well versed in one of the type checker implementations -- adding a new construct like this is not a simple task!
Regarding your questions:
- int&str probably can't be satisfied because it would require multiple inheritance from two different C types (the instance layouts are incompatible). But if you had two unrelated classes C1 and C2 defined with class statements in Python, multiple inheritance could produce a type that satisfies C1&C2. Mypy doesn't generally take constraints due to object layout into account, since in the type stubs int and str are also defined using class statements. So it will probably have to accept int&str, but no type you can construct will satisfy it -- it acts as an effective bottom type (has no instances).
- The example with two typeddicts could be satisfied by creating a third typed dict that has both fields. This works:
from typing import *
class A(TypedDict):
x: int
class B(TypedDict):
y: str
class AB(TypedDict):
x: int
y: str
def f(a: A): ...
def g(b: B): ...
ab: AB = {'x': 1, 'y': ''}
f(ab)
g(ab)