APrioriInvestments / typed_python

An llvm-based framework for generating and calling into high-performance native code from Python.
Apache License 2.0
197 stars 8 forks source link

Compiler can't call *args when it doesn't know how to pull apart 'args'. #426

Open braxtonmckee opened 1 year ago

braxtonmckee commented 1 year ago

This test should pass, but doesnt, because when the compiler knows args as : object, it just bails on the operator. At a minimum, it should be trying to explicitly unpack all arguments, and if it can't, should be deferring to the interpreter. Conceivably we could do better than this in cases where args or **kwargs just get passed through directly to another function, although that's not a particularly high-value use case.

    def test_star_args_with_object(self):
        def f(*args):
            return len(args)

        @Entrypoint
        def callF(args1: object, arg2, args3: object):
            return f(*args1, arg2, *args3)

        assert callF((1, 2), 3, (4, 5, 6)) == 6