Skip to content

bug - Imported partial callable presets are not exported as public symbols #698

@dannymeijer

Description

@dannymeijer

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

Area

  • Incan Language (syntax/semantics)
  • Compiler (frontend/backend/codegen)

Summary

Expected: a top-level pub partial callable preset should be importable from another module like any other public callable symbol. Imported call sites should preserve the preset keyword arguments and expose only the remaining callable surface.

Actual: an imported public partial preset is rejected as private or not exported. In the larger InQL PR #44 fix attempt, using imported partial presets for registry spec builders also caused downstream generated Rust to treat the preset as the full underlying constructor rather than the narrowed callable surface.

Reproduction steps

  1. Create src/presets.incn:
pub model Spec:
    pub namespace: str
    pub policy: str
    pub klass: str
    pub lifecycle: str


"""Build a core portable spec."""
pub core_spec = partial Spec(namespace="core", policy="portable")
  1. Create tests/test_imported_partial.incn:
from presets import core_spec


def test_imported_partial_preset_keeps_presets() -> None:
    spec = core_spec(klass="scalar", lifecycle="v1")
    assert spec.namespace == "core"
    assert spec.policy == "portable"
    assert spec.klass == "scalar"
    assert spec.lifecycle == "v1"
  1. Run:
incan test tests/test_imported_partial.incn

Output / logs

Code generation error: typecheck failed (1 errors): Cannot import `core_spec` from `presets`: it is private or not exported. Mark it `pub` in that module.

Environment

OS: macOS
Rust: current project toolchain
Incan: 0.3.0-rc17, release/v0.3
Command: incan test tests/test_imported_partial.incn
Context: surfaced while fixing InQL PR #44 registry helper indirection by trying to replace simple spec-builder wrappers with partial FunctionSpec(...) presets.

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)

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions