Skip to content

Implement scope-aware import checking #313

@heartwilltell

Description

@heartwilltell

Phase 5: Compiler Integration — RFC #218

Enforce dependency scope rules at compile time. A regular .run file in a release build cannot import test-only or debug-only dependencies. Produce clear error messages indicating the scope violation.

Scope Rules (from RFC)

  • _test.run files may import from all scopes
  • Regular .run files in debug builds may import from dependencies, dev, and debug scopes
  • Regular .run files in release builds may import from dependencies and dev scopes only

Acceptance Criteria

  • Scope checking enforced based on file type and build mode
  • Clear error: error: "profiler" is a debug-only dependency and cannot be imported in release builds
  • Build mode (debug/release/test) threaded through compilation options
  • Tests for each scope combination

Files

  • Modified: src/resolve.zig

Dependencies

Can be worked on in parallel with #314 (multi-file compilation).

Part of the Package Manager RFC.

Metadata

Metadata

Assignees

Labels

compilerCompiler internals (IR, codegen, optimizer)enhancementNew feature or requestpackage-managerPackage manager (run.toml, dependencies, resolution)

Type

No fields configured for Task.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions