Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Viper codegen produces incorrect code #940

@hugovincent

Description

@hugovincent

The following code runs correctly with the default or "native" codegens, but runs and produces incorrect output with the "viper" codegen:

@micropython.viper
def fib(n:int) -> int:
    if n == 0: return 0
    if n == 1: return 1
    return fib(n - 1) + fib(n - 2)

def test():
    res = []
    for i in range(36):
        res.append(str(fib(i)))
    print(' '.join(res))

test()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugenhancementFeature requests, new feature implementations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions