Skip to content

Warning "Op Not Converted: JUMP_IF_FALSE_OR_POP" when running unittest #27

@Chubby-Chocobo

Description

@Chubby-Chocobo

Hi, after trying to add some functions to the template, I got this kind of warning when running unit-tests:

[I 180619 08:00:35 pytoken:253] Op Not Converted: JUMP_IF_FALSE_OR_POP

I cut off my additional code, until there's only function declaration left, the warning still appears.
The function is like this:

def foo(ctx, param1, param2, param3):

    if param1 == 0:
        print('case1: param1 == 0')
        return 0

    if param2 == 0:
        print('case2: param1 == 0')
        return 0

    temp_var1 = 0
    stored_value1 = Get(ctx, 'value1')
    stored_value2 = Get(ctx, 'value2')
    stored_value3 = Get(ctx, 'value3')
    stored_value4 = Get(ctx, 'value4')
    stored_value5 = Get(ctx, 'value5')
    stored_value6 = Get(ctx, 'value6')

    if (stored_value1 <= param3) and (param3 <= stored_value2):
        if not Get(ctx, 'condition1'):
            print('case3: condition1')
            return 0

        temp_var1 = stored_value2 + param3
        temp_var2 = stored_value3 + param2

        if temp_var2 > stored_value4:
            stored_value7 = Get(ctx, 'value7')
            if stored_value7 > temp_var1:
                return 0

            return stored_value7

        if temp_var2 > stored_value5:
            temp_var1 = stored_value5 + stored_value6
            if (temp_var1 > param1):
                return stored_value6

        return temp_var1

    if (stored_value3 <= param3) and (param3 <= stored_value4):
        temp_var1 = param1 + param2 + param3
        return temp_var1

    return 0

The weird thing is if I remove some random statement, for example print('case1: param1 == 0') or temp_var1 = param1 + param2 + param3, the warning is gone.
The function is just declared, not used anywhere yet.
To reproduce, you can checkout this commit: Chubby-Chocobo@5e3a3b2, then run the unittest: python -m unittest discover tests

I asked on Discord, and @localhuman advised we should not ignore this warning.
I'm not sure whether it relate to neo-boa compiler or this ico-template, so I'm just report here. Please help to tag right people to check.
Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions