Artifact 67a115f2d9aacd2adf96199d2eec3fb4f504480c419b410229563457bf163856:
- File typeparse/noyau/set-nom-substitue.patch — part of check-in [ca5801aeac] at 2026-10-23 09:44:57 on branch tip-764_tcl90 — The issue regarding the schedule no longer occurs: `set $r`—where `$r` is a `var<int>` link—correctly reads `::A` as of v13, and this remains the case in v15. While investigating, I discovered a similar scenario that was still failing, which I have now corrected (v15i). The remaining case tcl set nm2 {mm}n ;# a name carrying an annotation set $nm2 ;# v15: unknown type "mm" now: 7 The substituted name was being interpreted as a declaration in two places: within `set`, which passed it to the constructor; within the v14 redeclaration mechanism (`TclObjLookupVarEx`), which triggers upon every access—even a read—involving an annotated name. The applied rule A distinction must be made between two types of annotated names: Annotation Example Effect Written in the source `set {pt}p`, `lappend {list}M x` Declares (constructs using default values; triggers redeclaration) Carried by a substituted value `set $r`, `set $nm2` Declares nothing: a `set` command with a single argument performs a read, and a read operation does not trigger a redeclaration. The "schedule" rule—that "a `set` command with a single argument always performs a read"—could not be applied universally; for instance, `set {pt}p` (without a value) constructs an object using default values—a behavior that is explicitly documented. Consequently, this rule also applies to substituted names. There is a limitation, however. At runtime, an annotation written in the source can only be distinguished as such until it is resolved. Therefore, in a case like `set {rect}Q(A, $k) ...`—where the annotation is explicitly written but the remainder of the name is substituted—the original behavior persists whenever a value is present: it continues to perform a construction, as confirmed by test `t53`. For the same reason, a set $nm 9 is written (with an additional argument, the rule does not apply). Verifications Compared to v15, the project tests and examples remain unchanged, aside from previously known discrepancies. t35, t37, t52, t53, and t55 through t60 continue to yield their expected results. Regarding Tcl, there are 14 test files (covering variables, arrays, `set`, `upvar`, namespaces, etc.)—totaling 2,116 tests—which exhibit the same failures as in v15. I have verified that the four current kernel patches can be applied in sequence to a v15 build. Update Two type-related source files: `tclAnnotObj.c` and `tclTypes.h`. One kernel patch—`noyau/set-nom-substitue.patch`—which modifies `tclVar.c` and has been added to the end of `ORDRE.txt`. This is followed by `maj.sh`. A new test, `t61_set_nom_substitue`, has been added, along with a `v15i` section in `noyau/LISEZMOI.md`. This item has been marked as complete on the schedule. (user: Florentis, size: 1702) [annotate] [blame] [check-ins using]
--- a/generic/tclVar.c 2026-10-23 11:31:29.498106741 +0200 +++ b/generic/tclVar.c 2026-10-23 11:31:29.500388055 +0200 @@ -810,7 +810,10 @@ /* L'objet nom peut changer de représentation pendant la recherche : * garder l'annotation d'abord. */ - if (part2Ptr == NULL && TclIsAnnotated(part1Ptr)) { + if (part2Ptr == NULL && TclIsAnnotated(part1Ptr) + && (strcmp(msg, "read") != 0 || TclAnnotIsSourceRaw(part1Ptr))) { + /* Une LECTURE par un nom substitué qui porte un type ou des notes + * (set $r, $r étant un lien) ne redéclare rien : le nom est un nom. */ annot = Tcl_DuplicateObj(part1Ptr); Tcl_IncrRefCount(annot); } @@ -1555,9 +1558,29 @@ /* typed values: set {type}x ... ; and paths: set x(a.b) ... */ int rc; - if (TclIsAnnotated(objv[1])) { + if (TclIsAnnotated(objv[1]) + && (objc > 2 || TclAnnotIsSourceRaw(objv[1]))) { return TclSetAnnotatedCmd(interp, objc, objv); } + if (TclIsAnnotated(objv[1])) { + /* set $r : un set à un seul argument dont le nom SUBSTITUÉ porte un + * type ou des notes (un lien var<int>, {mm}n...) LIT ; seul un nom + * annoté dans le source (set {pt}p) construit avec les défauts. */ + Tcl_Obj **nv = (Tcl_Obj **) Tcl_Alloc(objc * sizeof(Tcl_Obj *)); + Tcl_Size nlen; + const char *nb = TclGetStringFromObj(objv[1], &nlen); + int i; + + for (i = 0; i < objc; i++) { + nv[i] = objv[i]; + } + nv[1] = Tcl_NewStringObj(nb, nlen); + Tcl_IncrRefCount(nv[1]); + rc = Tcl_SetObjCmd(NULL, interp, objc, nv); + Tcl_DecrRefCount(nv[1]); + Tcl_Free(nv); + return rc; + } rc = TclSetPathCmd(interp, objc, objv); if (rc != TCL_CONTINUE) { return rc;