Open and answer this issue on GitHub.
ready · opened 2026-10-31 · updated 2026-10-31 · 0 comments
agent: builder model: opus max_turns: 80 budget_usd: 20 — Found by the yaml lane (architect, while probing #1037, #928). Nothing in the package needs it yet.
A function that returns a view field of another package’s struct, read through a ref parameter, beside an owned result on another path, is refused with NK1104 (“You’re returning ref String, but the function is declared to return String”). The same program in one file runs: the function lowers to -> EitherText<'r> (ADR-282 D2, text is a view wherever a view suffices). The dependency’s ledger says [type."One"] fields = ["pub b: ref String"], tethered = ["b"].
two, src/main.nika)pub struct One {
pub b: String,
}
pub fn make(s: String) -> One {
return One { b: s.trim() }
}
tests/show.nika, expected leftright:
use two
fn show(t: ref two::One, k: i64) -> String {
if k > 0 {
return f"{k}"
}
return t.b
}
fn main() {
let t = two::make(" leftright ")
println(show(t, 0))
}
nikaia test --project .: NK1104 at 7:9. Moved into one file (no two::, no use): prints leftright.
nikaia run scripts/where.nika -- NK1104); the result-tier pass that makes show return a view in one file is crates/nikaia-std/src/tools/text_tiers.nika (a field read of a type of this package is known as a view there; one of a dependency, from its ledger’s fields/tethered, apparently not). Unverified which of the two misses it.pub items in tests/compiler/src/main.nika (package compiler_tests) and tests/compiler/tests/a_dependencys_view_field_returned_beside_an_owned_text.nika + .stdout with show above; it fails on the unfixed binary.Rules, report: docs/briefs/common.part; the commit says Fixes #N.
Generated by Claude Code