Skip to content

bug - Decorator-backed metadata cannot derive decorated callable identity and checked signature #694

@dannymeijer

Description

@dannymeijer

Thanks for reporting! Please include a minimal reproduction when possible.

Area

  • Incan Language (syntax/semantics)
  • Compiler (frontend/backend/codegen)
  • Tooling (CLI/formatter/test runner)

Summary

Expected: decorator-backed metadata should be able to derive or receive the decorated declaration's checked public identity and callable signature, so library APIs do not have to restate facts the compiler already knows.

Actual: library code can preserve callable type through generic decorator factories, and checked API metadata exposes public helper signatures, but decorator-backed metadata systems cannot use the decorated callable's checked name, parameters, parameter types, or return type to populate registry/catalog metadata. Libraries must duplicate those facts manually in decorator arguments or maintain separate metadata validation.

This is visible in the InQL RFC 015 function registry work. The target authoring shape is:

@function_registry.add(deterministic_spec(
    FunctionClass.Scalar,
    FunctionLifecycle(since=v0_3, changed=[], deprecated=None),
    FunctionNullBehavior.Predicate,
    extension_mapping("equal", EQUAL_FUNCTION_ANCHOR),
))
pub def eq(left: ColumnExpr, right: ColumnExpr) -> ColumnExpr:
    return registered_application([left, right])

The compiler/tooling should be able to associate the decorator-backed metadata with:

  • public helper name: eq
  • parameter names: left, right
  • parameter types: ColumnExpr, ColumnExpr
  • return type: ColumnExpr

Reproduction steps

  1. Define a generic registry-style decorator factory that accepts non-derivable metadata and returns the decorated callable unchanged.
  2. Apply it to a public function such as:
@function_registry.add(deterministic_spec(
    FunctionClass.Scalar,
    FunctionLifecycle(since=v0_3, changed=[], deprecated=None),
    FunctionNullBehavior.Predicate,
    extension_mapping("equal", EQUAL_FUNCTION_ANCHOR),
))
pub def eq(left: ColumnExpr, right: ColumnExpr) -> ColumnExpr:
    return registered_application([left, right])
  1. Try to build registry/catalog metadata from the decorator-backed library API without manually repeating "eq" or a second signature payload.
  2. Observe that the compiler exposes checked callable metadata elsewhere, but the decorator-backed metadata authoring path cannot consume it directly.

Current workaround:

@function_registry.add("eq", deterministic_spec(
    FunctionClass.Scalar,
    FunctionLifecycle(since=v0_3, changed=[], deprecated=None),
    FunctionNullBehavior.Predicate,
    extension_mapping("equal", EQUAL_FUNCTION_ANCHOR),
))
pub def eq(left: ColumnExpr, right: ColumnExpr) -> ColumnExpr:
    return registered_application("eq", [left, right])

Output / logs

There is no crash output. The failure mode is source-level metadata duplication and inability to express the intended decorator-backed metadata shape without restating compiler-known declaration facts.

Environment

OS: macOS
Rust: current project toolchain
Incan: 0.3.0-rc16, release/v0.3
Context: InQL RFC 015 local implementation work

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingincan compilerSuggestions, features, or bugs related to the Compiler (frontend/backend/codegen)incan language semanticsSuggestions, features, or bugs related to the Incan Language itself (syntax and semantics)toolingSuggestions, features, or bugs related to the Tooling (CLI/formatter/test runner)

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions