Bug Report
When a ternary is used in a with or an async with statement to determine the final context manager, mypy cannot infer the expression type.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=a2db21d63361bc0f1f334ff337509fca
Expected Behavior
The expression should lead to TaskGroup type.
Actual Behavior
The expression lead to object type.
Your Environment