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:
1 parent
6e2ea07986
commit
2f0436ff2f
3 files changed
+52
-13
No files matched your search
+5
@@ -0,0 +1,5 @@
|
||||
amends "../basic/fixedProperty2.pkl"
|
||||
|
||||
p = new {
|
||||
...new Dynamic { name = "Osprey" }
|
||||
}
|
||||
+14
@@ -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)
|
||||
Reference in new issue
Block a user