Mixing position and named arguments in a function


#1

package Kotlin101.Functions.NamedArguments

fun superHeroCapabilities (
  name : String,
  fly : Boolean = false,
  swim : Boolean = false,
  punch : Boolean = true
  ){
}

fun main (Args : Array<String>){
  var batman = superHeroCapabilities(“Batman”, fly = true)
}

This code generates the following error in 0.1.2847 "

Mixing named and positioned arguments in not allowed

Although according to <a href=“http://confluence.jetbrains.net/display/Kotlin/Functions”>http://confluence.jetbrains.net/display/Kotlin/Functions (which makes sense), the mixing is possible.


#2

This feature is not supported yet: http://youtrack.jetbrains.com/issue/KT-2106