Patrick
10/26/2019, 2:18 PMikozlowski
10/26/2019, 4:39 PMT:Any
but fails when I want to support nullable fields. Any idea how to cast other to not null type so I can access it class.members?
fun <T : Any?> assertk.Assert<T>.isEqualToIgnoringId(
other: T
) {
all {
if (other == null)
this.isEqualTo(null)
else
other?.let { it::class.members }
}
}
voldyman
10/26/2019, 7:01 PMCarson Graham
10/27/2019, 6:19 PMtasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xexperimental=kotlin.ExperimentalUnsignedTypes"
}
this to my build.gradle.kts, but it still warns me in intellijFudge
10/27/2019, 8:34 PMkarelpeeters
10/28/2019, 10:14 AMA
to instantiate a class B
, while keeping B
itself public? Basically I want B
to have a private constructor that can also be accessed by A
but not by a random class C
.
Putting A
and B
is the same file doesn't allow A
to use the private constructor, and even making B
a nested class of A
also doesn't work. Is there a solution?George Pandian
10/28/2019, 11:07 AMzceejkr
10/28/2019, 11:47 AMcompanion object : SomeType = someFunc()
. Or do you always have to declare the companion, as in companion object : SomeType {body}
?zceejkr
10/28/2019, 12:13 PMJavierSalazar
10/28/2019, 3:53 PMTravis Griggs
10/28/2019, 5:11 PMEllen Spertus
10/28/2019, 6:45 PMVoid
and has the following behavior:
override fun getResult(): Void {
if (!success) throw RuntimeException()
}
This doesn't compile, because a function with a block body requires a return statement.Brais Gabin
10/28/2019, 7:14 PM./gradlew ideaPluginTest
Travis Griggs
10/28/2019, 9:10 PMKroppeb
10/28/2019, 10:19 PMsealed class Foo<T:Any> {
object Bar : Foo<Nothing>()
class Baz(val p: String) : Foo<String>()
// I can do this
fun String.convert() = this.let(::Baz)
}
// One type argument expected for class Foo<T : Any>
fun String.convert2() = this.let(Foo::Baz)
typealias FooBaz = Foo.Baz
fun String.convert3() = this.let(::FooBaz)
I get an error if i try Foo::Baz
but adding a type makes Baz
an unresolved reference. The code does work if all generics are removed. Can I fix this without import statements?andrzej
10/29/2019, 11:10 AMclass Auto(val isNew: Boolean)
val car: Car? = Car(true)
why the following code works:
if (car?.isNew == true) println("new car")
and the following doesn't compile:
if (car?.isNew) println("new car")
Slackbot
10/29/2019, 1:04 PMeekboom
10/29/2019, 1:53 PMVinicius Araujo
10/29/2019, 3:01 PMmantono
10/29/2019, 4:20 PMfun <T: Any?> asArray(tClazz: Class<T>): Array<T>
, how ever, I have no idea how to return an Array of type T in Kotlin on a non-reified function with only the Class as argument.eekboom
10/29/2019, 4:34 PMjimn
10/29/2019, 5:31 PMTravis Griggs
10/29/2019, 5:55 PMPaul Woitaschek
10/29/2019, 7:15 PMTravis Griggs
10/30/2019, 12:45 AMwilliam
10/30/2019, 3:30 AMfor (i in 0..fooCount) {
foos.add(bar.getFoo(i))
}
Krotick
10/30/2019, 4:09 AMchandrut
10/30/2019, 7:20 AMUziel Sulkies
10/30/2019, 11:59 AMSlackbot
10/30/2019, 12:09 PMSlackbot
10/30/2019, 12:09 PMAri Dwi Prayogo
10/30/2019, 12:09 PM