Skip to content

fannkuch benchmark & implicit returns #115

@bennn

Description

@bennn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions