summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/typ/compiler/closure.typ18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/typ/compiler/closure.typ b/tests/typ/compiler/closure.typ
index 92d01446..85e9dbe2 100644
--- a/tests/typ/compiler/closure.typ
+++ b/tests/typ/compiler/closure.typ
@@ -132,6 +132,24 @@
}
---
+// Mutable method with capture in argument.
+#let x = "b"
+#let f() = {
+ let a = (b: 5)
+ a.at(x) = 10
+ a
+}
+#f()
+
+---
+#let x = ()
+#let f() = {
+ // Error: 3-4 variables from outside the function are read-only and cannot be modified
+ x.at(1) = 2
+}
+#f()
+
+---
// Named arguments.
#{
let greet(name, birthday: false) = {