Class QuestionMarkWithValue
? AND a value - <- rtn as String?: String()
becomes <- rtn as String: String() - for every editing tool. Use this; do not re-derive it.
The grammar's variableDeclaration takes an optional ? before any of its four
assignments - :, :=, =, :~: - but beside a value the ? MEANS
NOTHING. On a declaration WITHOUT a value it marks the variable uninitialised (the flow checks,
E08050); WITH one it only sets nullAllowed, which no compiler code reads. Measured
2026-09-28, in a property, a local and a return: Type? : v, ? := v, ? = v and
? :~: v each compile byte-identically to the same line without the ?.
Written WITHOUT the space, the lexer takes the ? into a longer token - ?: (the
Elvis operator, which also swallows the start of := and :~:) - and the declaration is a
syntax error: "unexpected '?:'". (?= is no longer a token - the guard was removed, Steve 2026-10-07 -
so Type?= v lexes as Type? = v, the spaced form, and E07300 brings it here.) The repair
keeps the value and the assignment the caller wrote and drops the ?: the program their
tokens denote, in its idiomatic spelling. (Spacing it instead - the first version - left a dead
? telling a reader "no value" about a variable that has one: Steve's catch.) A spaced form
compiles, so no diagnostic ever brings it here.
Measured (2026-09-28): 17 recorded runs carried ?: and 14 of them FAILED - the model
resends it, 40 refusals across edit_file, write_file, insert_statements and add_method; it was 7 of
cycle 8's 10 qwen3-coder failures on modify T10. The other joined spellings were never recorded;
they are the same rule.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe rewritten text and one note per rewrite;notesempty means nothing moved. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTrue whentexthas a line of the shape, joined or spaced - the cheap gate before a probe compile.static QuestionMarkWithValue.ResultRepair every declaration a diagnostic proves carries the?: the parser's "unexpected '?:'" (no error code) with its column exactly on the joined?, or the compiler's E07300 with its column exactly on the NAME of a spaced one.static Stringlinewith its declaration's JOINED?dropped, the assignment and value kept; null when the line is not that shape.static StringrepairedLines(String entry) entrywith every such line repaired; null when no line is that shape.
-
Field Details
-
SHAPE
[<-] name as [sanitized] Type? <op> value- the?joined to its assignment or spaced from it. Groups: 1 the lead (<-), 2 the name, 3as Type(it ends where the?starts), 4 the assignment, 5 the value.
-
-
Method Details
-
repaired
linewith its declaration's JOINED?dropped, the assignment and value kept; null when the line is not that shape. For statements, before the parser sees them - a spaced?parses, and the compile's E07300 brings it torepair(String, List). -
repairedLines
-
mayApply
True whentexthas a line of the shape, joined or spaced - the cheap gate before a probe compile. -
repair
public static QuestionMarkWithValue.Result repair(String text, List<Map<String, Object>> diagnostics) Repair every declaration a diagnostic proves carries the?: the parser's "unexpected '?:'" (no error code) with its column exactly on the joined?, or the compiler's E07300 with its column exactly on the NAME of a spaced one. Anything less certain is skipped and the caller's refusal stands. Rewrites within one line, so the receipts can follow (SourceRepairs).
-