{
  "isError" : true,
  "request" : { },
  "response" : {
    "corrected" : [ "Basket (task.ek9): added 'default operator ?' - a construct with fields must say when it is set (E07235), and 'default' means set only when every field is set. For a rule of your own, replace it with 'override operator ? as pure' and a body." ],
    "diagnostics" : [ {
      "column" : 6,
      "errorCode" : "E08050",
      "file" : "task.ek9",
      "line" : 24,
      "message" : "❌ error   :[E08050]: '<-' on line 24 position 6: 'rtn': return value is not always initialised\n        ──▶ task.ek9:24:7\n        │\n     24 │       <- rtn as String?\n        │       ^^ '<-'\n        │\n        └─ 🔗 See: ek9 -h E08050\n",
      "richExplanation" : "[DIAGNOSIS]\nA function/method has a return variable that may not be initialized\non all possible execution paths.\n\n[EXAMPLES]\nCompilable examples demonstrating this error and the correct fix:\n  ek9 -q 688   (How does EK9 enforce variable initialization order?)\n\n[MUTATING OPERATORS ON RETURN PARAMETERS]\nReturn parameters declared without initialization (e.g., <- rtn as String?)\nCANNOT be used with mutating operators until initialized:\n\n- :=: (copy) and :~: (merge) - require existing value to copy/merge INTO\n- +=, -=, *=, /= etc. - require existing value to modify\n- ++, -- - require existing value to increment/decrement\n\n[A PATH THAT ENDS IN A THROW]\nA path that ends in an unconditional throw never returns, so it does not have to set the\nreturn variable - every arm of an if/else or switch that throws counts as covered. With\n'<- rtn as Integer?', an 'if' arm that assigns 'rtn: amount' and an 'else' arm that is just\n'throw Exception(\"Not positive\")' leave nothing unset.\nA throw inside an 'if' with no 'else' covers nothing (the other path still falls through),\nand a catch or finally that can run after the throw does not see the variable as set:\nreading it there is still E08020.\n\n[DYNAMIC FUNCTIONS]\nA dynamic function ('() extends SecurityGate as function', '() is Routine of (Boolean, Integer) as function')\ninherits its super's returning variable, but its body replaces the super's body - so the inherited variable\nstarts unassigned, whatever the super declared, and every path through the body must assign it. The error is\nreported at the dynamic function. Assign a default first (rtn: Boolean()), or assign on every branch.\n\n[ACTION]\n1. Initialize return parameter at declaration: <- rtn <- defaultValue\n2. Or use simple assignment (:) instead of mutating operators\n3. Or initialize before using mutating operators\n\n[COMMON CAUSES]\n- Return only set in some if branches (and the others neither set it nor throw)\n- A dynamic function setting its inherited return on only some paths\n- Using :=: or :~: on uninitialized return parameter\n- Loop might not execute\n- Expecting mutating operator to initialize\n\n[SEE ALSO]\n- E08050: return not initialized on all paths (this error)\n- E08020: variable used before initialized\n- E08060: variable might not be initialized",
      "severity" : "error"
    } ],
    "edits" : [ {
      "after" : "      default operator ?",
      "endLine" : 18,
      "file" : "task.ek9",
      "startLine" : 18,
      "type" : "insert"
    } ],
    "errorCount" : 1,
    "flags" : {
      "includeDev" : false,
      "mode" : "full",
      "noLink" : false,
      "optimisation" : "o2",
      "phaseUpTo" : "PRE_IR_CHECKS",
      "withDebug" : false,
      "withProfiling" : false
    },
    "meta" : {
      "serverMs" : "<timing>"
    },
    "nextStep" : "fix the diagnostics below - each carries its richExplanation, the corrective pattern - then ek9_compile again",
    "sourceCount" : 1,
    "status" : "failed",
    "summary" : "Compilation failed (mode: full, phase: PRE_IR_CHECKS, optimisation: o2): 1 source, 1 error, 0 warnings",
    "warningCount" : 0
  },
  "scenario" : "is_set_operator_applied_then_compiled",
  "tool" : "compile"
}
