Antek
Antek

Reputation: 739

Augment assignment and increment are not supported for local delegated properties ans inline properties

as in title: Augment assignment and increment are not supported for local delegated properties ans inline properties - I get this for a following piece of code:

var timer by someDelegate { }
timer += someOtherValue

which compiled perfectly as long as half an hour ago. Cleaning the project and resetting Android Studio did not help.

Upvotes: 1

Views: 184

Answers (1)

holi-java
holi-java

Reputation: 30686

This is because this feature is not implemented yet, it's not a bug, :). here is the source code of the StackValue#L1815 in Kotlin 1.1.3 as below:

if (stackValue instanceof Delegate) {
    //TODO need to support
    throwUnsupportedComplexOperation(((Delegate) stackValue).variableDescriptor);
}

Why does the property can working with +=, this is because the Delegate is wrapped by getter/setter, which means it is invisible from the client code.

Upvotes: 1

Related Questions