8000 `compiled do` module cannot be expanded from a dependent package: "Unknown module" for its own sibling · Issue #444 · kexhq/kex · GitHub
[go: up one dir, main page]

Skip to content

compiled do module cannot be expanded from a dependent package: "Unknown module" for its own sibling #444

Closed

Description

@akoskovacs

A module that contains a compiled do block and imports a sibling module of its own package cannot be imported from another package. The package's own specs pass, because there it is the root package.

Reproduce

Harmat v0.1.0 is public and small. In a fresh package:

tey init app --app && cd app
tey add harmat --git https://github.com/kexhq/harmat --tag "~> 0.1"
# src/main.kex
using Harmat.Query, only: [sql]

main(args) do
  let q = sql$`SELECT ${1}`
  IO.printLine(q.statement)
end
$ tey run
:0:0: error: compile-time evaluation failed: …/src/harmat/query.kex:11:3: runtime error: Unknown module: Harmat.Schema
error: could not expand module Harmat.Query

Line 11 of query.kex is using Harmat.Schema, only: [Table, Cond, EqCond, NullCond]. using Harmat.Schema on its own from the same application works.

The same failure with the compiler called directly, on both backends, with either root order:

kex --source-root src --source-root ../harmat/src src/main.kex
kex -R --source-root ../harmat/src --source-root src src/main.kex

Expected

The compile-time evaluator resolves the dependency's modules from the dependency's own source root, as ordinary compilation does.

Impact

Any library built on compiled do (the query builder in docs/web-stack-plan.md is the main one) is unusable as a dependency. Harmat had to grow a second, runtime-only statement builder because of this.

Environment: Kex 0.4.0-rc.1 (30c7979), Tey 0.2.1, Erlang/OTP 29.0.5 (Homebrew), macOS arm64. Found while building an application on Rodolfo 0.2 and Harmat 0.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugMetaprogrammingModules

    Type

    No type

    Projects

    Milestone

    No milestone
    < 3534 h3 class="SectionHeaderTitle__dackeX headingReadonly__Oqs48- prc-Heading-Heading-MtWFE" data-component="Heading">Relationships
    None yet

    Development

    No branches or pull requests

    Issue actions

    0