ML icon indicating copy to clipboard operation
ML copied to clipboard

No argument expansion for custom decorators with function parameters

Open khatchad opened this issue 1 year ago • 1 comments

Related to https://github.com/wala/ML/issues/91.

Consider the following code:

import tensorflow as tf


def mama(fun):

    def wrapper_fun(*args, **kwargs):
        assert isinstance(args[0], tf.Tensor)
        fun(*args, **kwargs)

    return wrapper_fun


@mama
def f(x):
    assert isinstance(x, tf.Tensor)


f(tf.constant(1))

Currently, Ariadne doesn't expand *args and **kwargs, so we miss the tensor parameter x of `().

khatchad avatar Apr 29 '24 19:04 khatchad

There's another case as well. The one in the description describes a scenario where the function has parameters. But, the decorator also could have parameters, and there's a different problem there.

khatchad avatar Apr 29 '24 19:04 khatchad