S06012
Error Code
S06012
Error Message
A parameter with default value must be read only. RefId: S06012
Probable Causes
A parameter with a default value cannot be mutable
; otherwise, this
error occurs.
For example, an error may arise when defining the following named function because parameter "a" is given both a default value and a mutable decorator, which is not permitted.
def f(mutable a=1) {
print(a)
}
Solutions
-
Parameters with a default value should be immutable.
-
Mutable parameters should not be assigned a default value.
For example:
def f(mutable a) {
print(a)
}
def f(a=1) {
print(a)
}