pavel
02/13/2019, 11:45 PMinline
method that uses reified
generics. I want it to be recursive which is impossible. Is there a standard workaround?pavel
02/13/2019, 11:46 PMpavel
02/13/2019, 11:58 PMJeremy
02/26/2019, 11:02 AMRob
02/26/2019, 2:13 PMIaroslav Postovalov
02/26/2019, 3:44 PMIaroslav Postovalov
02/26/2019, 3:45 PMIaroslav Postovalov
02/26/2019, 3:49 PMkotlin
import io.github.commandertvis.command.command
import org.bukkit.command.CommandSender
data class MyArgs(val int: Int)
command<MyArgs, CommandSender>("plugin", "command", MyArgs::class) {
}
Iaroslav Postovalov
02/26/2019, 3:49 PMMarc Knaup
02/26/2019, 3:50 PMIaroslav Postovalov
02/26/2019, 3:52 PMNikky
02/27/2019, 9:33 AMinternal
modifierhho
02/27/2019, 9:38 AMinternal
is actually compiled to public
, but with mangled names.hho
02/27/2019, 9:39 AMaerialist
02/27/2019, 2:01 PMelect
02/27/2019, 2:20 PMMarc Knaup
02/27/2019, 2:28 PMAndrey Tarasevich
02/28/2019, 9:11 AMMap<,>
. First function compiles, although there was no explicit cast of immutable
to MutableMap
. Second function throws compiler error. Is this a desired behaviour?
class Foo(val map : Map<Int, String>)
fun test1() {
val foo = Foo(mutableMapOf(1 to "1"))
val mutable = foo.map as MutableMap // cast is first
val immutable = foo.map
mutable[0] = "1"
immutable[0] = "1" // no error, looks like compiler infers "immutable=foo.map" as MutableMap
}
fun test2() {
val foo = Foo(mutableMapOf(1 to "1"))
val immutable = foo.map
val mutable = foo.map as MutableMap // cast is second
mutable[0] = "12"
immutable[0] = "12" // compiler error
}
karelpeeters
02/28/2019, 9:14 AMfoo.map
is smartcast to MutableMap
, and then val immutable = foo.map
is mutable too of course. In the second one foo.map
is smartcast too, but the compiler doesn't go back and check all previous expressions and change their types.sitepodmatt
02/28/2019, 9:21 AMAndrey Tarasevich
02/28/2019, 9:22 AMserebit
02/28/2019, 7:13 PMMichael Al-Iskalachi
02/28/2019, 11:34 PMjacob
02/28/2019, 11:37 PMMichael Al-Iskalachi
02/28/2019, 11:59 PMamadeu01
03/01/2019, 12:55 PMamadeu01
03/01/2019, 12:55 PMelect
03/01/2019, 1:05 PMinline infix fun <reified C>VkDevice.allocateCommandBuffers(allocateInfo: VkCommandBufferAllocateInfo): C =
when(C::class) {
Array<VkCommandBuffer>::class -> Array(count) { .. } as C
ArrayList<VkCommandBuffer>::class -> ArrayList<VkCommandBuffer>(count) as C // error
On the second line the compiler complains:
Only classes are allowed on the left hand side of a class literal
elect
03/01/2019, 1:13 PMArrayList<VkCommandBuffer>::javaclass
doesnt complain, but it doesnt work though