mirror of
https://github.com/apple/pkl.git
synced 2026-05-28 09:39:17 +02:00
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:
+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