rpg_source.zig: settle() enforces the validator rules return and interface (also rpg_source_render_emit.zig, rpg_source_validate.zig) #790
Loading…
Reference in a new issue
No description provided.
Delete branch "enforce2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After
blocksandloop_exit(enforce1),settle()now also changes the emit for two more rules. They runonly when
refuseLate,refuseBlocksandrefuseLoopExitsflip nothing, on the current text; when anythingflips
settleresets and renders again as before. It never runsdropUnreferenced,nameSymbolsorfitGlobalsagain.return(refuseReturns, RNF5415): a procedure whose DCL-PI declares a return type and has no RETURNline.
returnPlaceholder(return VALUE; // SOURCERER-TODO return_value: ...,Entry.late_placeholder). It is a placeholder, never an emitted statement: the rendersubtracts it from
emittedand counts it inplaceholders.returnPlaceholderanswers null), theprocedure is demoted as
translatedoes when the type of the return value is not proved: its return typeis dropped (
dcl-pi *n;), its DCL-PROC becomes a failure line, and every emitted statement that calls it(
validate.calls, nowpub) becomes a failure line. The reasons end(validator: return); the DCL-PROCreason is the longest of five forms that still ends with it on the line cut at 100 characters.
interface(refuseInterfaces): a call that the validator finds to a procedure or prototype whose DCL-PI orDCL-PR holds a
fail_pi_parameter_v1orfail_pr_parameter_v1line becomes a failure line ending(validator: interface). This is the late form of the loop at the end ofdeclare.condition_literalandbif_numericare still reports.validator.countsafter the re-render is thevalidator on the final text. The columns and the mixed render are not read.
Measured, v0.1.506 build against this build (statements, emitted, failures, placeholders;
validatorcounts):bif_numeric1 andcondition_literal1 stay in each program,interfaceis 0 in all six. Of the 45 findings,23 become a placeholder RETURN (four in each program, three in asynctime) and 22 demote a procedure (5, 3, 4,
3, 4, 3 in the order of the table); the emitted fall is that procedure's DCL-PROC and its callers. These
programs do not compile today.
The 852 committed twin emits differ in two rows, both with the matrix verdict
failed:lsel-for-arr-if-if(the call to RETHROW is a failure line, emitted 19 to 18, failures 13 to 14) andreturn-switch-utf8-stripped(WORK dropsint(10)and its DCL-PROC is a failure line, emitted 3 to 2,failures 4 to 5). Every other emit is byte-identical, so no matching twin changes.
Tests:
src/rpg_source_enforce2_test.zig.Gate (coordinator, base v0.1.506)
lsel-for-arr-if-ifandreturn-switch-utf8-strippedchange, both matrix verdictfailed.(validator: return)or(validator: interface). The six Async programs and six others (lsel-for-arr-if-if, lsel-for-arr-if-sel, lext-ptr-ret-null-c, lpar-lk-const-read, lpar-lk-set-second, lpar-lk-two-same). Host round trip of those six under v0.1.506: all sixfailed compile_failedalready, so no host-matching case changes.a192c85fed48ca246dbf