Cleanup warnings in stdlib and generated code
This commit is contained in:
@@ -33,6 +33,7 @@ fun elements(): List<GenericFunction> {
|
||||
only(Iterables, Sequences, ArraysOfObjects, ArraysOfPrimitives, Lists)
|
||||
doc { f -> "Returns first index of [element], or -1 if the ${f.collection} does not contain element." }
|
||||
typeParam("@kotlin.internal.OnlyInputTypes T")
|
||||
annotations(Lists) { """@Suppress("EXTENSION_SHADOWED_BY_MEMBER") // false warning, extension takes precedence in some cases""" }
|
||||
returns("Int")
|
||||
body { f ->
|
||||
"""
|
||||
@@ -82,6 +83,7 @@ fun elements(): List<GenericFunction> {
|
||||
only(Iterables, Sequences, ArraysOfObjects, ArraysOfPrimitives, Lists)
|
||||
doc { f -> "Returns last index of [element], or -1 if the ${f.collection} does not contain element." }
|
||||
typeParam("@kotlin.internal.OnlyInputTypes T")
|
||||
annotations(Lists) { """@Suppress("EXTENSION_SHADOWED_BY_MEMBER") // false warning, extension takes precedence in some cases""" }
|
||||
returns("Int")
|
||||
body { f ->
|
||||
"""
|
||||
@@ -538,6 +540,7 @@ fun elements(): List<GenericFunction> {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("${f.doc.collection.capitalize()} contains no ${f.doc.element} matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return last as T
|
||||
"""
|
||||
}
|
||||
@@ -710,6 +713,7 @@ fun elements(): List<GenericFunction> {
|
||||
}
|
||||
}
|
||||
if (!found) throw NoSuchElementException("${f.doc.collection.capitalize()} contains no ${f.doc.element} matching the predicate.")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return single as T
|
||||
"""
|
||||
}
|
||||
|
||||
@@ -426,7 +426,10 @@ object CommonArrays {
|
||||
returns("Unit")
|
||||
inline(Platform.JVM, Inline.Only)
|
||||
body(Platform.JVM) {
|
||||
"(this as Array<Any?>).sort()"
|
||||
"""
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(this as Array<Any?>).sort()
|
||||
"""
|
||||
}
|
||||
body(Platform.JS) {
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user