Cannot assign property with fixed/const in spread (#428)

When using spread syntax with typed object, properties that are fixed
or const cannot be assigned or amended.
This should be checked in the checkTypedProperty() function.
This commit is contained in:
luuvish
2024-04-17 06:45:33 +09:00
committed by GitHub
parent 6e2ea07986
commit 2f0436ff2f
3 changed files with 52 additions and 13 deletions
@@ -0,0 +1,5 @@
amends "../basic/fixedProperty2.pkl"
p = new {
...new Dynamic { name = "Osprey" }
}
@@ -0,0 +1,14 @@
–– Pkl Error ––
Cannot assign to fixed property `name`.
x | ...new Dynamic { name = "Osprey" }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at cannotAssignFixedProperty3#p (file:///$snippetsDir/input/errors/cannotAssignFixedProperty3.pkl)
x | ...new Dynamic { name = "Osprey" }
^^^^
at cannotAssignFixedProperty3#p.name (file:///$snippetsDir/input/errors/cannotAssignFixedProperty3.pkl)
xxx | text = renderer.renderDocument(value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at pkl.base#Module.output.text (pkl:base)