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
We lose information on assigning a type object to a variable #3067
classA: passB: Type[A]
reveal_type(B) # E: Revealed type is 'Type[__main__.A]'B=Areveal_type(B) # E: Revealed type is 'builtins.None'b=B() # E: None not callable
it seems the problem is that reveal_type calls meet_simple() on Type[A] and A, which are represented as TypeType and Callable. And meet_simple logic doesn't notice that they are compatible, so it returns None. I'm not sure what the difference is between meet_simple and meet_type, but the two would behave identically in this situation.
Attn @ilevkivskyi, who is hanging out in this area of code I think.
Unfortunately, it does not fix it, but if I understand everything correctly, the fix will be very simple with this PR merged. (Or maybe Jukka could include the fix in his PR if he prefers.)
Activity
gvanrossum commentedon Mar 27, 2017
Looks like a bug in the binder?
ilevkivskyi commentedon Mar 27, 2017
I think this is closely related to PR #3025, namely to
narrow_declared_type()it introduces.gvanrossum commentedon Mar 27, 2017
But #3025 hasn't landed yet. Are you saying it would fix this?
ilevkivskyi commentedon Mar 27, 2017
Unfortunately, it does not fix it, but if I understand everything correctly, the fix will be very simple with this PR merged. (Or maybe Jukka could include the fix in his PR if he prefers.)
ilevkivskyi commentedon Oct 7, 2018
This now works correctly.