A non-generic function is always more speciic than a generic function
Example:
fun <T> array(vararg array : T) = array
fun array(vararg array : Char) = array
fun test() {
array('1', '2') // ambiguity
}
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// A generic funciton is always less specific than a non-generic one
|
||||
fun foo<T>(t : T) : Unit {}
|
||||
fun foo(i : Int) : Int = 1
|
||||
|
||||
fun test() {
|
||||
foo(1) : Int
|
||||
foo("s") : Unit
|
||||
}
|
||||
Reference in New Issue
Block a user