In this snippet:
from typing import Dict, Optional
class T:
def __init__(self):
self.bla = {}
def t(self) -> Dict:
if self.bla is None:
self.bla = {'not none': 'nope!'}
return self.bla
Can anyone explain why intellij / pycharm's type checker thinks the return value of this method is None?
The type checker only seems satisfied if I annotate the return type of t() to be Optional[Dict], but this method can never return None, so I don't think it should be optional.
If I change the initial value of self.bla in __init__() to {} it still things the return value is None. Same error if I use a str instead of a dict
