facebookincubator / cinder

Cinder is Meta's internal performance-oriented production version of CPython.
https://trycinder.com
Other
3.42k stars 122 forks source link

Is bool a subtype of int? #46

Closed LuKuangChen closed 2 years ago

LuKuangChen commented 2 years ago

What version of Static Python are you using?

4f1b313 2021-07-27

What program did you run?

x: int = True

What happened?

The program errors.

compiler.static.errors.TypedSyntaxError: type mismatch: Exact[bool] cannot be assigned to int

What should have happened?

We expected no error because bool is a subclass of int (isinstance(True, int) is True).

DinoV commented 2 years ago

We should be allowing this

LuKuangChen commented 2 years ago

In general, if C is a subclass of D, is C also a subtype of D?

tekknolagi commented 2 years ago

This should be fixed after 88dd90d1fd43b3c751c3557ba5fc3a140717c3b1. Thanks!