From eaa3cbaa9c2b1564a4b0db013672245a1893314a Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 12 Aug 2021 13:39:33 +0200 Subject: Array and dictionary indexing --- tests/typ/code/ops-invalid.typ | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'tests/typ/code/ops-invalid.typ') diff --git a/tests/typ/code/ops-invalid.typ b/tests/typ/code/ops-invalid.typ index 5e56ff98..e1662ddd 100644 --- a/tests/typ/code/ops-invalid.typ +++ b/tests/typ/code/ops-invalid.typ @@ -46,6 +46,20 @@ // Error: 2-10 cannot divide integer by length {3 / 12pt} +--- +// Error: 2-9 cannot repeat this string -1 times +{-1 * ""} + +--- +{ + let x = 2 + for _ in 0..60 { + x *= 2 + } + // Error: 4-18 cannot repeat this string 4611686018427387904 times + {x * "abcdefgh"} +} + --- // Error: 14-22 cannot add integer and string { let x = 1; x += "2" } @@ -63,11 +77,11 @@ { 1 .. "" } --- -// Error: 3-6 cannot assign to this expression +// Error: 3-6 cannot access this expression mutably { (x) = "" } --- -// Error: 3-8 cannot assign to this expression +// Error: 3-8 cannot access this expression mutably { 1 + 2 += 3 } --- @@ -75,7 +89,7 @@ { z = 1 } --- -// Error: 3-7 cannot assign to a constant +// Error: 3-7 cannot mutate a constant { rect = "hi" } --- -- cgit v1.2.3