Issue #2195: A method called on a tuple or on () is refused as a type the compiler can’t tell (NK1245), not as a method the type lacks (NK1171)

Open and answer this issue on GitHub.

ready · opened 2026-11-19 · updated 2026-11-19 · 0 comments

Found while drafting “The lock tests of std move into Nikaia programs” (#2189). No item of it waits for this: its programs use set(…; after:) under catch, as Part I 7.1 asks, and never call a method on the result. A reader who expects set to hand back a Result (and calls .is_ok() on it) meets this message instead of one that says what is wrong.

What happens today

Binary: target/release/nikaia (nikaia 0.1.0, built 2026-11-18 06:16 from develop), run in a scratch directory outside the checkout with nikaia run FILE.

fn main() throws {
    let n: SharedMut[Vec[i64]] = SharedMut([0])
    let r = n.set([1]; after: [0])
    println(f"{r.is_ok()}")
}
error[NK1245]: The compiler can't tell what type `r.is_ok()` is.
  --> isok.nika:4:5
   |
 4 |     println(f"{r.is_ok()}")
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: What is not known is not checked, so a type nothing can tell is refused rather than left to the language below.
   = help: Write the type down where the value is made, such as `let x: T = …`, or pass it to a parameter that declares one.
1 type error

Exit 1. The compiler does know the type of r: set hands back nothing, so r is (). The help asks for a type annotation, which cannot help.

The same NK1245, with nothing of the lock in it:

The same call on other types gives the right refusal:

No open issue names it (searched the titles for NK1245 with tuple and with method).

Expected

Cause

Suspected, from reading the code; item 1 checks it with a probe.

To build

  1. Check the cause: nikaia run scripts/where.nika -- check_core_call_on_type_name and a probe that prints the head a_member_nothing_writes_down receives for t.is_ok() (expected ""). A cause shown false is answered wrong I7: ... in the report.
  2. Refuse a method on a tuple or on () that no std entry and no trait provides as NK1171, naming the type as Ty::shown() writes it. The tuple methods std does describe (if any; item 1 lists them) stay accepted. Test: tests/compiler/tests/a_method_on_a_tuple_or_nothing_is_refused_as_missing.nika with its .stderr: is_ok on the result of set(…; after:), on the result of a function without a result, and on (1, 2); each gives NK1171, none NK1245.
  3. Sweep for the rule (I10): the other refusals in check_core_call_on that take type_name (nothing_says_what_a_parameter_can_do, no_number_has_this_method, a_list_collected) and the path and field checks in check_members.nika (t.name on a tuple, ().x): each that ends in NK1245 for a known type is fixed alike, with its case in the test of item 2. Name each one checked in the report.

Done when

Files and limits

Ruled out

Back to Open Issues