[K/JS] Use declared upper-bound types for parameters inside inlined functions body, instead of the provided types

This commit is contained in:
Artem Kobzar
2023-06-20 12:01:28 +00:00
committed by Space Team
parent aa4ebe1991
commit 039b5fca7a
38 changed files with 269 additions and 53 deletions
+10 -9
View File
@@ -1140,7 +1140,7 @@ public actual fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
nativeFill(element, fromIndex, toIndex)
}
/**
@@ -1156,7 +1156,7 @@ public actual fun <T> Array<T>.fill(element: T, fromIndex: Int = 0, toIndex: Int
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
nativeFill(element, fromIndex, toIndex)
}
/**
@@ -1172,7 +1172,7 @@ public actual fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
nativeFill(element, fromIndex, toIndex)
}
/**
@@ -1188,7 +1188,7 @@ public actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: I
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
nativeFill(element, fromIndex, toIndex)
}
/**
@@ -1204,7 +1204,7 @@ public actual fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int =
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
nativeFill(element, fromIndex, toIndex)
}
/**
@@ -1220,7 +1220,7 @@ public actual fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
nativeFill(element, fromIndex, toIndex)
}
/**
@@ -1236,7 +1236,7 @@ public actual fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: I
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
nativeFill(element, fromIndex, toIndex)
}
/**
@@ -1252,7 +1252,7 @@ public actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex:
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
nativeFill(element, fromIndex, toIndex)
}
/**
@@ -1268,7 +1268,8 @@ public actual fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toInde
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size): Unit {
AbstractList.checkRangeIndexes(fromIndex, toIndex, size)
nativeFill(element, fromIndex, toIndex);
// We need to call [Char.code] here to eliminate Char-boxing with the new JS function inlining logic
nativeFill(element.code, fromIndex, toIndex)
}
/**