From bf58fb2458d45d8f451efe78ff46a02f17786727 Mon Sep 17 00:00:00 2001 From: onatozmenn Date: Fri, 31 Jul 2026 18:20:15 +0300 Subject: [PATCH] Say what to press when Run was the wrong button Twenty-two of the twenty-nine examples are libraries: a module of functions and test blocks, with no `main` to enter through. Pressing Run on any of them answered "no `main` found", in red, and stopped there. The compiler is right. The page was unhelpful: it offers four verbs equally for every file and then leaves the reader holding a refusal with no next step, which reads as the page being broken rather than as a fact about the file they picked. So the refusal now carries a line saying a file with no `main` is a library, and a button that runs its tests. The line is the page talking and is written as such; the compiler's own answer is above it, unchanged. Matched on the answer rather than on which example is loaded, so it holds for a program somebody wrote in the editor too, and it survives the compiler saying it at more length, which deed-lang/deed#789 does. Co-authored-by: GitHub Copilot --- assets/play.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/assets/play.js b/assets/play.js index 1df0d50..5b40a12 100644 --- a/assets/play.js +++ b/assets/play.js @@ -208,6 +208,12 @@ function applyEdits(source, edits) { } OUTPUT.addEventListener("click", (event) => { + const instead = event.target.closest("button[data-instead]"); + if (instead) { + run(instead.dataset.instead); + return; + } + const button = event.target.closest("button.apply"); if (!button) return; @@ -263,6 +269,17 @@ function render(verb, json, source) { ? renderDiagnostic(item.diagnostic, source) : span("d-error", item.message), ); + // Twenty-two of the twenty-nine examples are libraries: a `module` of + // functions and `test` blocks, with no `main` to enter through. The + // compiler is right and the page was unhelpful, offering Run for all + // of them and then leaving the reader with a refusal and no next step. + // This is the page talking, not the compiler. + if (!item.ok && !item.diagnostic && /no `main`/.test(item.message ?? "")) { + out.push( + span("d-note", " Nothing here is wrong: a file with no `main` is a library.") + + `\n `, + ); + } break; case "test": out.push(