facebookincubator / cinder

Cinder is Meta's internal performance-oriented production version of CPython.

Home Page:https://trycinder.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is bool a subtype of int?

LuKuangChen opened this issue · comments

commented

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).

We should be allowing this

commented

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

This should be fixed after 88dd90d. Thanks!