groostav
08/17/2017, 8:16 PMhorse_badorties
08/18/2017, 8:27 AMuser
08/18/2017, 8:28 AMhorse_badorties
08/18/2017, 8:34 AMfoo(string1 = "b")
compileshorse_badorties
08/18/2017, 8:36 AMfun foo(string1: String, bool: Boolean = true) {}
fun main(args: Array<String>) {
foo("b")
}
compiles as wells.luhmirins
08/18/2017, 8:48 AMhorse_badorties
08/18/2017, 8:54 AMhorse_badorties
08/18/2017, 8:54 AMkarelpeeters
08/18/2017, 8:56 AMOnly one parameter may be marked as vararg . If a vararg parameter is not the last one in the list, values for the following parameters can be passed using the named argument syntax, or, if the parameter has a function type, by passing a lambda outside parentheses.
horse_badorties
08/18/2017, 8:59 AMfun foo(bool: Boolean = true, vararg strings: String) {}
is useless and here the vararg is the last in the list.
Maybe a compiler warning would do.karelpeeters
08/18/2017, 9:01 AMhorse_badorties
08/18/2017, 9:04 AMfun foo2(bool: Boolean = true, string: String) {}
doesn't make sense as well, so we might be talking about two different issues?! Not sure.karelpeeters
08/18/2017, 9:05 AMhorse_badorties
08/18/2017, 9:06 AMkarelpeeters
08/18/2017, 9:06 AMhorse_badorties
08/18/2017, 9:31 AMtask
with some "unclear" examples.
https://youtrack.jetbrains.com/issue/KT-19758karelpeeters
08/18/2017, 9:33 AMadeln
08/18/2017, 9:50 AMconvert to expression body
alt+enter intention gone?adeln
08/18/2017, 9:51 AMadeln
08/18/2017, 9:51 AMPasted image at 2017-08-18, 12:51 PM▾
karelpeeters
08/18/2017, 9:56 AMmenegatti
08/18/2017, 11:07 AM"${ it.Specification?.make.orEmpty() } ${ it.Specification?.model.orEmpty() }"
darkmoon_uk
08/18/2017, 11:11 AMdarkmoon_uk
08/18/2017, 11:14 AMsilas.schwarz
08/18/2017, 11:21 AMclass S3ContextBuilder(bucketName: String = "", s3Client: AmazonS3? = null) {
infix fun String.moveTo(destinationPath: String) {
this copyTo destinationPath
this.delete()
}
}
tipsy
08/18/2017, 12:41 PMMap<String, Array<String>>
with the same content
first one prints {a=[1],b=[1, 2]}
, second one prints {a=[Ljava.lang.String;@2bb4a0bf, b=[Ljava.lang.String;@6f7d77e2]}
the underlying datatype for the first one is String[]
, the other one is the result of calling toTypedArray()
.
but shouldn't these behave the same when they're both Map<String, Array<String>>
?karelpeeters
08/18/2017, 1:23 PMtipsy
08/18/2017, 1:26 PMuser
08/18/2017, 4:22 PMvillela
08/18/2017, 4:32 PM