1.0.0 beta question


On the 1.0.0 beta release notes, it says this:

Type parameters for properties are prohibited unless they are used in the receiver type
Can I get an example of what that means? I'm having a problem with some code I had (which I knew it was going to break at some point :D) with this exact same error.

Basically, I had

private val <T, L> myVal : Map<Class<T>, SomeClass<T, L>>;

...which I know has problems, but for now I just want to know *when* you can actually have type parameters on properties.



You can only use type parameters in extension properties:

val <T> List<T>.foo: Int   get() = ...

and only if they appear in the receiver type (the type before the dot).


Ah, so "extension" was the word missing :)

Thank you Andrey, all clear now