ghedeon
01/18/2019, 11:03 AMpniederw
01/18/2019, 12:23 PMprovided
for their dependency on kotlin-stdlib?Dmitry Kandalov
01/18/2019, 2:20 PM.
is not allowed in kotlin function names even when backticked? Is there :youtrack: for this? (IIRC scala and groovy can have dots.)domfox
01/18/2019, 2:58 PMsubstring
, so you'd get a different exception in that case:
@NotNull
public static final String getDesc(@NotNull Class $receiver) {
Intrinsics.checkParameterIsNotNull($receiver, "$receiver");
if (Intrinsics.areEqual($receiver, Void.TYPE)) {
return "V";
} else {
String var10000 = createArrayType($receiver).getName();
Intrinsics.checkExpressionValueIsNotNull(var10000, "createArrayType().name");
String var1 = var10000;
byte var2 = 1;
if (var1 == null) {
throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
} else {
var10000 = var1.substring(var2);
Intrinsics.checkExpressionValueIsNotNull(var10000, "(this as java.lang.String).substring(startIndex)");
return StringsKt.replace$default(var10000, '.', '/', false, 4, (Object)null);
}
}
}
Eric O'Connell
01/18/2019, 6:58 PMSlackbot
01/18/2019, 11:00 PMDavide Giuseppe Farella
01/19/2019, 7:52 AMDalinar
01/19/2019, 1:41 PMgrandstaish
01/19/2019, 2:01 PMx::class
produces KClass<out T>
instead of just KClass<T>
in the following snippet?
class Test<T : Any>(val x: T) {
fun type(): KClass<T> = x::class // doesn't compile bc types don't match!
}
And a follow-up question, is there any way to make this compile without having to cast the result of x::class
to KClass<T>
?thana
01/19/2019, 4:12 PMtype
represents `x`'s type?altavir
01/19/2019, 5:12 PMSanthosh
01/19/2019, 5:20 PMDalinar
01/20/2019, 7:03 AMwhen (foo?.bar) {..}
- I can't see why it wouldn't be but just want to make sure about the nullgcx11
01/20/2019, 1:26 PMopen class Animal
class Dog: Animal() {
fun bark() = println("Huf huf!")
}
class Cat: Animal()
fun main() {
val numbers = arrayOf(1, 2, 3)
foo(numbers, Cat())
}
fun foo(numbers: Array<Int>, animal: Animal) {
if (numbers.isEmpty()) {
return
} else if (animal !is Dog) {
return
}
println(animal) // no autocast here
}
otakusenpai
01/20/2019, 1:31 PMval list = mutableListOf<Pair<String,String>>()
....
list.add(Pair(foo,bar))
But in my case this doesn't add a new item to the list.
All this is done inside a coroutinescope from a object of a class which has the above code.Happy
01/20/2019, 7:28 PMHullaballoonatic
01/20/2019, 9:04 PM<->
or something? would be cool if kotlin had one. NVM just gonna use also
Ryan Lynch
01/20/2019, 9:06 PMHullaballoonatic
01/21/2019, 5:41 AM..
operator to create descending ranges like 9..5
? Shouldn't it be somewhat trivial to put into the code to create one or the other based on the higher value? is it simply ambiguity?Hullaballoonatic
01/21/2019, 7:07 AMDmytro TOLSTYI
01/21/2019, 7:50 AMsuspend
function which I can't solve: I got function suspend fun one()
which executes some code and then calls a function that accepts a callback function as a param. But, this param function is not suspend. The issue is that I need to call another suspend fun from that callback param function. Here's an example:
suspend fun one() {
doSomething()
funWithNonSuspendCallback("data") {
two() // I need to call it from here but this is not suspend scope anymore
}
}
suspend fun two() {
}
louiscad
01/21/2019, 8:55 AMUByte
, UShort
, UInt
& ULong
) have their boxed versions cached in a reasonable range? On Android, all signed numbers are cached from -128 to +127 (i.e. full Byte
range, and part of Short
, Integer
and Long
)natpryce
01/21/2019, 9:38 AMSlackbot
01/21/2019, 10:02 AMSlackbot
01/21/2019, 11:31 AMLeoColman
01/21/2019, 12:01 PMContract
in my lib, to infer non-nullability in a nullable value, and let users use it. However I don't want to force the user to use the compiler option. Is this possible? Or should I wait for contracts release?snackycracky
01/21/2019, 2:57 PMmap
a SortedSet
without transitioning the whole thing to a List
?kschlesselmann
01/21/2019, 4:18 PMjw
01/21/2019, 4:49 PM@JvmName
Dalinar
01/21/2019, 6:30 PMClass.funname()
, however there is no class hereDalinar
01/21/2019, 6:30 PMClass.funname()
, however there is no class here