Skip to content

Cannot track side effects in tupled for loop #107

Open
@fredokun

Description

@fredokun

The following program yields a fatal error :

def f(L):
    """ list[tuple[str, int]] -> int """
    # s : str
    # k : int
    s,k = L[0]
    for u,v in L[1:]:
        if v > k:
            k = v
    return k

The problem is in the for u, v in L[1:]: bit ...
and the error raised is the following one:

Traceback (most recent call last):
  ...
  File "../mrpython/typechecking/typechecker.py", line 328, in type_check_FunctionDef
    instr.type_check(ctx)
  File "../mrpython/typechecking/typechecker.py", line 596, in type_check_For
    for_node.side_effect(ctx)
  File "../mrpython/typechecking/side_effects_utils.py", line 279, in side_effect_For
    
  File "../mrpython/typechecking/side_effects_utils.py", line 267, in assign_extended
    linearize(ctx, working_var, aliases)
  File "../mrpython/typechecking/side_effects_utils.py", line 250, in linearize
    tmp.access(str(i))
  File "../mrpython/typechecking/side_effects_utils.py", line 41, in access
    if c != p:
NotImplementedError: error in side-effect-checking, please report

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions