diff options
| author | Hilton Chain <hako@ultrarare.space> | 2026-07-23 06:46:31 +0800 |
|---|---|---|
| committer | Hilton Chain <hako@ultrarare.space> | 2026-08-10 01:09:28 +0800 |
| commit | 4dd120dc3cccb142d4a7f9e0bd059c3ee42c50a2 (patch) | |
| tree | f0eec56a626809fd41c9722167102840e40129e1 | |
| parent | fbdd29305907111d79abaf208f4bd1ed5b46eebb (diff) | |
gexp: Allow gexp inputs when creating vectors using the read syntax.
* guix/gexp.scm (gexp) [collect-escapes, substitute-references]: Support vectors
created using the read syntax.
* tests/gexp.scm ("one input package, vector"): New test.
Merges: #10121
| -rw-r--r-- | guix/gexp.scm | 4 | ||||
| -rw-r--r-- | tests/gexp.scm | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index 8f9cb70d50f..02b05fb95eb 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm | |||
| @@ -1510,6 +1510,8 @@ execution environment." | |||
| 1510 | ((exp0 . exp) | 1510 | ((exp0 . exp) |
| 1511 | (let ((result (loop #'exp0 result))) | 1511 | (let ((result (loop #'exp0 result))) |
| 1512 | (loop #'exp result))) | 1512 | (loop #'exp result))) |
| 1513 | (#(exp ...) | ||
| 1514 | (loop #'(exp ...) result)) | ||
| 1513 | (_ | 1515 | (_ |
| 1514 | result)))) | 1516 | result)))) |
| 1515 | 1517 | ||
| @@ -1573,6 +1575,8 @@ execution environment." | |||
| 1573 | ((exp0 . exp) | 1575 | ((exp0 . exp) |
| 1574 | #`(cons #,(substitute-references #'exp0 substs) | 1576 | #`(cons #,(substitute-references #'exp0 substs) |
| 1575 | #,(substitute-references #'exp substs))) | 1577 | #,(substitute-references #'exp substs))) |
| 1578 | (#(exp ...) | ||
| 1579 | #`(list->vector #,(substitute-references #'(exp ...) substs))) | ||
| 1576 | (x #''x))) | 1580 | (x #''x))) |
| 1577 | 1581 | ||
| 1578 | (syntax-case s (ungexp output) | 1582 | (syntax-case s (ungexp output) |
diff --git a/tests/gexp.scm b/tests/gexp.scm index fcc269d75a7..2715a46ae5f 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm | |||
| @@ -194,6 +194,16 @@ | |||
| 194 | (package-derivation %store coreutils))) | 194 | (package-derivation %store coreutils))) |
| 195 | (gexp->sexp* exp))))) | 195 | (gexp->sexp* exp))))) |
| 196 | 196 | ||
| 197 | (test-assert "one input package, vector" | ||
| 198 | (let ((exp (gexp #((ungexp coreutils))))) | ||
| 199 | (and (gexp? exp) | ||
| 200 | (match (gexp-inputs exp) | ||
| 201 | ((input) | ||
| 202 | (eq? (gexp-input-thing input) coreutils))) | ||
| 203 | (equal? (vector (derivation->output-path | ||
| 204 | (package-derivation %store coreutils))) | ||
| 205 | (gexp->sexp* exp))))) | ||
| 206 | |||
| 197 | (test-assert "one input origin" | 207 | (test-assert "one input origin" |
| 198 | (let ((exp (gexp (display (ungexp (package-source coreutils)))))) | 208 | (let ((exp (gexp (display (ungexp (package-source coreutils)))))) |
| 199 | (and (gexp? exp) | 209 | (and (gexp? exp) |
