diff options
| author | Pg Biel <9021226+PgBiel@users.noreply.github.com> | 2023-07-26 18:03:33 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-26 23:03:33 +0200 |
| commit | 5bd97e218b698b2ad14fad0470b3b800469ee748 (patch) | |
| tree | cf3bdca070d0cc1f0bf72267fbe117f39eefd1f6 /tests | |
| parent | 8c6addeb9be07eebaefc78ec9e3d3d302e8baf34 (diff) | |
Update field mutation error message (#1742)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/compiler/dict.typ | 7 | ||||
| -rw-r--r-- | tests/typ/compiler/field.typ | 50 |
2 files changed, 50 insertions, 7 deletions
diff --git a/tests/typ/compiler/dict.typ b/tests/typ/compiler/dict.typ index 6a2f1c7c..b257394f 100644 --- a/tests/typ/compiler/dict.typ +++ b/tests/typ/compiler/dict.typ @@ -92,10 +92,3 @@ --- // Error: 3-15 cannot mutate a temporary value #((key: "val").other = "some") - ---- -#{ - let object = none - // Error: 3-9 expected dictionary, found none - object.property = "value" -} diff --git a/tests/typ/compiler/field.typ b/tests/typ/compiler/field.typ index 5c28a92c..a99959ea 100644 --- a/tests/typ/compiler/field.typ +++ b/tests/typ/compiler/field.typ @@ -148,3 +148,53 @@ #test((top + start).y, top) #test((bottom + end).y, bottom) #test((horizon + center).y, horizon) + +--- +#{ + let object = sym.eq.not + // Error: 3-9 cannot mutate fields on symbol + object.property = "value" +} + +--- +#{ + let object = [hi] + // Error: 3-9 cannot mutate fields on content + object.property = "value" +} + +--- +#{ + let object = calc + // Error: 3-9 cannot mutate fields on module + object.property = "value" +} + +--- +#{ + let object = calc.sin + // Error: 3-9 cannot mutate fields on function + object.property = "value" +} + +--- +#{ + let object = none + // Error: 3-9 none does not have accessible fields + object.property = "value" +} + +--- +#{ + let object = 10 + // Error: 3-9 integer does not have accessible fields + object.property = "value" +} + +--- +#{ + let s = 1pt + red + // Error: 3-4 fields on stroke are not yet mutable + // Hint: 3-4 try creating a new stroke with the updated field value instead + s.thickness = 5pt +} |
