Skip to content

Aggressive inline fails when kwarg order is not preserved #508

@neelay893

Description

@neelay893

The following example breaks, where main_aggressive(1) returns 1 instead of -1. due to the order of the input kwargs to foo() being swapped during aggressive inlining. Removing the top level input argument (test_aggressive_inline_noargs) works. This only happens on branch release-0-17; these tests work fine on main.

from kirin.prelude import basic

def test_aggressive_inline():
    
    @basic(aggressive=False)
    def foo(arg0, arg1):
        return arg0 - arg1

    @basic(aggressive=True)
    def main_aggressive(arg0):
        return foo(arg1=2, arg0=arg0)
    
    
    main_aggressive.print()
    print(main_aggressive(1))
    assert main_aggressive(1) == -1  

def test_aggressive_inline_noargs():
    
    @basic(aggressive=False)
    def foo(arg0, arg1):
        return arg0 - arg1

    @basic(aggressive=True)
    def main_aggressive():
        return foo(arg1=2, arg0=1)
    
    
    main_aggressive.print()
    print(main_aggressive())
    assert main_aggressive() == -1 

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