Class ConcatenationInterpolation

java.lang.Object
org.ek9lang.compiler.repair.ConcatenationInterpolation

public final class ConcatenationInterpolation extends Object
THE E11068 repair - a String built from three or more + parts - for every editing tool. Use this; the rendering is StringConcatRewriter.renderChain(EK9Parser.ExpressionContext, String, Function)'s, the same the rewrite tool performs.

E11068 is a quality rule the compiler raises AFTER resolution, on a chain it has already typed as String concatenation, and interpolating those same parts gives the same String - so the rewrite cannot change what the code does. <- rtn as String: customerName + ":" + $total becomes `${customerName}:${$total}`. Only chains within one line are rewritten (the receipts follow a rewrite within a line); an operand the rewrite tool would refuse - a conditional, a lambda, a collection literal - leaves the chain alone and the refusal stands.

Measured: 74 insert_statements refusals across the harness record, qwen3-coder T11 above all.

🔑 Also E07620 on a String +, for a chain of three or more parts (Steve, 2026-09-30, cycle 18 review item 16): customerName + ":" + total with total a Float does not compile - String's + takes a String - and the diagnostic names the String operand, which is the type evidence. Two spellings then compile, + $total and + $$total; the JSON form is never meant inside a String built from parts, so the chain is rendered by interpolation (`${customerName}:${total}`), re-verified as E11068's rewrite is. A two-part "x" + total is left to the caller - nothing says it is text-building.

  • Method Details

    • mayApply

      public static boolean mayApply(String text)
      True when some line holds two + and a quote - the cheap gate before a probe compile.
    • repair

      public static ConcatenationInterpolation.Result repair(String text, List<Map<String,Object>> diagnostics)
      Rewrite each chain an E11068 diagnostic sits on: the code must be E11068 and its line and column must be a + of a chain that parses, lies within that one line and renders. Right to left, so two chains on one line keep their columns.