Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Update extra delegated properties operators to enable them in scripts #195

Closed
orangy opened this issue Dec 6, 2016 · 4 comments
Closed

Comments

@orangy
Copy link

orangy commented Dec 6, 2016

https://github.com/gradle/gradle-script-kotlin/blob/75f6ad011cd32c6ad2d8a607c5fa7555b6fa4769/src/main/kotlin/org/gradle/script/lang/kotlin/ExtraPropertiesExtensions.kt#L33-L33

Not really useful in the current setting until Kotlin supports local delegated properties (http://kotlin.link/articles/Kotlin-Post-1-0-Roadmap.html)

This is supported in Kotlin 1.1-M03, but you need to change Nothing? to Any? in getValue/setValue signatures.

@sdeleuze
Copy link

That would be very useful to be able to do that!

@bamboo
Copy link
Member

bamboo commented Dec 13, 2016

@orangy Nothing? seems to work just fine, the real problem is that Kotlin chokes on top level delegated extra property definitions.

@orangy
Copy link
Author

orangy commented Dec 13, 2016

Nothing? can work when there is no "receiver" instance, since it is null which is assignable to Nothing?. When in a script, receiver is actually a Project and it cannot be assigned to Nothing?, because it is not null.

@bamboo bamboo closed this as completed in 58b0650 Dec 13, 2016
@bamboo
Copy link
Member

bamboo commented Dec 13, 2016

Thanks, @orangy, it makes sense. I still find it a bit confusing that Nothing? would work inside a nested function or block but not at the top level.

bamboo added a commit that referenced this issue Dec 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants