Area
- Compiler (frontend/backend/codegen)
Summary
Expected: Decorating a function should preserve default-argument call-site behavior. If a plain function can be called without an argument because the parameter has a default, the decorated version should support the same call shape.
Actual: A decorated function with a default argument is emitted as a Rust function that requires the argument. A zero-argument call to the decorated function fails during generated Rust compilation with E0061.
This blocks InQL PR #45 from exposing a clean count() / count(expr) aggregate helper through the existing registry decorator model. The non-decorated helper shape works, but the decorated public helper loses the default argument.
Reproduction steps
- Create
test_decorated_default_probe.incn with:
def identity(func: (int) -> int) -> (int) -> int:
return func
@identity
def decorated_default(value: int = 7) -> int:
return value
def plain_default(value: int = 7) -> int:
return value
def test_decorated_default_probe() -> None:
assert plain_default() == 7
assert decorated_default() == 7
- Run:
incan test test_decorated_default_probe.incn
- Observe that
plain_default() has its default filled, while decorated_default() is emitted as requiring one argument.
Output / logs
error[E0061]: this function takes 1 argument but 0 arguments were supplied
--> generated test code for decorated_default()
note: function defined here
generated decorated function has shape similar to:
fn decorated_default(__incan_arg_0: i64) -> i64
The exact generated file path varies by machine and is intentionally omitted here.
Environment
OS: macOS
Rust: current v0.3 development toolchain
Incan: release/v0.3, observed while testing the rc19-era compiler used by InQL PR #45
Command: incan test test_decorated_default_probe.incn
Related context
Related but not duplicate:
This bug is narrower: local decorated functions should preserve default-argument call-site filling.
Area
Summary
Expected: Decorating a function should preserve default-argument call-site behavior. If a plain function can be called without an argument because the parameter has a default, the decorated version should support the same call shape.
Actual: A decorated function with a default argument is emitted as a Rust function that requires the argument. A zero-argument call to the decorated function fails during generated Rust compilation with E0061.
This blocks InQL PR #45 from exposing a clean
count()/count(expr)aggregate helper through the existing registry decorator model. The non-decorated helper shape works, but the decorated public helper loses the default argument.Reproduction steps
test_decorated_default_probe.incnwith:incan test test_decorated_default_probe.incnplain_default()has its default filled, whiledecorated_default()is emitted as requiring one argument.Output / logs
The exact generated file path varies by machine and is intentionally omitted here.
Environment
OS: macOS
Rust: current v0.3 development toolchain
Incan: release/v0.3, observed while testing the rc19-era compiler used by InQL PR #45
Command:
incan test test_decorated_default_probe.incnRelated context
Related but not duplicate:
This bug is narrower: local decorated functions should preserve default-argument call-site filling.