facebookincubator / cinder

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

fannkuch benchmark & implicit returns #115

Open bennn opened 1 year ago

bennn commented 1 year ago

On Cinder 3.10, fannkuch_static_basic_lib.py gives a type error about implicitly returning None:

 File "fannkuch_static_basic_lib.py", line 15
    def fannkuch(n: int) -> int:
compiler.errors.TypedSyntaxError: Function has declared return type 'int' but can implicitly return None.

Here's a small program with the same error:

def main()->int:
  while 1:
    if 0:
      pass
    else:
      return 4

main()

A quick fix is to add return 0 or something to the bottom of fannkuch. But maybe the implicit return analysis needs an upgrade.

cc @vivaan2006 who helped discover this