before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
for (invalid in listOf(-1.00001, 1.00001, Double.NaN, Double.MAX_VALUE, -Double.MAX_VALUE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)) {
assertTrue(atanh(invalid).isNaN())
}
}
@Test fun cubeRoots() {
val testingPairs = mapOf(
Double.NaN to Double.NaN,
... | I don't think that the absolute tolerance is suitable here. For example, it fails in test for `kotlin-stdlib-js` with "Expected <0.9654893846056297> with absolute tolerance <1e-118>, actual <0.9654893846056298>". | assertAlmostEquals(approx, acosh(cosh(-approx)))
}
for (invalid in listOf(-1.0, 0.0, 0.99999, Double.NaN)) {
assertTrue(acosh(invalid).isNaN())
}
}
@Test fun inverseHyperbolicTan() {
for (exact in listOf(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,... | @@ -121,6 +121,30 @@ class DoubleMathTest {
}
}
+ @Test fun cubeRoots() {
+ val testingPairs = mapOf(
+ Double.NaN to Double.NaN,
+ Double.POSITIVE_INFINITY to Double.POSITIVE_INFINITY,
+ Double.NEGATIVE_INFINITY to Double.NEGATIVE_INFINITY,
+ Double... | libraries/stdlib/test/numbers/MathTest.kt | 26 | Kotlin | 0.571 | bug | 212 | 51 | 51 | false | KT-48232: Implement kotlin.math.cbrt() (cubic roots) | 4,790 | JetBrains/kotlin | 51,705 | Kotlin | ilya-g | romainguy | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/test/numbers/MathTest.kt
PR Title: KT-48232: Implement kotlin.math.cbrt() (cubic roots)
BEFORE CODE:
for (invalid in listOf(-1.00001, 1.00001, Double.NaN, Double.MAX_VALUE, -Double.MAX_VALUE, Double.NEGATIVE_INFINITY, Double.POSITIVE_... | I don't think that the absolute tolerance is suitable here. For example, it fails in test for `kotlin-stdlib-js` with "Expected <0.9654893846056297> with absolute tolerance <1e-118>, actual <0.9654893846056298>". | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
for (invalid in listOf(-1.00001, 1.00001, Double.NaN, Double.MAX_VALUE, -Double.MAX_VALUE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)) {
assertTrue(atanh(invalid).isNaN())
}
}
@Test fun cubeRoots() {
val testingPairs = mapOf(
Double.NaN to Double.NaN,
... | The value that is being compared here is `result`, not `x`. So taking `ulp` from x may be incorrect here. |
for (invalid in listOf(-1.00001, 1.00001, Double.NaN, Double.MAX_VALUE, -Double.MAX_VALUE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)) {
assertTrue(atanh(invalid).isNaN())
}
}
@Test fun cubeRoots() {
val testingPairs = mapOf(
Double.NaN to Double.NaN,
... | @@ -140,7 +154,7 @@ class DoubleMathTest {
)
for ((x, result) in testingPairs) {
- assertEquals(result, cbrt(x), 1e-15)
+ assertEquals(result, cbrt(x), if (x.isFinite()) 2.0 * x.ulp else 0.0) | libraries/stdlib/test/numbers/MathTest.kt | 26 | Kotlin | 0.5 | bug | 105 | 51 | 51 | false | KT-48232: Implement kotlin.math.cbrt() (cubic roots) | 4,790 | JetBrains/kotlin | 51,705 | Kotlin | ilya-g | romainguy | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/test/numbers/MathTest.kt
PR Title: KT-48232: Implement kotlin.math.cbrt() (cubic roots)
BEFORE CODE:
for (invalid in listOf(-1.00001, 1.00001, Double.NaN, Double.MAX_VALUE, -Double.MAX_VALUE, Double.NEGATIVE_INFINITY, Double.POSITIVE_... | The value that is being compared here is `result`, not `x`. So taking `ulp` from x may be incorrect here. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var error: Error? = nil
var completionCalled = 0
#if ALLOW_SUSPEND_ANY_THREAD
#if LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT
DispatchQueue.global().async {
CoroutinesKt.unitSuspendFun { _result, _error in
completionCalled += 1
result = _result
error = _error
}
... | You'd need to ensure that the background queue has finished executing the blocks by the time this is asserted. | var error: Error? = nil
var completionCalled = 0
let group = DispatchGroup()
#if ALLOW_SUSPEND_ANY_THREAD
#if LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT
DispatchQueue.global().async(group: group) {
CoroutinesKt.unitSuspendFun { _result, _error in
completionCalled += 1
result =... | @@ -48,6 +48,36 @@ private func testUnitCallSimple() throws {
try assertNil(error)
}
+private func testUnitCallNonMainDispatcher() throws {
+#if LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT
+ var result: KotlinUnit? = nil
+#endif
+ var error: Error? = nil
+ var completionCalled = 0
+
+#if ALLOW_SUSPEND_ANY_THRE... | kotlin-native/backend.native/tests/objcexport/coroutines.swift | 26 | Swift | 0.357 | suggestion | 110 | 51 | 51 | false | KT-51297: Allow suspend from any thread from ObjC | 4,827 | JetBrains/kotlin | 51,705 | Kotlin | nikolaykasyanov | ahmedre | Review this pull request change.
Language: Swift
File: kotlin-native/backend.native/tests/objcexport/coroutines.swift
PR Title: KT-51297: Allow suspend from any thread from ObjC
BEFORE CODE: var error: Error? = nil
var completionCalled = 0
#if ALLOW_SUSPEND_ANY_THREAD
#if LEGACY_SUSPEND_UNIT_FUNCTION_EXPOR... | You'd need to ensure that the background queue has finished executing the blocks by the time this is asserted. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
#import "ObjCExportErrors.h"
typedef void (^Completion)(id _Nullable, NSError* _Nullable);
extern "C" void Kotlin_ObjCExport_runCompletionSuccess(KRef completionHolder, KRef result) {
Completion completion = (Completion)GetAssociatedObject(completionHolder);
id objCResult = Kotlin_ObjCExport_refToLocalObjC(result... | There is a significantly simpler way to pass the value from compiler arguments to runtime.
See e.g. https://github.com/JetBrains/kotlin/blob/19658b3a4706284eeb21480f53fe2740ba60ce88/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt#L2779 and https://gith... | #import "ObjCExportErrors.h"
typedef void (^Completion)(id _Nullable, NSError* _Nullable);
extern "C" void Kotlin_ObjCExport_runCompletionSuccess(KRef completionHolder, KRef result) {
Completion completion = (Completion)GetAssociatedObject(completionHolder);
id objCResult = Kotlin_ObjCExport_refToLocalObjC(result... | @@ -36,8 +36,8 @@
extern "C" OBJ_GETTER(Kotlin_ObjCExport_createContinuationArgumentImpl,
KRef completionHolder, const TypeInfo** exceptionTypes);
-extern "C" OBJ_GETTER(Kotlin_ObjCExport_createContinuationArgument, id completion, const TypeInfo** exceptionTypes) {
- if (pthread_main_np() != 1) {
+extern "C" O... | kotlin-native/runtime/src/main/cpp/ObjCExportCoroutines.mm | 26 | Objective-C++ | 0.5 | suggestion | 479 | 51 | 51 | false | KT-51297: Allow suspend from any thread from ObjC | 4,827 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | ahmedre | Review this pull request change.
Language: Objective-C++
File: kotlin-native/runtime/src/main/cpp/ObjCExportCoroutines.mm
PR Title: KT-51297: Allow suspend from any thread from ObjC
BEFORE CODE: #import "ObjCExportErrors.h"
typedef void (^Completion)(id _Nullable, NSError* _Nullable);
extern "C" void Kotlin_ObjCE... | There is a significantly simpler way to pass the value from compiler arguments to runtime.
See e.g. https://github.com/JetBrains/kotlin/blob/19658b3a4706284eeb21480f53fe2740ba60ce88/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt#L2779 and https://gith... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
var error: Error? = nil
var completionCalled = 0
let group = DispatchGroup()
#if ALLOW_SUSPEND_ANY_THREAD
#if LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT
DispatchQueue.global().async(group: group) {
CoroutinesKt.unitSuspendFun { _result, _error in
completionCalled += 1
result =... | ```suggestion
try assertEquals(actual: completionCalled, expected: 1)
try assertNil(error)
``` | var error: Error? = nil
var completionCalled = 0
let group = DispatchGroup()
#if ALLOW_SUSPEND_ANY_THREAD
#if LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT
DispatchQueue.global().async(group: group) {
CoroutinesKt.unitSuspendFun { _result, _error in
completionCalled += 1
result =... | @@ -48,6 +48,39 @@ private func testUnitCallSimple() throws {
try assertNil(error)
}
+private func testUnitCallNonMainDispatcher() throws {
+#if LEGACY_SUSPEND_UNIT_FUNCTION_EXPORT
+ var result: KotlinUnit? = nil
+#endif
+ var error: Error? = nil
+ var completionCalled = 0
+
+ let group = DispatchGr... | kotlin-native/backend.native/tests/objcexport/coroutines.swift | 26 | Swift | 0.857 | suggestion | 105 | 51 | 51 | false | KT-51297: Allow suspend from any thread from ObjC | 4,827 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | ahmedre | Review this pull request change.
Language: Swift
File: kotlin-native/backend.native/tests/objcexport/coroutines.swift
PR Title: KT-51297: Allow suspend from any thread from ObjC
BEFORE CODE: var error: Error? = nil
var completionCalled = 0
let group = DispatchGroup()
#if ALLOW_SUSPEND_ANY_THREAD
#if L... | ```suggestion
try assertEquals(actual: completionCalled, expected: 1)
try assertNil(error)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// WITH_STDLIB
abstract class TypeToken<T>
fun interface I {
fun foo(): String
}
fun <T> foo() =
I {
(object : TypeToken<T>() {})::class.java.genericSuperclass.toString()
}.foo()
fun box(): String =
foo<String>().let { if (it == "TypeToken<T>") "OK" else... | Please add `package test` here, otherwise the test fails if run as a part of `compiler/android-tests` (explicit package directive helps since that configuration replaces package in each test with a unique name by regexp, and runs all tests in a single project) | // TARGET_BACKEND: JVM
// WITH_RUNTIME
// WITH_STDLIB
package test
abstract class TypeToken<T>
fun interface I {
fun foo(): String
}
fun <T> foo() =
I {
(object : TypeToken<T>() {})::class.java.genericSuperclass.toString()
}.foo()
fun box(): String =
foo<String>().let { if (it == "test.TypeT... | @@ -0,0 +1,16 @@
+// TARGET_BACKEND: JVM
+// WITH_RUNTIME
+// WITH_STDLIB
+abstract class TypeToken<T> | compiler/testData/codegen/box/sam/kt52417.kt | 6 | Kotlin | 0.643 | bug | 260 | 17 | 19 | false | JVM_IR: skip SAM lambdas when computing enclosing method of objects | 4,831 | JetBrains/kotlin | 51,705 | Kotlin | udalov | pyos | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/box/sam/kt52417.kt
PR Title: JVM_IR: skip SAM lambdas when computing enclosing method of objects
BEFORE CODE: // TARGET_BACKEND: JVM
// WITH_RUNTIME
// WITH_STDLIB
abstract class TypeToken<T>
fun interface I {
fun foo(): String
}... | Please add `package test` here, otherwise the test fails if run as a part of `compiler/android-tests` (explicit package directive helps since that configuration replaces package in each test with a unique name by regexp, and runs all tests in a single project) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private val _absentArguments = ReflectProperties.lazySoft {
val parameters = parameters
// arguments without masks and DefaultConstructorMarker or MethodHandle
val arguments = arrayOfNulls<Any?>(parameters.size + (if (isSuspend) 1 else 0))
// set absent values
parameters.for... | Since `clone` processing is required, it is defined as a function rather than a property. | private val _absentArguments = ReflectProperties.lazySoft {
val parameterSize = parameters.size + (if (isSuspend) 1 else 0)
val maskSize = (parameters.size + Integer.SIZE - 1) / Integer.SIZE
// Array containing the actual function arguments, masks, and +1 for DefaultConstructorMarker or Met... | @@ -112,65 +112,80 @@ internal abstract class KCallableImpl<out R> : KCallable<R>, KTypeParameterOwner
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
+ private val _absentArguments = ReflectProperties.lazySoft {
+ val parameters = param... | core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt | 26 | Kotlin | 0.357 | suggestion | 89 | 51 | 51 | false | KT-55178 Performance improvement of KFunction.callBy | 4,840 | JetBrains/kotlin | 51,705 | Kotlin | k163377 | k163377 | Review this pull request change.
Language: Kotlin
File: core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt
PR Title: KT-55178 Performance improvement of KFunction.callBy
BEFORE CODE: private val _absentArguments = ReflectProperties.lazySoft {
val parameters = parameters
// argu... | Since `clone` processing is required, it is defined as a function rather than a property. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
private fun getAbsentArguments(): Array<Any?> = _absentArguments().clone()
// See ArgumentGenerator#generate
internal fun callDefaultMethod(args: Map<KParameter, Any?>, continuationArgument: Continuation<*>?): R {
val parameters = parameters
val arguments = getAbsentArguments().appl... | I assume that the code below is also making the `isSuspend` determination, but is there any reason why it is not using the properties defined in the `KCallable` interface?
https://github.com/JetBrains/kotlin/blob/a366bd5e682133289647895aef2463f345a975cf/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl... |
for (i in 0 until maskSize) {
arguments[parameterSize + i] = 0
}
arguments
}
private fun getAbsentArguments(): Array<Any?> = _absentArguments().clone()
// See ArgumentGenerator#generate
internal fun callDefaultMethod(args: Map<KParameter, Any?>, continuationArgume... | @@ -112,65 +112,80 @@ internal abstract class KCallableImpl<out R> : KCallable<R>, KTypeParameterOwner
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
+ private val _absentArguments = ReflectProperties.lazySoft {
+ val parameters = param... | core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt | 26 | Kotlin | 0.571 | suggestion | 419 | 51 | 51 | false | KT-55178 Performance improvement of KFunction.callBy | 4,840 | JetBrains/kotlin | 51,705 | Kotlin | k163377 | k163377 | Review this pull request change.
Language: Kotlin
File: core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt
PR Title: KT-55178 Performance improvement of KFunction.callBy
BEFORE CODE: }
private fun getAbsentArguments(): Array<Any?> = _absentArguments().clone()
// See ArgumentGenerator... | I assume that the code below is also making the `isSuspend` determination, but is there any reason why it is not using the properties defined in the `KCallable` interface?
https://github.com/JetBrains/kotlin/blob/a366bd5e682133289647895aef2463f345a975cf/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
parameter.isVararg -> {}
else -> {
throw IllegalArgumentException("No argument provided for a required parameter: $parameter")
}
}
if (parameter.kind == KParameter.Kind.VALUE) {
valueParameterI... | Since it is not possible to copy from an `IntArray` to an `Array<Any?>` using `System.arraycopy`, a `for` loop is used. |
var valueParameterIndex = 0
var anyOptional = false
for (parameter in parameters) {
when {
args.containsKey(parameter) -> {
arguments[parameter.index] = args[parameter]
}
parameter.isOptional -> {
... | @@ -112,65 +112,80 @@ internal abstract class KCallableImpl<out R> : KCallable<R>, KTypeParameterOwner
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
+ private val _absentArguments = ReflectProperties.lazySoft {
+ val parameters = param... | core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt | 26 | Kotlin | 0.571 | suggestion | 119 | 51 | 51 | false | KT-55178 Performance improvement of KFunction.callBy | 4,840 | JetBrains/kotlin | 51,705 | Kotlin | k163377 | k163377 | Review this pull request change.
Language: Kotlin
File: core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt
PR Title: KT-55178 Performance improvement of KFunction.callBy
BEFORE CODE: }
parameter.isVararg -> {}
else -> {
throw Ille... | Since it is not possible to copy from an `IntArray` to an `Array<Any?>` using `System.arraycopy`, a `for` loop is used. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@Suppress("UNCHECKED_CAST")
override fun call(vararg args: Any?): R = reflectionCall {
return caller.call(args) as R
}
override fun callBy(args: Map<KParameter, Any?>): R {
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
... | By setting the abscent value in advance, processing can be omitted at the time of the call.
Even if the argument is set, it will be overwritten, so there is no effect. | @Suppress("UNCHECKED_CAST")
override fun call(vararg args: Any?): R = reflectionCall {
return caller.call(args) as R
}
override fun callBy(args: Map<KParameter, Any?>): R {
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
... | @@ -112,65 +112,80 @@ internal abstract class KCallableImpl<out R> : KCallable<R>, KTypeParameterOwner
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
+ private val _absentArguments = ReflectProperties.lazySoft {
+ val parameters = param... | core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt | 26 | Kotlin | 0.357 | suggestion | 168 | 51 | 51 | false | KT-55178 Performance improvement of KFunction.callBy | 4,840 | JetBrains/kotlin | 51,705 | Kotlin | k163377 | k163377 | Review this pull request change.
Language: Kotlin
File: core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt
PR Title: KT-55178 Performance improvement of KFunction.callBy
BEFORE CODE: @Suppress("UNCHECKED_CAST")
override fun call(vararg args: Any?): R = reflectionCall {
return calle... | By setting the abscent value in advance, processing can be omitted at the time of the call.
Even if the argument is set, it will be overwritten, so there is no effect. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
override val visibility: KVisibility?
get() = descriptor.visibility.toKVisibility()
override val isFinal: Boolean
get() = descriptor.modality == Modality.FINAL
override val isOpen: Boolean
get() = descriptor.modality == Modality.OPEN
override val isAbstract: Boolean
g... | This feels like an overkill, I propose to inline it. :) |
override val visibility: KVisibility?
get() = descriptor.visibility.toKVisibility()
override val isFinal: Boolean
get() = descriptor.modality == Modality.FINAL
override val isOpen: Boolean
get() = descriptor.modality == Modality.OPEN
override val isAbstract: Boolean
g... | @@ -112,65 +112,87 @@ internal abstract class KCallableImpl<out R> : KCallable<R>, KTypeParameterOwner
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
+ private val _parameterSizeWithContinuation = ReflectProperties.lazySoft { | core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt | 26 | Kotlin | 0.214 | suggestion | 55 | 51 | 51 | false | KT-55178 Performance improvement of KFunction.callBy | 4,840 | JetBrains/kotlin | 51,705 | Kotlin | udalov | k163377 | Review this pull request change.
Language: Kotlin
File: core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt
PR Title: KT-55178 Performance improvement of KFunction.callBy
BEFORE CODE:
override val visibility: KVisibility?
get() = descriptor.visibility.toKVisibility()
override val ... | This feels like an overkill, I propose to inline it. :) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
val maskIndex = parameterSize + (valueParameterIndex / Integer.SIZE)
arguments[maskIndex] = (arguments[maskIndex] as Int) or (1 shl (valueParameterIndex % Integer.SIZE))
anyOptional = true
}
parameter.isVararg -> {}
... | Fixed with [638d89c](https://github.com/JetBrains/kotlin/pull/4840/commits/638d89c033e2d6312fc3884c27dd1715dc118eae). | for (parameter in parameters) {
when {
args.containsKey(parameter) -> {
arguments[parameter.index] = args[parameter]
}
parameter.isOptional -> {
val maskIndex = parameterSize + (valueParameterIndex / Integer.SIZE... | @@ -112,65 +112,85 @@ internal abstract class KCallableImpl<out R> : KCallable<R>, KTypeParameterOwner
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
+ private val _absentArguments = ReflectProperties.lazySoft {
+ val parameterSize = pa... | core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt | 26 | Kotlin | 0.357 | suggestion | 117 | 51 | 51 | false | KT-55178 Performance improvement of KFunction.callBy | 4,840 | JetBrains/kotlin | 51,705 | Kotlin | k163377 | k163377 | Review this pull request change.
Language: Kotlin
File: core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt
PR Title: KT-55178 Performance improvement of KFunction.callBy
BEFORE CODE: val maskIndex = parameterSize + (valueParameterIndex / Integer.SIZE)
argume... | Fixed with [638d89c](https://github.com/JetBrains/kotlin/pull/4840/commits/638d89c033e2d6312fc3884c27dd1715dc118eae). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
arguments[parameterSize + i] = 0
}
arguments
}
private fun getAbsentArguments(): Array<Any?> = _absentArguments().clone()
// See ArgumentGenerator#generate
internal fun callDefaultMethod(args: Map<KParameter, Any?>, continuationArgument: Continuation<*>?): R {
val ... | The `Offset` is calculated first, and then subtracted from `parameter.index` only when the default argument is used, thereby reducing the amount of calculation.
[32cbe68](https://github.com/JetBrains/kotlin/pull/4840/commits/32cbe68ed38a0ff3f91f600d69dde94d1c0171c2) | }
arguments
}
private fun getAbsentArguments(): Array<Any?> = _absentArguments().clone()
// See ArgumentGenerator#generate
internal fun callDefaultMethod(args: Map<KParameter, Any?>, continuationArgument: Continuation<*>?): R {
val parameters = parameters
// Optimizat... | @@ -112,65 +112,87 @@ internal abstract class KCallableImpl<out R> : KCallable<R>, KTypeParameterOwner
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
+ private val _absentArguments = ReflectProperties.lazySoft {
+ val parameterSize = pa... | core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt | 26 | Kotlin | 0.643 | suggestion | 267 | 51 | 51 | false | KT-55178 Performance improvement of KFunction.callBy | 4,840 | JetBrains/kotlin | 51,705 | Kotlin | k163377 | k163377 | Review this pull request change.
Language: Kotlin
File: core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt
PR Title: KT-55178 Performance improvement of KFunction.callBy
BEFORE CODE: arguments[parameterSize + i] = 0
}
arguments
}
private fun getAbsentArguments... | The `Offset` is calculated first, and then subtracted from `parameter.index` only when the default argument is used, thereby reducing the amount of calculation.
[32cbe68](https://github.com/JetBrains/kotlin/pull/4840/commits/32cbe68ed38a0ff3f91f600d69dde94d1c0171c2) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
} else if (parameter.isVararg) {
arguments[parameter.index] = defaultEmptyArray(parameter.type)
}
}
for (i in 0 until maskSize) {
arguments[parameterSize + i] = 0
}
arguments
}
private fun getAbsentArguments(): Array<Any?> = ... | The following optimization to no-argument functions was found to be nearly twice as fast as 638d89c.
Does this optimization look like it should be incorporated?
```
Benchmark Mode Cnt Score Error Units
Measurement.zero thrpt 4 22299885.316 ± 295995.... | arguments[parameter.index] = defaultEmptyArray(parameter.type)
}
}
for (i in 0 until maskSize) {
arguments[parameterSize + i] = 0
}
arguments
}
private fun getAbsentArguments(): Array<Any?> = _absentArguments().clone()
// See Argume... | @@ -112,65 +112,87 @@ internal abstract class KCallableImpl<out R> : KCallable<R>, KTypeParameterOwner
return if (isAnnotationConstructor) callAnnotationConstructor(args) else callDefaultMethod(args, null)
}
+ private val _absentArguments = ReflectProperties.lazySoft {
+ val parameterSize = pa... | core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt | 26 | Kotlin | 1 | suggestion | 1,616 | 51 | 51 | false | KT-55178 Performance improvement of KFunction.callBy | 4,840 | JetBrains/kotlin | 51,705 | Kotlin | k163377 | k163377 | Review this pull request change.
Language: Kotlin
File: core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt
PR Title: KT-55178 Performance improvement of KFunction.callBy
BEFORE CODE: } else if (parameter.isVararg) {
arguments[parameter.index] = defaultEmptyArray(paramet... | The following optimization to no-argument functions was found to be nearly twice as fast as 638d89c.
Does this optimization look like it should be incorporated?
```
Benchmark Mode Cnt Score Error Units
Measurement.zero thrpt 4 22299885.316 ± 295995.... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// Check that local variables for inline functions and inline default lambdas start
// after they are initialized.
inline fun spray() {
val a = Any()
val b = Any()
val c = Any()
val d = Any()
val e = Any()
}
inline fun f(block: () -> String = { "OK" }): String = block()
fun box(): String {
//... | Please ignore the test for `JS` backend, otherwise `JsCodegenBoxTestGenerated.DefaultArguments.testKt52702` fails | // IGNORE_BACKEND: JS
// Check that local variables for inline functions and inline default lambdas start
// after they are initialized.
inline fun spray() {
val a = Any()
val b = Any()
val c = Any()
val d = Any()
val e = Any()
}
inline fun f(block: () -> String = { "OK" }): String = block()
fun ... | @@ -0,0 +1,23 @@
+// Check that local variables for inline functions and inline default lambdas start | compiler/testData/codegen/box/defaultArguments/kt52702.kt | 2 | Kotlin | 0.5 | bug | 113 | 24 | 25 | false | JVM IR: Start fake variables for default lambdas after initialization | 4,849 | JetBrains/kotlin | 51,705 | Kotlin | udalov | sfs | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/box/defaultArguments/kt52702.kt
PR Title: JVM IR: Start fake variables for default lambdas after initialization
BEFORE CODE: // Check that local variables for inline functions and inline default lambdas start
// after they are initial... | Please ignore the test for `JS` backend, otherwise `JsCodegenBoxTestGenerated.DefaultArguments.testKt52702` fails | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
plugins {
kotlin("js")
`maven-publish`
}
group = "org.jetbrains.kotlin"
repositories {
mavenCentral()
}
kotlin {
js() {
browser()
nodejs()
}
sourceSets {
js().compilations["main"].defaultSourceSet {
dependencies {
compileOnly(kotlin("stdlib... | Please also add here before `publishing {`: `configureCommonPublicationSettingsForGradle()`.
This will add common Kotlin publication info. | plugins {
kotlin("js")
`maven-publish`
}
group = "org.jetbrains.kotlin"
repositories {
mavenCentral()
}
kotlin {
js() {
browser()
nodejs()
}
sourceSets {
js().compilations["main"].defaultSourceSet {
dependencies {
compileOnly(kotlin("stdlib... | @@ -23,4 +24,12 @@ kotlin {
}
}
}
-}
\ No newline at end of file
+}
+ | plugins/atomicfu/atomicfu-runtime/build.gradle.kts | 26 | Kotlin | 0.5 | suggestion | 139 | 34 | 36 | false | Publish kotlinx-atomicfu-runtime module | 4,879 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | mvicsokolova | Review this pull request change.
Language: Kotlin
File: plugins/atomicfu/atomicfu-runtime/build.gradle.kts
PR Title: Publish kotlinx-atomicfu-runtime module
BEFORE CODE: plugins {
kotlin("js")
`maven-publish`
}
group = "org.jetbrains.kotlin"
repositories {
mavenCentral()
}
kotlin {
js() {
... | Please also add here before `publishing {`: `configureCommonPublicationSettingsForGradle()`.
This will add common Kotlin publication info. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
description = "Runtime library for the Atomicfu compiler plugin"
plugins {
kotlin("js")
`maven-publish`
}
group = "org.jetbrains.kotlin"
repositories {
mavenCentral()
}
kotlin {
js() {
browser()
nodejs()
}
sourceSets {
js().compilations["main"].defaultSourceSet {
... | I would propose to change name as well - could be done in `settings.gradle` after line 800:
```groovy
project(':kotlinx-atomicfu-runtime').name = 'atomicfu-runtime'
``` | description = "Runtime library for the Atomicfu compiler plugin"
plugins {
kotlin("js")
`maven-publish`
}
group = "org.jetbrains.kotlin"
repositories {
mavenCentral()
}
kotlin {
js() {
browser()
nodejs()
}
sourceSets {
js().compilations["main"].defaultSourceSet {
... | @@ -2,6 +2,7 @@ description = "Runtime library for the Atomicfu compiler plugin"
plugins {
kotlin("js")
+ `maven-publish`
}
group = "org.jetbrains.kotlin" | plugins/atomicfu/atomicfu-runtime/build.gradle.kts | 8 | Kotlin | 0.786 | suggestion | 168 | 33 | 33 | false | Publish kotlinx-atomicfu-runtime module | 4,879 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | mvicsokolova | Review this pull request change.
Language: Kotlin
File: plugins/atomicfu/atomicfu-runtime/build.gradle.kts
PR Title: Publish kotlinx-atomicfu-runtime module
BEFORE CODE: description = "Runtime library for the Atomicfu compiler plugin"
plugins {
kotlin("js")
`maven-publish`
}
group = "org.jetbrains.kotlin"... | I would propose to change name as well - could be done in `settings.gradle` after line 800:
```groovy
project(':kotlinx-atomicfu-runtime').name = 'atomicfu-runtime'
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
addChromeLauncher()
}
private fun usePropBrowsers() {
val propKey = "kotlin.js.browser.karma.browsers"
val propValue = project.findCompositeProperty("$propKey.${compilation.target.name}") ?: project.findCompositeProperty(propKey)
val propBrowsers = propValue?.toString()?.split("... | May it will be good to add else clause with an error or warning here, so misspelled words will be shown to user (with suggestion of available values), as not everyone would know all names | }
private fun usePropBrowsers() {
val propValue = project.kotlinPropertiesProvider.jsKarmaBrowsers(compilation.target)
val propBrowsers = propValue?.split(",")
propBrowsers?.map(String::trim)?.forEach {
when (it.toLowerCase()) {
"chrome" -> useChrome()
... | @@ -93,11 +95,41 @@ class KotlinKarma(
useMocha()
useWebpack()
useSourceMapSupport()
+ usePropBrowsers()
// necessary for debug as a fallback when no debuggable browsers found
addChromeLauncher()
}
+ private fun usePropBrowsers() {
+ val propKey = "... | libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/testing/karma/KotlinKarma.kt | 26 | Kotlin | 0.571 | suggestion | 187 | 51 | 51 | false | KT-52951 | 4,881 | JetBrains/kotlin | 51,705 | Kotlin | whyoleg | mpetuska | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/testing/karma/KotlinKarma.kt
PR Title: KT-52951
BEFORE CODE: addChromeLauncher()
}
private fun usePropBrowsers() {
val propKey = "kotlin.js.b... | May it will be good to add else clause with an error or warning here, so misspelled words will be shown to user (with suggestion of available values), as not everyone would know all names | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import org.jetbrains.kotlin.descriptors.SourceElement;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.metadata.jvm.deserialization.BitEncoding;
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion;
import org.jetbrains.kotlin.name.ClassId;
import org.jetbrai... | This doesn't compile because the class is not imported | import org.jetbrains.kotlin.descriptors.SourceElement;
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
import org.jetbrains.kotlin.metadata.jvm.deserialization.BitEncoding;
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion;
import org.jetbrains.kotlin.name.ClassId;
import org.jetbrai... | @@ -37,7 +37,16 @@
import static org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader.Kind.*;
public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor {
- private static final boolean IGNORE_OLD_METADATA = "true".equals(System.getProperty("kotlin.ignore.old.metadata"));
+
+ privat... | core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/header/ReadKotlinClassHeaderAnnotationVisitor.java | 26 | Java | 0.286 | suggestion | 54 | 51 | 51 | false | KT-52071 Fallback if Security Manager blocks reading system properties | 4,889 | JetBrains/kotlin | 51,705 | Kotlin | udalov | karlrwjohnson | Review this pull request change.
Language: Java
File: core/descriptors.jvm/src/org/jetbrains/kotlin/load/kotlin/header/ReadKotlinClassHeaderAnnotationVisitor.java
PR Title: KT-52071 Fallback if Security Manager blocks reading system properties
BEFORE CODE: import org.jetbrains.kotlin.descriptors.SourceElement;
impo... | This doesn't compile because the class is not imported | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// TARGET_BACKEND: JVM
// WITH_STDLIB
// Only implemented in the IR backend.
// IGNORE_BACKEND: JVM
import java.lang.reflect.Method
import kotlin.test.assertEquals
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class Ann(val x: String)
fun foo0(block: suspend () -> Unit) = bloc... | Let's check that `invoke` doesn't contain the annotation? | // TARGET_BACKEND: JVM
// WITH_STDLIB
// Only implemented in the IR backend.
// IGNORE_BACKEND: JVM
import java.lang.reflect.Method
import kotlin.test.assertEquals
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class Ann(val x: String)
fun foo0(block: suspend () -> Unit) = bloc... | @@ -0,0 +1,29 @@
+// TARGET_BACKEND: JVM
+// WITH_STDLIB
+// Only implemented in the IR backend.
+// IGNORE_BACKEND: JVM
+
+import java.lang.reflect.Method
+import kotlin.test.assertEquals
+
+@Target(AnnotationTarget.FUNCTION)
+@Retention(AnnotationRetention.RUNTIME)
+annotation class Ann(val x: String)
+
+fun foo0(blo... | compiler/testData/codegen/box/annotations/annotatedLambda/suspendLambda.kt | 20 | Kotlin | 0.357 | question | 57 | 30 | 45 | false | Add suspend lambda annotations to invokeSuspend. | 4,921 | JetBrains/kotlin | 51,705 | Kotlin | udalov | madsager | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/box/annotations/annotatedLambda/suspendLambda.kt
PR Title: Add suspend lambda annotations to invokeSuspend.
BEFORE CODE: // TARGET_BACKEND: JVM
// WITH_STDLIB
// Only implemented in the IR backend.
// IGNORE_BACKEND: JVM
import java.... | Let's check that `invoke` doesn't contain the annotation? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private fun KtClassOrObject.getObjCName(): ObjCName {
var objCName: String? = null
var swiftName: String? = null
var isExact = false
annotationEntries.firstOrNull {
it.calleeExpression?.constructorReferenceExpression?.getReferencedName() == objCNameShortName
}?.let { annotation ->
f... | > Empty or blank names aren't allowed, they are meant to be interpreted as `null`.
Why?
Aren't blank names valid for Objective-C selector fragments? E.g.
```objective-c
- (void)bar:(int)x :(int)y;
```
|
private fun KtClassOrObject.getObjCName(): ObjCName {
var objCName: String? = null
var swiftName: String? = null
var isExact = false
annotationEntries.firstOrNull {
it.calleeExpression?.constructorReferenceExpression?.getReferencedName() == objCNameShortName
}?.let { annotation ->
f... | @@ -1016,8 +1015,8 @@ private fun KtClassOrObject.getObjCName(): ObjCName {
for (argument in annotation.valueArguments) {
val argName = argument.getArgumentName()?.asName?.asString() ?: (argNames - processedArgs).firstOrNull() ?: break
when (argName) {
- "name" -> objCN... | kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt | 26 | Kotlin | 0.929 | suggestion | 209 | 51 | 51 | false | [K/N] Prohibit empty ObjCNames | 4,936 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | rickclephas | Review this pull request change.
Language: Kotlin
File: kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt
PR Title: [K/N] Prohibit empty ObjCNames
BEFORE CODE:
private fun KtClassOrObject.getObjCName(): ObjCName {
var objCName: String? ... | > Empty or blank names aren't allowed, they are meant to be interpreted as `null`.
Why?
Aren't blank names valid for Objective-C selector fragments? E.g.
```objective-c
- (void)bar:(int)x :(int)y;
```
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// IGNORE_BACKEND: JVM
// WITH_COROUTINES
// WITH_STDLIB
// FILE: a.kt
fun interface A {
suspend fun run()
}
// FILE: b.kt
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
import helpers.EmptyContinuation
suspend fun run(block: () -> Unit) = A(block).run()
fun box(): String {
suspend {
... | The test fails in FIR:
```
java.lang.ClassCastException: BKt$box$1$1 cannot be cast to kotlin.jvm.functions.Function1
at BKt.run(b.kt:14)
at BKt$box$1.invokeSuspend(b.kt:18)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.Continuatio... | // IGNORE_BACKEND: JVM
// WITH_COROUTINES
// WITH_STDLIB
// FILE: a.kt
fun interface A {
suspend fun run()
}
// FILE: b.kt
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
import helpers.EmptyContinuation
suspend fun run(block: suspend () -> Unit) = A(block).run()
fun box(): String {
suspend ... | @@ -0,0 +1,21 @@
+// IGNORE_BACKEND: JVM
+// WITH_COROUTINES
+// WITH_STDLIB
+// FILE: a.kt
+fun interface A {
+ suspend fun run()
+}
+
+// FILE: b.kt
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
+import helpers.EmptyContinuation
+
+suspend fun run(block: () -> Unit) = A(block).run()
+
+fun box... | compiler/testData/codegen/box/coroutines/featureIntersection/funInterface/kt50950.kt | 21 | Kotlin | 0.929 | bug | 389 | 22 | 22 | false | JVM_IR: unwrap suspend views when generating SAM wrappers | 4,955 | JetBrains/kotlin | 51,705 | Kotlin | udalov | pyos | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/box/coroutines/featureIntersection/funInterface/kt50950.kt
PR Title: JVM_IR: unwrap suspend views when generating SAM wrappers
BEFORE CODE: // IGNORE_BACKEND: JVM
// WITH_COROUTINES
// WITH_STDLIB
// FILE: a.kt
fun interface A {
s... | The test fails in FIR:
```
java.lang.ClassCastException: BKt$box$1$1 cannot be cast to kotlin.jvm.functions.Function1
at BKt.run(b.kt:14)
at BKt$box$1.invokeSuspend(b.kt:18)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlin.coroutines.Continuatio... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
)
if (reportOutputFiles) {
val message = OutputMessageUtil.formatOutputMessage(outputFiles.asList().flatMap { it.sourceFiles }.distinct(), jarPath)
messageCollector.report(CompilerMessageSeverity.OUTPUT, message)
}
return
}
val outputDir = configuration.g... | 1) I guess this check should be outside of the loop, in the beginning of the method, because `writeOutput` cannot introduce new compilation errors
2) The following would be more reliable: `projectConfiguration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).hasErrors()`
3) I'd prefer to rename the method to `w... | if (reportOutputFiles) {
val message = OutputMessageUtil.formatOutputMessage(outputFiles.asList().flatMap { it.sourceFiles }.distinct(), jarPath)
messageCollector.report(CompilerMessageSeverity.OUTPUT, message)
}
return
}
val outputDir = configuration.get(JVMConf... | @@ -132,6 +133,9 @@ fun writeOutputs(
try {
for (state in outputs) {
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
+ if ((state.diagnosticReporter as? BaseDiagnosticsCollector)?.hasErrors == true) { | compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/cliCompilerUtils.kt | 26 | Kotlin | 0.786 | suggestion | 403 | 51 | 51 | false | JVM_IR: Prevent writing output after an error is reported | 4,969 | JetBrains/kotlin | 51,705 | Kotlin | udalov | scaventz | Review this pull request change.
Language: Kotlin
File: compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/cliCompilerUtils.kt
PR Title: JVM_IR: Prevent writing output after an error is reported
BEFORE CODE: )
if (reportOutputFiles) {
val message = OutputMessageUtil.formatOutputMessa... | 1) I guess this check should be outside of the loop, in the beginning of the method, because `writeOutput` cannot introduce new compilation errors
2) The following would be more reliable: `projectConfiguration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).hasErrors()`
3) I'd prefer to rename the method to `w... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
KotlinPlatform.JVM -> {
val outOFile = tempFiles.create(libName,".o")
val compilerCmd = arrayOf(compiler, *compilerArgs,
"-c", outCFile.absolutePath, "-o", outOFile.absolutePath)
runCmd(compilerCmd, verbose)
val linkerOpts =
... | A comment explaining why we redirect the file from stdin instead of passing it directly would be useful. |
val compilerArgs = stubIrContext.libraryForCStubs.compilerArgs.toTypedArray()
val nativeOutputPath: String = when (flavor) {
KotlinPlatform.JVM -> {
val outOFile = tempFiles.create(libName,".o")
val compilerCmd = arrayOf(compiler, *compilerArgs,
"-c", outCFil... | @@ -385,8 +385,8 @@ private fun processCLib(flavor: KotlinPlatform, cinteropArguments: CInteropArgum
KotlinPlatform.NATIVE -> {
val outLib = File(nativeLibsDir, "$libName.bc")
val compilerCmd = arrayOf(compiler, *compilerArgs,
- "-emit-llvm", "-c", outCFile.absolute... | kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt | 26 | Kotlin | 0.429 | suggestion | 105 | 51 | 51 | false | [KT-54284][Native] Produce deterministic klibs from cinterop. | 4,979 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | mpetrov | Review this pull request change.
Language: Kotlin
File: kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt
PR Title: [KT-54284][Native] Produce deterministic klibs from cinterop.
BEFORE CODE: KotlinPlatform.JVM -> {
val outOFile = tempFiles.cr... | A comment explaining why we redirect the file from stdin instead of passing it directly would be useful. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
manifestAddend?.parentFile?.mkdirs()
manifestAddend?.let { def.manifestAddendProperties.storeProperties(it) }
val compilerArgs = stubIrContext.libraryForCStubs.compilerArgs.toTypedArray()
val nativeOutputPath: String = when (flavor) {
KotlinPlatform.JVM -> {
val outOFile = tempFile... | The `outCFile` (despite its name) is not always in C, sometimes it is in Objective-C or C++, see the variable definition. | def.manifestAddendProperties[ForeignExceptionMode.manifestKey] =
ForeignExceptionMode.byValue(it).value // may throw IllegalArgumentException
}
manifestAddend?.parentFile?.mkdirs()
manifestAddend?.let { def.manifestAddendProperties.storeProperties(it) }
val compilerArgs = stu... | @@ -385,8 +385,8 @@ private fun processCLib(flavor: KotlinPlatform, cinteropArguments: CInteropArgum
KotlinPlatform.NATIVE -> {
val outLib = File(nativeLibsDir, "$libName.bc")
val compilerCmd = arrayOf(compiler, *compilerArgs,
- "-emit-llvm", "-c", outCFile.absolute... | kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt | 26 | Kotlin | 0.5 | suggestion | 121 | 51 | 51 | false | [KT-54284][Native] Produce deterministic klibs from cinterop. | 4,979 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | mpetrov | Review this pull request change.
Language: Kotlin
File: kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt
PR Title: [KT-54284][Native] Produce deterministic klibs from cinterop.
BEFORE CODE:
manifestAddend?.parentFile?.mkdirs()
manifestAddend?.let { def... | The `outCFile` (despite its name) is not always in C, sometimes it is in Objective-C or C++, see the variable definition. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
else -> error("Unexpected flavor")
}
// Options, whose values are space-separated and can be escaped.
val escapedOptions = setOf("-compilerOpts", "-linkerOpts", "-compiler-options", "-linker-options")
private fun String.asArgList(key: String) =
if (escapedOptions.contains(key))
this.split(Rege... | Please add `redirectInputFile` into the log printed in the verbose mode above.
This way, if the command fails, users will at least be able to reproduce this. | else -> error("Unexpected flavor")
}
// Options, whose values are space-separated and can be escaped.
val escapedOptions = setOf("-compilerOpts", "-linkerOpts", "-compiler-options", "-linker-options")
private fun String.asArgList(key: String) =
if (escapedOptions.contains(key))
this.split(Rege... | @@ -105,9 +105,9 @@ private fun List<String>?.isTrue(): Boolean {
return this?.last() == "true"
}
-private fun runCmd(command: Array<String>, verbose: Boolean = false) {
+private fun runCmd(command: Array<String>, verbose: Boolean = false, redirectInputFile: File? = null) { | kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt | 26 | Kotlin | 0.571 | bug | 157 | 51 | 51 | false | [KT-54284][Native] Produce deterministic klibs from cinterop. | 4,979 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | mpetrov | Review this pull request change.
Language: Kotlin
File: kotlin-native/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt
PR Title: [KT-54284][Native] Produce deterministic klibs from cinterop.
BEFORE CODE: else -> error("Unexpected flavor")
}
// Options, whose values are ... | Please add `redirectInputFile` into the log printed in the verbose mode above.
This way, if the command fails, users will at least be able to reproduce this. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
"Type alias expands to {0}, which is not a class, an interface, or an object",
RENDER_TYPE
)
// Returns
map.put(RETURN_NOT_ALLOWED, "'return' is not allowed here")
map.put(NOT_A_FUNCTION_LABEL, "Target label does not denote a function")
map.put(
... | What's the meaning of the second parameter? It seems like it's not used. | "Type alias expands to {0}, which is not a class, an interface, or an object",
RENDER_TYPE
)
// Returns
map.put(RETURN_NOT_ALLOWED, "'return' is not allowed here")
map.put(NOT_A_FUNCTION_LABEL, "Target label does not denote a function")
map.put(
... | @@ -1953,7 +1953,7 @@ object FirErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
SYMBOL
)
map.put(RECURSION_IN_INLINE, "Inline function ''{0}'' cannot be recursive", SYMBOL)
- map.put(NON_PUBLIC_CALL_FROM_PUBLIC_INLINE, "Public-API inline function cannot access non-public-... | compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt | 26 | Kotlin | 0.286 | question | 72 | 51 | 51 | false | FIR: fix text for Parcelize errors and NON_PUBLIC_CALL_FROM_PUBLIC_INLINE | 4,993 | JetBrains/kotlin | 51,705 | Kotlin | KvanTTT | pyos | Review this pull request change.
Language: Kotlin
File: compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt
PR Title: FIR: fix text for Parcelize errors and NON_PUBLIC_CALL_FROM_PUBLIC_INLINE
BEFORE CODE: "Type alias expands to {0}, which is not a class, a... | What's the meaning of the second parameter? It seems like it's not used. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
val context: JvmBackendContext,
val module: IrModuleFragment,
val notifyCodegenStart: () -> Unit,
) : CodegenFactory.CodegenInput
override fun convertToIr(input: CodegenFactory.IrConversionInput): JvmIrBackendInput {
val enableIdSignatures =
input.configuration.getBo... | This now generates unbound symbols for code such as:
```
val x by lazy {
object : Runnable {
override fun run() {}
}
}
```
This is covered by the test case `lazyProperty` already in the repo. Unclear to me how to avoid that, so I allowed partial linkage if we skip bodies. | val context: JvmBackendContext,
val module: IrModuleFragment,
val notifyCodegenStart: () -> Unit,
) : CodegenFactory.CodegenInput
override fun convertToIr(input: CodegenFactory.IrConversionInput): JvmIrBackendInput {
val enableIdSignatures =
input.configuration.getBo... | @@ -120,7 +120,7 @@ open class JvmIrCodegenFactory(
input.languageVersionSettings,
Psi2IrConfiguration(
input.ignoreErrors,
- partialLinkageEnabled = false,
+ partialLinkageEnabled = input.skipBodies, | compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt | 26 | Kotlin | 0.857 | suggestion | 301 | 51 | 51 | false | [KAPT+JVM_IR] Do not generate initializers for delegated properties. | 5,014 | JetBrains/kotlin | 51,705 | Kotlin | madsager | madsager | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/entrypoint/src/org/jetbrains/kotlin/backend/jvm/JvmIrCodegenFactory.kt
PR Title: [KAPT+JVM_IR] Do not generate initializers for delegated properties.
BEFORE CODE: val context: JvmBackendContext,
val module: IrModuleFragm... | This now generates unbound symbols for code such as:
```
val x by lazy {
object : Runnable {
override fun run() {}
}
}
```
This is covered by the test case `lazyProperty` already in the repo. Unclear to me how to avoid that, so I allowed partial linkage if we skip bodies. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private val scope by lazy {
if (!context.shouldContainLocationDebugInfo() || returnableBlock.startOffset == UNDEFINED_OFFSET)
return@lazy null
val lexicalBlockFile = DICreateLexicalBlockFile(debugInfo.builder, functionScope()!!.scope(), super.file.file())
DICr... | We don't add any information for inline lambdas since they don't have any address. However we may add some information for noinline limbdas, but would it be of any value during debugging? |
override fun location(offset: Int) = scope()?.let { LocationInfo(it, file.fileEntry.line(offset), file.fileEntry.column(offset)) }
@Suppress("UNCHECKED_CAST")
private val scope by lazy {
if (!context.shouldContainLocationDebugInfo())
return@lazy null
fil... | @@ -2102,6 +2103,22 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
}
}
+ private fun storeInlinedParametersDebugInfo(block: IrReturnableBlock) {
+ val inlineFunctionSymbol = block.inlineFunctionSymbol ?: return
+ val function = inlineFunctionSymbol.o... | kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt | 26 | Kotlin | 0.5 | bug | 187 | 51 | 51 | false | Add debug information for inline function parameters | 5,050 | JetBrains/kotlin | 51,705 | Kotlin | nikita-nazarov | nikita-nazarov | Review this pull request change.
Language: Kotlin
File: kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt
PR Title: Add debug information for inline function parameters
BEFORE CODE: private val scope by lazy {
if (!context.shouldCo... | We don't add any information for inline lambdas since they don't have any address. However we may add some information for noinline limbdas, but would it be of any value during debugging? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
> expression -- (int32_t)Konan_DebugPrint(s)
ten(int32_t) [..] = 0
> expression -- (int32_t)Konan_DebugPrint(la)
[8, 9](int32_t) [..] = 0
> expression -- (int32_t)Konan_DebugPrint(myData)
MyData@[..](int32_t) [..] = 0
> script lldb.fram... | It seams, that the current code works only if the variable is passed to an argument.
For example, if I change the code to `foo(1, 2)` variables disappear. Also p2 disappear if use `foo(tmp1, tmp1+tmp1)`. Can you please check it, and add more complex tests? | > expression -- (int32_t)Konan_DebugPrint(s)
ten(int32_t) [..] = 0
> expression -- (int32_t)Konan_DebugPrint(la)
[8, 9](int32_t) [..] = 0
> expression -- (int32_t)Konan_DebugPrint(myData)
MyData@[..](int32_t) [..] = 0
> script lldb.fram... | @@ -495,4 +495,44 @@ class LldbTests {
""".trimIndent().lldb(program)
}
+ @Test
+ fun `inline function parameters are visible`() = lldbTest("""
+ data class A(var x: Int)
+
+ inline fun foo(p1: Int, p2: Int, f: (A, Int, Int) -> Unit) {
+ val tmp = A(0)
+ printl... | kotlin-native/backend.native/tests/debugger/src/test/kotlin/org/jetbrains/kotlin/native/test/debugger/LldbTests.kt | 26 | Kotlin | 0.643 | question | 260 | 51 | 51 | false | Add debug information for inline function parameters | 5,050 | JetBrains/kotlin | 51,705 | Kotlin | kunyavskiy | nikita-nazarov | Review this pull request change.
Language: Kotlin
File: kotlin-native/backend.native/tests/debugger/src/test/kotlin/org/jetbrains/kotlin/native/test/debugger/LldbTests.kt
PR Title: Add debug information for inline function parameters
BEFORE CODE: > expression -- (int32_t)Konan_DebugPrint(s)
... | It seams, that the current code works only if the variable is passed to an argument.
For example, if I change the code to `foo(1, 2)` variables disappear. Also p2 disappear if use `foo(tmp1, tmp1+tmp1)`. Can you please check it, and add more complex tests? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
statements = newStatements,
inlineFunctionSymbol = callee.symbol
).apply {
transformChildrenVoid(object : IrElementTransformerVoid() {
override fun visitReturn(expression: IrReturn): IrExpression {
expression.transfo... | Did I understand correctly that you are using the inline function parameter as the key in the map? How it's supposed to work if the function is called several times? Can you please add a test on this case, if I'm missing something and it works? | endOffset = callSite.endOffset,
type = callSite.type,
symbol = irReturnableBlockSymbol,
origin = null,
statements = newStatements,
inlineFunctionSymbol = inlineFunctionResolver.getFunctionSymbol(callee)
).apply {... | @@ -227,6 +229,13 @@ class FunctionInlining(
}
}
+ private fun saveParameterToExpressionMapping(callee: IrFunction, copiedCallee: IrFunction) {
+ for ((parameter, copiedParameter) in callee.valueParameters.zip(copiedCallee.valueParameters)) {
+ val expression = s... | compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt | 26 | Kotlin | 0.429 | question | 244 | 51 | 51 | false | Add debug information for inline function parameters | 5,050 | JetBrains/kotlin | 51,705 | Kotlin | kunyavskiy | nikita-nazarov | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt
PR Title: Add debug information for inline function parameters
BEFORE CODE: statements = newStatements,
inlineFunctionSymbol = c... | Did I understand correctly that you are using the inline function parameter as the key in the map? How it's supposed to work if the function is called several times? Can you please add a test on this case, if I'm missing something and it works? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (callSite.getValueArgument(index) == null) {
// Default values can recursively reference [callee] - transform only needed.
param.defaultValue = param.defaultValue?.transform(this@FunctionInlining, null)
}
... | There should be variables for these parameters in most cases. I think they are not shown now, as they are temporary variables. What do you think about creating a separate origin for them? I'm not sure about the name and scope, but this should be an easier solution, at least for cases, where variables are not optimized-... | // to be removed ASAP along with registering every PIR declaration.
parent = callee.parent
if (performRecursiveInline) {
body?.transformChildrenVoid()
valueParameters.forEachIndexed { index, param ->
if (cal... | @@ -199,6 +199,8 @@ class FunctionInlining(
newStatements.addAll(evaluationStatements)
statements.mapTo(newStatements) { it.transform(transformer, data = null) as IrStatement }
+ saveParameterToExpressionMapping(callee, copiedCallee) | compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt | 26 | Kotlin | 0.5 | performance | 325 | 51 | 51 | false | Add debug information for inline function parameters | 5,050 | JetBrains/kotlin | 51,705 | Kotlin | kunyavskiy | nikita-nazarov | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt
PR Title: Add debug information for inline function parameters
BEFORE CODE: if (callSite.getValueArgument(index) == null) {
... | There should be variables for these parameters in most cases. I think they are not shown now, as they are temporary variables. What do you think about creating a separate origin for them? I'm not sure about the name and scope, but this should be an easier solution, at least for cases, where variables are not optimized-... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (argument.isImmutableVariableLoad) {
substituteMap[parameter] = variableInitializer
return@forEach
}
val argumentExtracted = !argument.argumentExpression.isPure(false, context = context)
if (!argumentExtracted) ... | I'm not sure if we should name the temporary variables like arguments only if the `alwaysCreateTemporaryVariablesForArguments` option is enabled or in all cases. | return evaluationStatements
}
private fun ParameterToArgument.shouldBeSubstitutedViaTemporaryVariable(): Boolean =
!isImmutableVariableLoad && !argumentExpression.isPure(false, context = context)
private fun createTemporaryVariable(parameter: IrValueParameter, variableI... | @@ -602,43 +603,61 @@ class FunctionInlining(
return@forEach
}
- if (argument.isImmutableVariableLoad) {
- substituteMap[argument.parameter] =
- argument.argumentExpression.transform( // Arguments may reference the previous... | compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt | 26 | Kotlin | 0.571 | suggestion | 161 | 51 | 51 | false | Add debug information for inline function parameters | 5,050 | JetBrains/kotlin | 51,705 | Kotlin | nikita-nazarov | nikita-nazarov | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt
PR Title: Add debug information for inline function parameters
BEFORE CODE:
if (argument.isImmutableVariableLoad) {
substit... | I'm not sure if we should name the temporary variables like arguments only if the `alwaysCreateTemporaryVariablesForArguments` option is enabled or in all cases. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
(argument.argumentExpression as? IrFunctionReference)?.let { evaluationStatements += evaluateArguments(it) }
return@forEach
}
// Arguments may reference the previous ones - substitute them.
val variableInitializer = argument.argum... | For now, in fact we have to cases
1. Directly substitute
2. Create temporary variable.
For now logic on when which is happening is distributed all over the function code. It would be nice to collect it in one place. Like add a variable "shouldInlineArgumentValue", and just check over it and the end, without returns ... | substituteMap[parameter] = argument.argumentExpression
(argument.argumentExpression as? IrFunctionReference)?.let { evaluationStatements += evaluateArguments(it) }
return@forEach
}
// Arguments may reference the previous ones ... | @@ -602,43 +603,61 @@ class FunctionInlining(
return@forEach
}
- if (argument.isImmutableVariableLoad) {
- substituteMap[argument.parameter] =
- argument.argumentExpression.transform( // Arguments may reference the previous... | compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt | 26 | Kotlin | 0.5 | refactor | 404 | 51 | 51 | false | Add debug information for inline function parameters | 5,050 | JetBrains/kotlin | 51,705 | Kotlin | kunyavskiy | nikita-nazarov | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/inline/FunctionInlining.kt
PR Title: Add debug information for inline function parameters
BEFORE CODE: (argument.argumentExpression as? IrFunctionReference)?.let { eva... | For now, in fact we have to cases
1. Directly substitute
2. Create temporary variable.
For now logic on when which is happening is distributed all over the function code. It would be nice to collect it in one place. Like add a variable "shouldInlineArgumentValue", and just check over it and the end, without returns ... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private val codeSpec: ObjCExportCodeSpec?
) {
private val config = generationState.config
private val target get() = config.target
private val topLevelNamePrefix get() = generationState.objCExportTopLevelNamePrefix
lateinit var namer: ObjCExportNamer
internal fun generate(codegen: CodeGene... | Shouldn't actually be required here: no header is generated in this mode (e.g. the compiler is producing an executable). | private val codeSpec: ObjCExportCodeSpec?
) {
private val config = generationState.config
private val target get() = config.target
private val topLevelNamePrefix get() = generationState.objCExportTopLevelNamePrefix
lateinit var namer: ObjCExportNamer
internal fun generate(codegen: CodeGene... | @@ -112,12 +114,14 @@ internal class ObjCExport(
if (!config.isFinalBinary) return // TODO: emit RTTI to the same modules as classes belong to.
val mapper = exportedInterface?.mapper ?: ObjCExportMapper(unitSuspendFunctionExport = config.unitSuspendFunctionObjCExport)
+ val ignoreInterfaceMet... | kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExport.kt | 26 | Kotlin | 0.429 | suggestion | 120 | 51 | 51 | false | Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces | 5,070 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | MarkCMann | Review this pull request change.
Language: Kotlin
File: kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExport.kt
PR Title: Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces
BEFORE CODE: private val codeS... | Shouldn't actually be required here: no header is generated in this mode (e.g. the compiler is producing an executable). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import org.jetbrains.kotlin.resolve.BindingTraceContext
import org.jetbrains.kotlin.resolve.DescriptorResolver
import org.jetbrains.kotlin.resolve.TypeResolver
import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.resolv... | Please add a default implementation (`false`). This interface has subclasses outside this repository, and adding a default implementation would prevent breaking those subclasses. | import org.jetbrains.kotlin.resolve.BindingTraceContext
import org.jetbrains.kotlin.resolve.DescriptorResolver
import org.jetbrains.kotlin.resolve.TypeResolver
import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver
import org.jetbrains.kotlin.resolve.descriptorUtil.module
import org.jetbrains.kotlin.resolv... | @@ -49,6 +49,7 @@ interface ObjCExportLazy {
get() = false
val unitSuspendFunctionExport: UnitSuspendFunctionObjCExport
+ val ignoreInterfaceMethodCollisions: Boolean | kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportLazy.kt | 26 | Kotlin | 0.5 | suggestion | 178 | 51 | 51 | false | Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces | 5,070 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | MarkCMann | Review this pull request change.
Language: Kotlin
File: kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportLazy.kt
PR Title: Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces
BEFORE CODE: import org.jetbrains.... | Please add a default implementation (`false`). This interface has subclasses outside this repository, and adding a default implementation would prevent breaking those subclasses. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import org.jetbrains.kotlin.resolve.source.PsiSourceFile
internal interface ObjCExportNameTranslator {
fun getFileClassName(file: KtFile): ObjCExportNamer.ClassOrProtocolName
fun getCategoryName(file: KtFile): String
fun getClassOrProtocolName(
ktClassOrObject: KtClassOrObject
): ObjCExpo... | Please add a default implementation. See `ObjCExportLazy.Configuration.ignoreInterfaceMethodCollisions` comment for details. | import org.jetbrains.kotlin.resolve.source.PsiSourceFile
internal interface ObjCExportNameTranslator {
fun getFileClassName(file: KtFile): ObjCExportNamer.ClassOrProtocolName
fun getCategoryName(file: KtFile): String
fun getClassOrProtocolName(
ktClassOrObject: KtClassOrObject
): ObjCExpo... | @@ -54,9 +54,9 @@ interface ObjCExportNamer {
val topLevelNamePrefix: String
fun getAdditionalPrefix(module: ModuleDescriptor): String?
val objcGenerics: Boolean
-
val disableSwiftMemberNameMangling: Boolean
get() = false
+ val ignoreInterfaceMethodCollisions: Boo... | kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt | 26 | Kotlin | 0.5 | suggestion | 124 | 51 | 51 | false | Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces | 5,070 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | MarkCMann | Review this pull request change.
Language: Kotlin
File: kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt
PR Title: Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces
BEFORE CODE: import org.jetbrains... | Please add a default implementation. See `ObjCExportLazy.Configuration.ignoreInterfaceMethodCollisions` comment for details. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
elementToName[element] = name
}
return true
}
fun forceAssign(element: T, name: N) {
if (name in nameToElements || element in elementToName) error(element)
nameToElements[name] = mutableListOf(element)
elementToName[element]... | The name doesn't reflect the meaning. Please make it more specific, e.g. `getEnclosingOrCategoryClass`. |
if (!local) {
nameToElements.getOrPut(name) { mutableListOf() } += element
elementToName[element] = name
}
return true
}
fun forceAssign(element: T, name: N) {
if (name in nameToElements || element in elementToName) erro... | @@ -873,29 +875,16 @@ private inline fun StringBuilder.mangledSequence(crossinline mangle: StringBuild
private fun StringBuilder.mangledBySuffixUnderscores() = this.mangledSequence { append("_") }
-private fun ObjCExportMapper.canHaveCommonSubtype(first: ClassDescriptor, second: ClassDescriptor): Boolean {
- if... | kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt | 26 | Kotlin | 0.5 | suggestion | 103 | 51 | 51 | false | Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces | 5,070 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | MarkCMann | Review this pull request change.
Language: Kotlin
File: kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt
PR Title: Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces
BEFORE CODE:
ele... | The name doesn't reflect the meaning. Please make it more specific, e.g. `getEnclosingOrCategoryClass`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
private fun StringBuilder.mangledBySuffixUnderscores() = this.mangledSequence { append("_") }
private fun ObjCExportMapper.getClassDescriptor(member: CallableMemberDescriptor) = getClassIfCategory(member) ?: member.containingDeclaration as? ClassDescriptor
private fun ObjCExportMapper.inSameClassHierarchy(first: Cal... | It is not clear to me why extracting this method was necessary.
In particular, the refactoring makes it harder to verify that, in the absence of the flag, this PR doesn't alter the behavior.
What was wrong with simply adding a condition here? https://github.com/JetBrains/kotlin/blob/e2640b4afac5b4e6e2eb4aa17165593a... | this@mangledSequence.mangle()
this@mangledSequence.toString()
}
private fun StringBuilder.mangledBySuffixUnderscores() = this.mangledSequence { append("_") }
private fun ObjCExportMapper.canHaveCommonSubtype(first: ClassDescriptor, second: ClassDescriptor, ignoreInterfaceMethodCollisio... | @@ -905,14 +894,31 @@ private fun ObjCExportMapper.canBeInheritedBySameClass(
return secondClass == firstClass || first !is ConstructorDescriptor && secondClass.isSubclassOf(firstClass)
}
- return canHaveCommonSubtype(firstClass, secondClass)
+ return firstClass.isSubclassOf(secondClass) || second... | kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt | 26 | Kotlin | 0.5 | bug | 458 | 51 | 51 | false | Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces | 5,070 | JetBrains/kotlin | 51,705 | Kotlin | SvyatoslavScherbina | MarkCMann | Review this pull request change.
Language: Kotlin
File: kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportNamer.kt
PR Title: Add flag that disables ObjC method name mangling for methods in different Kotlin Interfaces
BEFORE CODE:
private fun StringB... | It is not clear to me why extracting this method was necessary.
In particular, the refactoring makes it harder to verify that, in the absence of the flag, this PR doesn't alter the behavior.
What was wrong with simply adding a condition here? https://github.com/JetBrains/kotlin/blob/e2640b4afac5b4e6e2eb4aa17165593a... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
fun writeFormalTypeParameters(irParameters: List<IrTypeParameter>, sw: JvmSignatureWriter) {
if (sw.skipGenericSignature()) return
with(KotlinTypeMapper) {
for (typeParameter in irParameters) {
typeSystem.writeFormalTypeParameter(typeParameter.symbol, sw) { type, mode ->
... | Why don't you pass `materialized` to `AbstractTypeMapper.mapType`? | fun writeFormalTypeParameters(irParameters: List<IrTypeParameter>, sw: JvmSignatureWriter) {
if (sw.skipGenericSignature()) return
with(KotlinTypeMapper) {
for (typeParameter in irParameters) {
typeSystem.writeFormalTypeParameter(typeParameter.symbol, sw) { type, mode ->
... | @@ -128,7 +128,8 @@ open class IrTypeMapper(private val context: JvmBackendContext) : KotlinTypeMapp
open fun mapType(
type: IrType,
mode: TypeMappingMode = TypeMappingMode.DEFAULT,
- sw: JvmSignatureWriter? = null
+ sw: JvmSignatureWriter? = null,
+ materialized: Boolean = t... | compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/mapping/IrTypeMapper.kt | 26 | Kotlin | 0.5 | refactor | 66 | 51 | 51 | false | [JVM_IR] Limit inner class attributes to types in class file | 5,081 | JetBrains/kotlin | 51,705 | Kotlin | strangepleasures | madsager | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/mapping/IrTypeMapper.kt
PR Title: [JVM_IR] Limit inner class attributes to types in class file
BEFORE CODE: fun writeFormalTypeParameters(irParameters: List<IrTypeParameter>, sw: JvmSignatureWrit... | Why don't you pass `materialized` to `AbstractTypeMapper.mapType`? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE, WASM
// WITH_REFLECT
@JvmInline
value class Value(val value: String)
class A(val result: Value)
fun box(): String {
val args: Array<Value> = arrayOf(Value... | I added a test case in reference to `testData/codegen/box/reflection/call/simpleConstructor.kt`, but I couldn't come up with a good name.
Also, I am not sure about the `IGNORE` setting. | // TARGET_BACKEND: JVM
// WITH_REFLECT
@JvmInline
value class Value(val value: String)
class A(val result: Value)
fun box(): String {
val args: Array<Value> = arrayOf(Value("OK"))
val a = (::A).call(*args)
return a.result.value
}
| @@ -0,0 +1,18 @@
+// IGNORE_BACKEND: JS_IR | compiler/testData/codegen/box/reflection/call/inlineClasses/simpleConstructorWithInlineClassParameter.kt | 1 | Kotlin | 0.571 | suggestion | 186 | 19 | 16 | false | Fix KT-56650 | 5,093 | JetBrains/kotlin | 51,705 | Kotlin | k163377 | k163377 | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/box/reflection/call/inlineClasses/simpleConstructorWithInlineClassParameter.kt
PR Title: Fix KT-56650
BEFORE CODE: // IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS... | I added a test case in reference to `testData/codegen/box/reflection/call/simpleConstructor.kt`, but I couldn't come up with a good name.
Also, I am not sure about the `IGNORE` setting. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.json.*
import kotlin.reflect.KProperty
import kotlin.properties.*
@Serializable
data class SimpleDTO(
val realProp: Int,
) {
... | I think `@Transient` shouldn't be here, as delegated property is transient automatically? At least it works without it. | // TARGET_BACKEND: JVM_IR
// WITH_STDLIB
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.json.*
import kotlin.reflect.KProperty
import kotlin.properties.*
@Serializable
data class SimpleDTO(
val realProp: Int,
) {
... | @@ -0,0 +1,86 @@
+// TARGET_BACKEND: JVM_IR
+
+// WITH_STDLIB
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+import kotlinx.serialization.json.*
+import kotlin.reflect.KProperty
+import kotlin.properties.*
+
+@Serializable
+data class SimpleDTO(
+... | plugins/kotlinx-serialization/testData/boxIr/delegatedProperty.kt | 18 | Kotlin | 0.571 | suggestion | 119 | 43 | 43 | false | Presence of (transient) delegated field in the serialized class breaks deserialization | 5,103 | JetBrains/kotlin | 51,705 | Kotlin | sandwwraith | AngryGami | Review this pull request change.
Language: Kotlin
File: plugins/kotlinx-serialization/testData/boxIr/delegatedProperty.kt
PR Title: Presence of (transient) delegated field in the serialized class breaks deserialization
BEFORE CODE: // TARGET_BACKEND: JVM_IR
// WITH_STDLIB
import kotlinx.serialization.*
import kot... | I think `@Transient` shouldn't be here, as delegated property is transient automatically? At least it works without it. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@Serializable
data class SimpleDTO(
val realProp: Int,
) {
@Transient
private val additionalProperties: Map<String, Int> = mapOf("delegatedProp" to 123)
@Transient
val delegatedProp: Int? by additionalProperties
}
// optimized properties must also work
// https://kotlinlang.org/docs/whatsnew1720.h... | I see you've added more test-cases for optimized properties, which is good. However, I also suggested that you make sure that even non-optimized delegated properties are still working correctly. Fortunately, it is easy to do so: just change `val` here to `var` and synthetic `delegatedProp$delegate` will appear in `Dele... |
@Serializable
data class SimpleDTO(
val realProp: Int,
) {
@Transient
private val additionalProperties: Map<String, Int> = mapOf("delegatedProp" to 123)
val delegatedProp: Int? by additionalProperties
}
// optimized properties must also work
// https://kotlinlang.org/docs/whatsnew1720.html#more-optimi... | @@ -0,0 +1,86 @@
+// TARGET_BACKEND: JVM_IR
+
+// WITH_STDLIB
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+import kotlinx.serialization.json.*
+import kotlin.reflect.KProperty
+import kotlin.properties.*
+
+@Serializable
+data class SimpleDTO(
+... | plugins/kotlinx-serialization/testData/boxIr/delegatedProperty.kt | 26 | Kotlin | 0.643 | performance | 450 | 51 | 51 | false | Presence of (transient) delegated field in the serialized class breaks deserialization | 5,103 | JetBrains/kotlin | 51,705 | Kotlin | sandwwraith | AngryGami | Review this pull request change.
Language: Kotlin
File: plugins/kotlinx-serialization/testData/boxIr/delegatedProperty.kt
PR Title: Presence of (transient) delegated field in the serialized class breaks deserialization
BEFORE CODE:
@Serializable
data class SimpleDTO(
val realProp: Int,
) {
@Transient
p... | I see you've added more test-cases for optimized properties, which is good. However, I also suggested that you make sure that even non-optimized delegated properties are still working correctly. Fortunately, it is easy to do so: just change `val` here to `var` and synthetic `delegatedProp$delegate` will appear in `Dele... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import org.jetbrains.kotlin.ir.expressions.impl.IrSetValueImpl
import org.jetbrains.kotlin.ir.types.isMarkedNullable
import org.jetbrains.kotlin.ir.types.isPrimitiveType
import org.jetbrains.kotlin.ir.types.makeNullable
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.util.render
import org.jetbr... | Please run "reformat" on the whole file | import org.jetbrains.kotlin.ir.expressions.impl.IrSetValueImpl
import org.jetbrains.kotlin.ir.types.isMarkedNullable
import org.jetbrains.kotlin.ir.types.isPrimitiveType
import org.jetbrains.kotlin.ir.types.makeNullable
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.util.render
import org.jetbr... | @@ -43,18 +43,24 @@ class JvmLateinitLowering(
) : FileLoweringPass {
override fun lower(irFile: IrFile) {
- irFile.transformChildrenVoid(Transformer(context))
+ val transformer = Transformer(context)
+ irFile.transformChildrenVoid(transformer)
+
+ for(variable in transformer.lateini... | compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmLateinitLowering.kt | 26 | Kotlin | 0.071 | style | 39 | 51 | 51 | false | Simplify and optimize JvmLateinitLowering - make use of now mutable members | 5,105 | JetBrains/kotlin | 51,705 | Kotlin | udalov | mcpiroman | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmLateinitLowering.kt
PR Title: Simplify and optimize JvmLateinitLowering - make use of now mutable members
BEFORE CODE: import org.jetbrains.kotlin.ir.expressions.impl.IrSetValueImpl
im... | Please run "reformat" on the whole file | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
override fun visitGetValue(expression: IrGetValue): IrExpression {
val irValue = expression.symbol.owner
if (irValue !is IrVariable || !irValue.isLateinit) {
return expression
}
return backendContext.createIrBuilder(
(irValue.pare... | I guess we need to change the type of `expression` here, not `irField` | }
override fun visitGetValue(expression: IrGetValue): IrExpression {
val irValue = expression.symbol.owner
if (irValue !is IrVariable || !irValue.isLateinit) {
return expression
}
return backendContext.createIrBuilder(
(ir... | @@ -99,59 +97,28 @@ class JvmLateinitLowering(
if (irValue !is IrVariable || !irValue.isLateinit) {
return expression
}
- val irBackingVar = backingVariables[irValue]
- ?: throw AssertionError("Lateinit variable reference before use: ${expression.dump... | compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmLateinitLowering.kt | 26 | Kotlin | 0.571 | suggestion | 70 | 51 | 51 | false | Simplify and optimize JvmLateinitLowering - make use of now mutable members | 5,105 | JetBrains/kotlin | 51,705 | Kotlin | udalov | mcpiroman | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmLateinitLowering.kt
PR Title: Simplify and optimize JvmLateinitLowering - make use of now mutable members
BEFORE CODE:
override fun visitGetValue(expression: IrGetValue): IrEx... | I guess we need to change the type of `expression` here, not `irField` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
stringSetOf("webMain", "jsMain", "wasmMain"),
kotlin.dependingSourceSetNames("commonMain")
)
assertEquals(
stringSetOf("jsMain", "wasmMain"),
kotlin.dependingSourceSetNames("webMain")
)
}
@Test
fun `test - hierarchy js and wasm split`... | NIT: Feel free to just lift this to a file level 👍 | stringSetOf("webMain", "jsMain", "wasmMain"),
kotlin.dependingSourceSetNames("commonMain")
)
assertEquals(
stringSetOf("jsMain", "wasmMain"),
kotlin.dependingSourceSetNames("webMain")
)
}
@Test
fun `test - hierarchy js and wasm split`... | @@ -319,6 +320,69 @@ class KotlinTargetHierarchyDslTest {
)
}
+ @Test
+ fun `test - hierarchy js and wasm`() {
+ kotlin.targetHierarchy.custom {
+ common {
+ group("web") {
+ withJs()
+ withWasm()
+ }
+ ... | libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/KotlinTargetHierarchyDslTest.kt | 26 | Kotlin | 0.214 | nitpick | 51 | 51 | 51 | false | Support WASM in KotlinTargetHierarchyBuilder | 5,106 | JetBrains/kotlin | 51,705 | Kotlin | sellmair | whyoleg | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin/src/functionalTest/kotlin/org/jetbrains/kotlin/gradle/unitTests/KotlinTargetHierarchyDslTest.kt
PR Title: Support WASM in KotlinTargetHierarchyBuilder
BEFORE CODE: stringSetOf("webMain", "jsMain", "wasmMain"),
... | NIT: Feel free to just lift this to a file level 👍 | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
override fun group(name: String, build: KotlinTargetHierarchyBuilder.() -> Unit) {
val node = KotlinTargetHierarchy.Node.Group(name)
val child = context.getOrCreateBuilder(node).also(build)
children.add(child)
checkCyclicHierarchy()
}
override fun withNative() = addTargets {... | Please do not use KDoc format for this internal comment.
Use /* */ or // instead | override fun group(name: String, build: KotlinTargetHierarchyBuilder.() -> Unit) {
val node = KotlinTargetHierarchy.Node.Group(name)
val child = context.getOrCreateBuilder(node).also(build)
children.add(child)
checkCyclicHierarchy()
}
override fun withNative() = addTargets {... | @@ -117,7 +119,9 @@ private class KotlinTargetHierarchyBuilderImpl(
override fun withAndroidNative() = addTargets { it is KotlinNativeTarget && it.konanTarget.family == Family.ANDROID }
- override fun withJs() = addTargets { it is KotlinJsTargetDsl }
+ /** Don't check for instance of [KotlinJsTargetDsl] ... | libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/targetHierarchy/buildKotlinTargetHierarchy.kt | 26 | Kotlin | 0.286 | suggestion | 82 | 51 | 51 | false | Support WASM in KotlinTargetHierarchyBuilder | 5,106 | JetBrains/kotlin | 51,705 | Kotlin | sellmair | whyoleg | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/targetHierarchy/buildKotlinTargetHierarchy.kt
PR Title: Support WASM in KotlinTargetHierarchyBuilder
BEFORE CODE: override fun group(name: String, build: KotlinTa... | Please do not use KDoc format for this internal comment.
Use /* */ or // instead | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
abstract var origin: IrStatementOrigin?
abstract val valueArguments: Array<IrExpression?>
abstract val typeArguments: Array<IrType?>
val valueArgumentsCount: Int
get() = valueArguments.size
val typeArgumentsCount: Int
get() = typeArguments.size
override fun <D> acceptChildr... | Since `valueArguments` and `typeArguments` are now public, and the `{get,put}{Value,Type}Argument` methods are not overridden, the latter can be made extensions and there's no need to generate them. Moreover, I'd prefer if we kept the previous behavior where they were throwing an exception with a detailed message. |
abstract var origin: IrStatementOrigin?
protected abstract val valueArguments: Array<IrExpression?>
protected abstract val typeArguments: Array<IrType?>
val valueArgumentsCount: Int
get() = valueArguments.size
val typeArgumentsCount: Int
get() = typeArguments.size
override ... | @@ -0,0 +1,64 @@
+/*
+ * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
+ */
+
+// This file was generated automatically. See compiler/ir/ir.tree/tree-generator/ReadMe... | compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/expressions/IrMemberAccessExpression.kt | 26 | Kotlin | 0.786 | suggestion | 316 | 38 | 46 | false | Autogenerate IrMemberAccessExpression | 5,107 | JetBrains/kotlin | 51,705 | Kotlin | udalov | mcpiroman | Review this pull request change.
Language: Kotlin
File: compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/expressions/IrMemberAccessExpression.kt
PR Title: Autogenerate IrMemberAccessExpression
BEFORE CODE:
abstract var origin: IrStatementOrigin?
abstract val valueArguments: Array<IrExpression?>
abstra... | Since `valueArguments` and `typeArguments` are now public, and the `{get,put}{Value,Type}Argument` methods are not overridden, the latter can be made extensions and there's no need to generate them. Moreover, I'd prefer if we kept the previous behavior where they were throwing an exception with a detailed message. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import org.jetbrains.kotlin.ir.declarations.IrDeclarationContainer
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
inline fun <reified T : IrElement> MutableList<T>.transformInPlace(transformation: (T) -> IrElement) {
for (i in 0 until size) {
set(i, transformation(get(i)) as T)
}
}
fun <... | Let's rewrite it a bit to reduce the bytecode size, which might be important because it's a hot spot.
```suggestion
for (i in indices) {
// Cast to IrElementBase to avoid casting to interface and invokeinterface, both of which are slow.
val element = get(i) as IrElementBase?
if (element... | import org.jetbrains.kotlin.ir.declarations.IrDeclarationContainer
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
inline fun <reified T : IrElement> MutableList<T>.transformInPlace(transformation: (T) -> IrElement) {
for (i in 0 until size) {
set(i, transformation(get(i)) as T)
}
}
fun <... | @@ -36,6 +36,16 @@ fun <T : IrElement, D> MutableList<T>.transformInPlace(transformer: IrElementTra
}
}
+fun <T : IrElement, D> Array<T?>.transformInPlace(transformer: IrElementTransformer<D>, data: D) {
+ for (i in 0 until size) {
+ // Cast to IrElementBase to avoid casting to interface and invokeint... | compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/transform.kt | 26 | Kotlin | 1 | performance | 458 | 51 | 51 | false | Autogenerate IrMemberAccessExpression | 5,107 | JetBrains/kotlin | 51,705 | Kotlin | udalov | mcpiroman | Review this pull request change.
Language: Kotlin
File: compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/transform.kt
PR Title: Autogenerate IrMemberAccessExpression
BEFORE CODE: import org.jetbrains.kotlin.ir.declarations.IrDeclarationContainer
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
inli... | Let's rewrite it a bit to reduce the bytecode size, which might be important because it's a hot spot.
```suggestion
for (i in indices) {
// Cast to IrElementBase to avoid casting to interface and invokeinterface, both of which are slow.
val element = get(i) as IrElementBase?
if (element... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
subProject("app").kotlinSourcesDir().resolve("foo/ClassUsingSubclassInApp.kt").writeText(
"""
package foo
fun main() {
SubclassInApp().someMethod()
}
""".trimIndent()
)
build(":app:com... | Is ClassUsingSubclassInApp missing? |
subProject("lib").kotlinSourcesDir().resolve("bar/BarDummy.kt").modify {
"$it { fun m() = 42}"
}
build("assemble") {
assertCompiledKotlinSources(
getExpectedKotlinSourcesForDefaultProject(
libSources = list... | @@ -776,6 +775,60 @@ abstract class BaseIncrementalCompilationMultiProjectIT : IncrementalCompilation
}
}
+ @DisplayName("KT-56197: Change interface in lib which has subclass in app")
+ @GradleTest
+ fun testChangeInterfaceInLib(gradleVersion: GradleVersion) {
+ defaultProject(gradleVers... | libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt | 26 | Kotlin | 0.071 | question | 35 | 51 | 51 | false | IC: Compute symbols impacted by classpath changes | 5,111 | JetBrains/kotlin | 51,705 | Kotlin | gavra0 | hungvietnguyen | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/IncrementalCompilationMultiProjectIT.kt
PR Title: IC: Compute symbols impacted by classpath changes
BEFORE CODE: subProject("app").kotlinSourcesDir()... | Is ClassUsingSubclassInApp missing? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// workingDir as workingDir is an @OutputDirectory, so the files must be present in an incremental build.)
return CompilationMode.Rebuild(BuildAttribute.NO_BUILD_HISTORY)
}
if (!lastBuildInfoFile.exists()) {
return CompilationMo... | nit: Using when with sealed classes provides a nice compile-time safety. Should we revert this? | // workingDir as workingDir is an @OutputDirectory, so the files must be present in an incremental build.)
return CompilationMode.Rebuild(BuildAttribute.NO_BUILD_HISTORY)
}
if (!lastBuildInfoFile.exists()) {
return CompilationMo... | @@ -299,20 +294,14 @@ open class IncrementalJvmCompilerRunner(
is NotAvailableForJSCompiler -> error("Unexpected type for this code path: ${classpathChanges.javaClass.name}.")
}
- @Suppress("UNUSED_VARIABLE") // for sealed when
- val unused = when (classpathChanges) { | compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt | 26 | Kotlin | 0.286 | question | 95 | 51 | 51 | false | IC: Compute symbols impacted by classpath changes | 5,111 | JetBrains/kotlin | 51,705 | Kotlin | gavra0 | hungvietnguyen | Review this pull request change.
Language: Kotlin
File: compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/IncrementalJvmCompilerRunner.kt
PR Title: IC: Compute symbols impacted by classpath changes
BEFORE CODE: // workingDir as workingDir is an @OutputDirectory, so the f... | nit: Using when with sealed classes provides a nice compile-time safety. Should we revert this? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
actual override fun get(index: Int): E = array[rangeCheck(index)] as E
actual override fun set(index: Int, element: E): E {
checkIsMutable()
rangeCheck(index)
@Suppress("UNCHECKED_CAST")
return array[index].apply { array[index] = element } as E
}
actual override fun add(... | AFAIK, there was some limitation on how many parameters can be spread using this approach, so it may fail on large `elements` collection | actual override fun get(index: Int): E = array[rangeCheck(index)] as E
actual override fun set(index: Int, element: E): E {
checkIsMutable()
rangeCheck(index)
@Suppress("UNCHECKED_CAST")
return array[index].apply { array[index] = element } as E
}
actual override fun add(... | @@ -71,7 +71,7 @@ public actual open class ArrayList<E> internal constructor(private var array: Ar
checkIsMutable()
if (elements.isEmpty()) return false
- array += elements.toTypedArray<Any?>()
+ dummy.push.apply(array, elements.toTypedArray<Any?>()) | libraries/stdlib/js/src/kotlin/collections/ArrayList.kt | 26 | Kotlin | 0.5 | bug | 136 | 51 | 51 | false | [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib | 5,116 | JetBrains/kotlin | 51,705 | Kotlin | ilya-g | deotimedev | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/js/src/kotlin/collections/ArrayList.kt
PR Title: [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib
BEFORE CODE: actual override fun get(index: Int): E = array[rangeCheck(index)] as E
actual override fun set(index: Int... | AFAIK, there was some limitation on how many parameters can be spread using this approach, so it may fail on large `elements` collection | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (array.size > size) {
array[size] = null as T // null-terminate
}
return array
}
override fun toArray(): Array<Any?> {
return dummy.slice.call(array)
}
internal override fun checkIsMutable() {
if (isReadOnly) throw UnsupportedOperationException... | Not a very descriptive name, perhaps would be better `jsArrayPrototype` or something like that. | actual override fun indexOf(element: E): Int = array.indexOf(element)
actual override fun lastIndexOf(element: E): Int = array.lastIndexOf(element)
override fun toString() = arrayToString(array)
@Suppress("UNCHECKED_CAST")
override fun <T> toArray(array: Array<T>): Array<T> {
if (array.si... | @@ -164,4 +163,6 @@ public actual open class ArrayList<E> internal constructor(private var array: Ar
private fun insertionRangeCheck(index: Int) = index.apply {
AbstractList.checkPositionIndex(index, size)
}
-}
\ No newline at end of file
+
+ private val dummy = js("[]") | libraries/stdlib/js/src/kotlin/collections/ArrayList.kt | 26 | Kotlin | 0.571 | suggestion | 95 | 28 | 38 | false | [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib | 5,116 | JetBrains/kotlin | 51,705 | Kotlin | ilya-g | deotimedev | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/js/src/kotlin/collections/ArrayList.kt
PR Title: [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib
BEFORE CODE:
if (array.size > size) {
array[size] = null as T // null-terminate
}
return... | Not a very descriptive name, perhaps would be better `jsArrayPrototype` or something like that. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
actual override fun set(index: Int, element: E): E {
checkIsMutable()
rangeCheck(index)
@Suppress("UNCHECKED_CAST")
return array[index].apply { array[index] = element } as E
}
actual override fun add(element: E): Boolean {
checkIsMutable()
array.asDynamic().p... | Would be better to expand the array by setting its length and then fill elements manually. | actual override fun set(index: Int, element: E): E {
checkIsMutable()
rangeCheck(index)
@Suppress("UNCHECKED_CAST")
return array[index].apply { array[index] = element } as E
}
actual override fun add(element: E): Boolean {
checkIsMutable()
array.asDynamic().p... | @@ -71,7 +71,8 @@ public actual open class ArrayList<E> internal constructor(private var array: Ar
checkIsMutable()
if (elements.isEmpty()) return false
- array += elements.toTypedArray<Any?>()
+
+ elements.forEach(array.asDynamic()::push) | libraries/stdlib/js/src/kotlin/collections/ArrayList.kt | 26 | Kotlin | 0.286 | suggestion | 90 | 51 | 51 | false | [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib | 5,116 | JetBrains/kotlin | 51,705 | Kotlin | ilya-g | deotimedev | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/js/src/kotlin/collections/ArrayList.kt
PR Title: [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib
BEFORE CODE: actual override fun set(index: Int, element: E): E {
checkIsMutable()
rangeCheck(index)
... | Would be better to expand the array by setting its length and then fill elements manually. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
actual override fun add(index: Int, element: E): Unit {
checkIsMutable()
array.asDynamic().splice(insertionRangeCheck(index), 0, element)
modCount++
}
actual override fun addAll(elements: Collection<E>): Boolean {
checkIsMutable()
if (elements.isEmpty()) return false... | Moving array tail on each element insertion would result in quadratic complexity. | actual override fun add(index: Int, element: E): Unit {
checkIsMutable()
array.asDynamic().splice(insertionRangeCheck(index), 0, element)
modCount++
}
private fun increaseLength(amount: Int): Int {
val previous = size
array.asDynamic().length = size + amount
... | @@ -82,10 +83,11 @@ public actual open class ArrayList<E> internal constructor(private var array: Ar
if (index == size) return addAll(elements)
if (elements.isEmpty()) return false
- when (index) {
- size -> return addAll(elements)
- 0 -> array = elements.toTypedArray<An... | libraries/stdlib/js/src/kotlin/collections/ArrayList.kt | 26 | Kotlin | 0.214 | performance | 81 | 51 | 51 | false | [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib | 5,116 | JetBrains/kotlin | 51,705 | Kotlin | ilya-g | deotimedev | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/js/src/kotlin/collections/ArrayList.kt
PR Title: [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib
BEFORE CODE: actual override fun add(index: Int, element: E): Unit {
checkIsMutable()
array.asDynamic().sp... | Moving array tail on each element insertion would result in quadratic complexity. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
actual override fun indexOf(element: E): Int = array.indexOf(element)
actual override fun lastIndexOf(element: E): Int = array.lastIndexOf(element)
override fun toString() = arrayToString(array)
@Suppress("UNCHECKED_CAST")
override fun <T> toArray(array: Array<T>): Array<T> {
if (... | It doesn't seem that jsArrayPrototype is now used anywhere except this function. Does it make sense to extract it then to a variable? | override fun removeRange(fromIndex: Int, toIndex: Int) {
checkIsMutable()
modCount++
array.asDynamic().splice(fromIndex, toIndex - fromIndex)
}
actual override fun clear() {
checkIsMutable()
array = emptyArray()
modCount++
}
actual override fun inde... | @@ -149,7 +151,7 @@ public actual open class ArrayList<E> internal constructor(private var array: Ar
}
override fun toArray(): Array<Any?> {
- return js("[]").slice.call(array)
+ return jsArrayPrototype.slice.call(array) | libraries/stdlib/js/src/kotlin/collections/ArrayList.kt | 26 | Kotlin | 0.571 | refactor | 133 | 44 | 51 | false | [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib | 5,116 | JetBrains/kotlin | 51,705 | Kotlin | ilya-g | deotimedev | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/js/src/kotlin/collections/ArrayList.kt
PR Title: [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib
BEFORE CODE: }
actual override fun indexOf(element: E): Int = array.indexOf(element)
actual override fun lastIn... | It doesn't seem that jsArrayPrototype is now used anywhere except this function. Does it make sense to extract it then to a variable? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
// !LANGUAGE: +EnumEntries
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
enum class MyEnum {
OK, NOPE;
companion object {
//use values() instead - and it works as expected
@OptIn(ExperimentalStdlibApi::class)
val ok1 = entries[0]
}
}
fun box(): String {
return MyEnum.ok1.toString()... | Let's use `IGNORE_BACKEND: JVM, JS` instead, so that this test will run for Native. | // !LANGUAGE: +EnumEntries
// IGNORE_BACKEND: JVM, JS
// WITH_STDLIB
enum class MyEnum {
OK, NOPE;
companion object {
@OptIn(ExperimentalStdlibApi::class)
val ok = entries[0]
}
}
fun box(): String {
return MyEnum.ok.toString()
} | @@ -0,0 +1,17 @@
+// !LANGUAGE: +EnumEntries
+// TARGET_BACKEND: JVM_IR | compiler/testData/codegen/box/enum/enumEntriesInCompanion.kt | 2 | Kotlin | 0.429 | suggestion | 83 | 18 | 16 | false | JVM: Fix enum entries glitch | 5,125 | JetBrains/kotlin | 51,705 | Kotlin | udalov | scaventz | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/box/enum/enumEntriesInCompanion.kt
PR Title: JVM: Fix enum entries glitch
BEFORE CODE: // !LANGUAGE: +EnumEntries
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
enum class MyEnum {
OK, NOPE;
companion object {
//use values... | Let's use `IGNORE_BACKEND: JVM, JS` instead, so that this test will run for Native. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/**
* Check if `expression` - a call to a composable function or access to a composable property -
* is allowed in the current context. It is allowed if:
*
* - It is executed as part of the body of a composable function.
* - It is not executed as part of the body of a lambda annotated with `@DisallowComposableCall... | Nit:
```suggestion
// If key call only has the block argument, report it
``` | /**
* Check if `expression` - a call to a composable function or access to a composable property -
* is allowed in the current context. It is allowed if:
*
* - It is executed as part of the body of a composable function.
* - It is not executed as part of the body of a lambda annotated with `@DisallowComposableCall... | @@ -101,6 +102,17 @@ private fun checkComposableCall(
context: CheckerContext,
reporter: DiagnosticReporter,
) {
+ if (calleeFunction.callableId == ComposeCallableIds.key) {
+ // If key only has the block parameter, report it | plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k2/ComposableCallChecker.kt | 26 | Kotlin | 0.571 | suggestion | 89 | 51 | 51 | false | Add a diagnostic for `key` call with no arguments | 5,524 | JetBrains/kotlin | 51,705 | Kotlin | derekxu16 | ShikaSD | Review this pull request change.
Language: Kotlin
File: plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k2/ComposableCallChecker.kt
PR Title: Add a diagnostic for `key` call with no arguments
BEFORE CODE: /**
* Check if `expression` - a call to a composable function or access... | Nit:
```suggestion
// If key call only has the block argument, report it
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.api.variant.ScopedArtifacts
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api... | Nit: better to pass not the whole extension, but specific property from extension | import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.api.variant.ScopedArtifacts
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api... | @@ -26,14 +26,15 @@ import org.gradle.work.DisableCachingByDefault
import org.gradle.workers.WorkAction
import org.gradle.workers.WorkParameters
import org.gradle.workers.WorkerExecutor
+import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
import org.jetbrains.kotlin.gradle.plugi... | libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt | 26 | Kotlin | 0.286 | suggestion | 81 | 51 | 51 | false | Add a way to disable Compose mapping tasks from gradle plugin | 5,525 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | ShikaSD | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt
PR Title: Add a way to disable Compose mapping tasks from gradle plugin
BEFORE CODE: import com.android.build.api.artifact.... | Nit: better to pass not the whole extension, but specific property from extension | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
* serialized again.
* @param dependencies The list of KLIBs that the KLIB being produced depends on.
* @param createModuleSerializer Used for creating a backend-specific instance of [IrModuleSerializer].
* @param metadataSerializer Something capable of serializing the metadata of the source files. See the corre... | Just commenting this out makes it seem unintentional? | * serialized again.
* @param dependencies The list of KLIBs that the KLIB being produced depends on.
* @param createModuleSerializer Used for creating a backend-specific instance of [IrModuleSerializer].
* @param metadataSerializer Something capable of serializing the metadata of the source files. See the corre... | @@ -102,9 +102,9 @@ fun <Dependency : KotlinLibrary, SourceFile> serializeModuleIntoKlib(
processKlibHeader: (ByteArray) -> Unit = {},
): SerializerOutput<Dependency> {
if (irModuleFragment != null) {
- assert(metadataSerializer.numberOfSourceFiles == irModuleFragment.files.size) {
- "The n... | compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/serializeModuleIntoKlib.kt | 26 | Kotlin | 0.214 | question | 53 | 51 | 51 | false | FirResult cleanup | 5,553 | JetBrains/kotlin | 51,705 | Kotlin | bnorm | demiurg906 | Review this pull request change.
Language: Kotlin
File: compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/serialization/serializeModuleIntoKlib.kt
PR Title: FirResult cleanup
BEFORE CODE: * serialized again.
* @param dependencies The list of KLIBs that the KLIB being produced depends on... | Just commenting this out makes it seem unintentional? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
)
}
}
val stubs = fn.makeStubsForDefaultValueClassIfNeeded()
// update parameter types so they are ready to accept the default values
fn.parameters.fastForEach { param ->
if (fn.hasDefaultForParam(param.indexInParamete... | Does this mean that we don't copy type parameters to stubs? Technically, that produces incorrect IR, if I read this correctly. | name = ComposeNames.ComposerParameter
type = composerType.makeNullable()
origin = IrDeclarationOrigin.DEFINED
isAssignable = true
}
// $changed[n]
val changed = ComposeNames.ChangedParameter.identifier
for (... | @@ -716,10 +718,34 @@ class ComposerParamTransformer(
val parent = fn.parent
if (parent is IrClass || parent is IrFile) {
+
+ fun IrSimpleFunction.toComparableParams(): List<Pair<IrClassifierSymbol, SimpleTypeNullability>?> =
+ parameters.map {
+ ... | plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt | 26 | Kotlin | 0.5 | bug | 126 | 51 | 51 | false | CMP-9167 fix | 5,557 | JetBrains/kotlin | 51,705 | Kotlin | ShikaSD | shishkin-pavel | Review this pull request change.
Language: Kotlin
File: plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt
PR Title: CMP-9167 fix
BEFORE CODE: )
}
}
val stubs = fn.makeStubsForDefaultVa... | Does this mean that we don't copy type parameters to stubs? Technically, that produces incorrect IR, if I read this correctly. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
build("assembleRelease") {
assertTasksAreNotInTaskGraph(
":produceReleaseComposeMapping",
":mergeReleaseComposeMapping"
)
}
}
}
@DisplayName("CMP-9167 verification")
@GradleAndroidTest
... | Why should isolated projects be disabled in this test? | composeExtension.includeComposeMappingFile.set(false)
}
build("assembleRelease") {
assertTasksAreNotInTaskGraph(
":produceReleaseComposeMapping",
":mergeReleaseComposeMapping"
)
}
}
}... | @@ -755,6 +755,66 @@ class ComposeIT : KGPBaseTest() {
}
}
+ @DisplayName("CMP-9167 verification")
+ @GradleAndroidTest
+ @AndroidTestVersions(minVersion = TestVersions.AGP.AGP_811, maxVersion = TestVersions.AGP.AGP_811)
+ @OtherGradlePluginTests
+ @TestMetadata("composeMultiplatform")
+ ... | libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt | 26 | Kotlin | 0.286 | question | 54 | 51 | 51 | false | CMP-9167 fix | 5,557 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | shishkin-pavel | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt
PR Title: CMP-9167 fix
BEFORE CODE: }
build("assembleRelease") {
assertTasksAreNotInTaskGraph(
... | Why should isolated projects be disabled in this test? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
val composeExtension = project.extensions.getByType<ComposeCompilerGradlePluginExtension>()
composeExtension.includeComposeMappingFile.set(false)
}
build("assembleRelease") {
assertTasksAreNotInTaskGraph(
":pr... | Could you use build script injection approach in this test? See `BuildScriptInjectionIT` for examples. | }
}
val composeExtension = project.extensions.getByType<ComposeCompilerGradlePluginExtension>()
composeExtension.includeComposeMappingFile.set(false)
}
build("assembleRelease") {
assertTasksAreNotInTaskGraph(
... | @@ -755,6 +755,66 @@ class ComposeIT : KGPBaseTest() {
}
}
+ @DisplayName("CMP-9167 verification")
+ @GradleAndroidTest
+ @AndroidTestVersions(minVersion = TestVersions.AGP.AGP_811, maxVersion = TestVersions.AGP.AGP_811)
+ @OtherGradlePluginTests
+ @TestMetadata("composeMultiplatform")
+ ... | libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt | 26 | Kotlin | 0.714 | security | 102 | 51 | 51 | false | CMP-9167 fix | 5,557 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | shishkin-pavel | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt
PR Title: CMP-9167 fix
BEFORE CODE: }
val composeExtension = project.extensions.getByType<ComposeCompilerGradlePlugi... | Could you use build script injection approach in this test? See `BuildScriptInjectionIT` for examples. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@AndroidTestVersions(minVersion = TestVersions.AGP.AGP_811, maxVersion = TestVersions.AGP.AGP_811)
@OtherGradlePluginTests
@TestMetadata("composeMultiplatform")
fun testComposeDefaultValueParamStubs(
gradleVersion: GradleVersion,
agpVersion: String,
providedJdk: JdkVersions.Provi... | Nit: you could use instead this approach:
```
kotlinSourcesDir("commonMain").source("com/example/App.kt") {
//language=Kotlin
"""
// source code
""".trimIndent()
}
``` | @GradleTest
@OtherGradlePluginTests
fun testComposeDefaultValueParamStubs(
gradleVersion: GradleVersion,
) {
project(
projectName = "empty",
gradleVersion = gradleVersion,
buildOptions = defaultBuildOptions.copy(
nativeOptions = super.d... | @@ -755,6 +755,66 @@ class ComposeIT : KGPBaseTest() {
}
}
+ @DisplayName("CMP-9167 verification")
+ @GradleAndroidTest
+ @AndroidTestVersions(minVersion = TestVersions.AGP.AGP_811, maxVersion = TestVersions.AGP.AGP_811)
+ @OtherGradlePluginTests
+ @TestMetadata("composeMultiplatform")
+ ... | libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt | 26 | Kotlin | 0.857 | suggestion | 256 | 51 | 51 | false | CMP-9167 fix | 5,557 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | shishkin-pavel | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/ComposeIT.kt
PR Title: CMP-9167 fix
BEFORE CODE: @AndroidTestVersions(minVersion = TestVersions.AGP.AGP_811, maxVersion = TestVersions.AGP.AGP_811)
@Othe... | Nit: you could use instead this approach:
```
kotlinSourcesDir("commonMain").source("com/example/App.kt") {
//language=Kotlin
"""
// source code
""".trimIndent()
}
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
if (line.isEmpty()) return@forEach
logger.warn(
"warning: Failed to collect Compose mapping ($line). Please report to Google through " +
"https://goo.gle/compose-feedback"
)
}
}
}
}
@CacheableTask
i... | Do you really need to call it as everything is included by default as well? :thinking: | if (line.isEmpty()) return@forEach
logger.warn(
"warning: Failed to collect Compose mapping ($line). Please report to Google through " +
"https://goo.gle/compose-feedback"
)
}
}
}
}
@CacheableTask
i... | @@ -216,34 +216,48 @@ internal abstract class ReportMappingErrorsTask : DefaultTask() {
@CacheableTask
-internal abstract class MergeMappingFileTask : DefaultTask() {
+internal abstract class MergeMappingFileTask @Inject constructor(objects: ObjectFactory) : DefaultTask() {
@get:InputFile
@get:PathSens... | libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt | 26 | Kotlin | 0.214 | suggestion | 87 | 51 | 51 | false | Copy R8 outputs to Compose folder when transforming obfuscation file | 5,603 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | ShikaSD | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt
PR Title: Copy R8 outputs to Compose folder when transforming obfuscation file
BEFORE CODE: if (line.isEmpt... | Do you really need to call it as everything is included by default as well? :thinking: | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
}
@CacheableTask
internal abstract class MergeMappingFileTask @Inject constructor(objects: ObjectFactory) : DefaultTask() {
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val originalFile: RegularFileProperty
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE... | This looks SuS:
- property `output` is already annotated with `@OutputFile`, but this output is also part of this output directory
- could other tasks write to this directory? For example R8? If yes, Gradle will complain as it could not detect from where new additional outputs are present and invalidate the task stat... | }
}
@CacheableTask
internal abstract class MergeMappingFileTask @Inject constructor(objects: ObjectFactory) : DefaultTask() {
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val originalFile: RegularFileProperty
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE... | @@ -216,34 +216,48 @@ internal abstract class ReportMappingErrorsTask : DefaultTask() {
@CacheableTask
-internal abstract class MergeMappingFileTask : DefaultTask() {
+internal abstract class MergeMappingFileTask @Inject constructor(objects: ObjectFactory) : DefaultTask() {
@get:InputFile
@get:PathSens... | libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt | 26 | Kotlin | 0.786 | suggestion | 383 | 51 | 51 | false | Copy R8 outputs to Compose folder when transforming obfuscation file | 5,603 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | ShikaSD | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt
PR Title: Copy R8 outputs to Compose folder when transforming obfuscation file
BEFORE CODE: }
}
@CacheableTask
intern... | This looks SuS:
- property `output` is already annotated with `@OutputFile`, but this output is also part of this output directory
- could other tasks write to this directory? For example R8? If yes, Gradle will complain as it could not detect from where new additional outputs are present and invalidate the task stat... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
val msgCollector = configuration.messageCollector
val suppressKotlinVersionCheck = configuration.get(ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK)
if (suppressKotlinVersionCheck != null) {
msgCollector.report(
CompilerMessageSev... | Please use `ComposeClassIds` to reference fq names here | val msgCollector = configuration.messageCollector
val suppressKotlinVersionCheck = configuration.get(ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK)
if (suppressKotlinVersionCheck != null) {
msgCollector.report(
CompilerMessageSev... | @@ -627,6 +629,17 @@ class ComposePluginRegistrar : CompilerPluginRegistrar() {
return true
}
+ fun updateConfigurationCommon(configuration: CompilerConfiguration) {
+ configuration.put(
+ JVMConfigurationKeys.IGNORED_ANNOTATIONS_FOR_BRIDGES,
+ lis... | plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt | 26 | Kotlin | 0.429 | suggestion | 55 | 51 | 51 | false | [Compose] avoid copying Compose-specific annotations to bridges | 5,612 | JetBrains/kotlin | 51,705 | Kotlin | ShikaSD | andrey-mogilev | Review this pull request change.
Language: Kotlin
File: plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt
PR Title: [Compose] avoid copying Compose-specific annotations to bridges
BEFORE CODE: val msgCollector = configuration.messageCollector
... | Please use `ComposeClassIds` to reference fq names here | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
companion object {
fun checkCompilerConfiguration(configuration: CompilerConfiguration): Boolean {
val msgCollector = configuration.messageCollector
val suppressKotlinVersionCheck = configuration.get(ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK)
... | I am not sure `updateConfigurationCommon` is the best name here as it only updates JVM-specific configuration with one specific flag. Consider renaming to something like `CompilerConfiguration.ignoreComposeAnnotationsOnJvmBridges`. | }
companion object {
fun checkCompilerConfiguration(configuration: CompilerConfiguration): Boolean {
val msgCollector = configuration.messageCollector
val suppressKotlinVersionCheck = configuration.get(ComposeConfiguration.SUPPRESS_KOTLIN_VERSION_COMPATIBILITY_CHECK)
... | @@ -627,6 +629,17 @@ class ComposePluginRegistrar : CompilerPluginRegistrar() {
return true
}
+ fun updateConfigurationCommon(configuration: CompilerConfiguration) { | plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt | 26 | Kotlin | 0.643 | suggestion | 231 | 51 | 51 | false | [Compose] avoid copying Compose-specific annotations to bridges | 5,612 | JetBrains/kotlin | 51,705 | Kotlin | ShikaSD | andrey-mogilev | Review this pull request change.
Language: Kotlin
File: plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt
PR Title: [Compose] avoid copying Compose-specific annotations to bridges
BEFORE CODE: }
companion object {
fun checkCompilerConfiguration(... | I am not sure `updateConfigurationCommon` is the best name here as it only updates JVM-specific configuration with one specific flag. Consider renaming to something like `CompilerConfiguration.ignoreComposeAnnotationsOnJvmBridges`. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@get:PathSensitive(PathSensitivity.RELATIVE)
val r8Outputs: FileCollection = objects.fileCollection()
.from(originalFile.asFile.map { it.parentFile })
.asFileTree
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val composeMapping: RegularFileProperty
@get:O... | ```suggestion
val outputDir = outputDir.get().asFile
``` | @get:PathSensitive(PathSensitivity.RELATIVE)
val r8Outputs: FileCollection = objects.fileCollection()
.from(originalFile.asFile.map { it.parentFile })
.asFileTree
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val composeMapping: RegularFileProperty
@get:O... | @@ -253,7 +257,6 @@ internal abstract class MergeMappingFileTask @Inject constructor(objects: Object
val outputFile = output.get().asFile
val outputDir = outputDir.get() | libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt | 26 | Kotlin | 0.571 | suggestion | 64 | 51 | 51 | false | Fix mergeReleaseComposeMapping task failure when build cache is enabled | 5,613 | JetBrains/kotlin | 51,705 | Kotlin | Goooler | ShikaSD | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt
PR Title: Fix mergeReleaseComposeMapping task failure when build cache is enabled
BEFORE CODE: @get:PathSensitive(PathS... | ```suggestion
val outputDir = outputDir.get().asFile
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
@CacheableTask
internal abstract class MergeMappingFileTask @Inject constructor(
objects: ObjectFactory,
providers: ProviderFactory
) : DefaultTask() {
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val originalFile: RegularFileProperty
@get:InputFiles
@get:PathSensi... | ```suggestion
val outputDir: DirectoryProperty = objects.directoryProperty().fileProvider(output.map { it.asFile.parentFile })
``` |
@CacheableTask
internal abstract class MergeMappingFileTask @Inject constructor(
objects: ObjectFactory,
providers: ProviderFactory
) : DefaultTask() {
@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val originalFile: RegularFileProperty
@get:InputFiles
@get:PathSensi... | @@ -239,8 +243,8 @@ internal abstract class MergeMappingFileTask @Inject constructor(objects: Object
@get:OutputFile
abstract val output: RegularFileProperty
- @get:OutputFiles
- val outputDir: Provider<File> = output.asFile.map { it.parentFile }
+ @get:OutputDirectory
+ val outputDir: Provider<... | libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt | 26 | Kotlin | 0.714 | suggestion | 134 | 51 | 51 | false | Fix mergeReleaseComposeMapping task failure when build cache is enabled | 5,613 | JetBrains/kotlin | 51,705 | Kotlin | Goooler | ShikaSD | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt
PR Title: Fix mergeReleaseComposeMapping task failure when build cache is enabled
BEFORE CODE:
@CacheableTask
internal abs... | ```suggestion
val outputDir: DirectoryProperty = objects.directoryProperty().fileProvider(output.map { it.asFile.parentFile })
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
val outputFile = output.get().asFile
val outputDir = outputDir.get()
outputFile.bufferedWriter().use { writer ->
writer.append(newHeader)
var skippingHeader = true
originalFile.forEachLine {
if (skippingHeader && it.startsWith("#")) {
... | Maybe cleaning up the output dir is better than just overwrite?
What if there will be leftover files? |
val outputFile = output.get().asFile
val outputDir = outputDir.get()
outputDir.deleteRecursively()
outputDir.mkdirs()
outputFile.bufferedWriter().use { writer ->
writer.append(newHeader)
var skippingHeader = true
originalFile.forEachLine {
... | @@ -276,7 +279,7 @@ internal abstract class MergeMappingFileTask @Inject constructor(objects: Object
r8Outputs.forEach {
if (it == originalFile) return@forEach
- it.copyTo(File(outputDir, it.name))
+ it.copyTo(File(outputDir, it.name), overwrite = true) | libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt | 26 | Kotlin | 0.429 | question | 104 | 51 | 51 | false | Fix mergeReleaseComposeMapping task failure when build cache is enabled | 5,613 | JetBrains/kotlin | 51,705 | Kotlin | antohaby | ShikaSD | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt
PR Title: Fix mergeReleaseComposeMapping task failure when build cache is enabled
BEFORE CODE:
val outputFile = ou... | Maybe cleaning up the output dir is better than just overwrite?
What if there will be leftover files? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
plugins {
kotlin("jvm")
}
configureKotlinCompileTasksGradleCompatibility()
dependencies {
val coreDepsVersion = libs.versions.kotlin.`for`.gradle.plugins.compilation.get()
implementation("org.jetbrains.kotlin:kotlin-stdlib:$coreDepsVersion")
implementation("org.ow2.asm:asm-tree:9.7")
}
base {
arc... | Could you migrate this dependency to Gradle version catalog? | plugins {
kotlin("jvm")
}
configureKotlinCompileTasksGradleCompatibility()
dependencies {
val coreDepsVersion = libs.versions.kotlin.`for`.gradle.plugins.compilation.get()
implementation("org.jetbrains.kotlin:kotlin-stdlib:$coreDepsVersion")
implementation("org.ow2.asm:asm-tree:9.9.1")
}
base {
a... | @@ -7,7 +7,7 @@ configureKotlinCompileTasksGradleCompatibility()
dependencies {
val coreDepsVersion = libs.versions.kotlin.`for`.gradle.plugins.compilation.get()
implementation("org.jetbrains.kotlin:kotlin-stdlib:$coreDepsVersion")
- implementation("org.ow2.asm:asm-tree:9.7")
+ implementation("org.ow2.... | plugins/compose/group-mapping/build.gradle.kts | 10 | Kotlin | 0.286 | question | 61 | 32 | 32 | false | Allow Compose mapping analysis to read files compiled for Java 25+ | 5,614 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | ShikaSD | Review this pull request change.
Language: Kotlin
File: plugins/compose/group-mapping/build.gradle.kts
PR Title: Allow Compose mapping analysis to read files compiled for Java 25+
BEFORE CODE: plugins {
kotlin("jvm")
}
configureKotlinCompileTasksGradleCompatibility()
dependencies {
val coreDepsVersion = l... | Could you migrate this dependency to Gradle version catalog? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
it.output.set(outputFile)
it.errorOutput.set(errorFile)
}
}
abstract class Action : WorkAction<Action.Parameters> {
interface Parameters : WorkParameters {
val projectJars: ConfigurableFileCollection
val projectFiles: ConfigurableFileCollection
... | Maybe better to wrap it to `e.message?.let { message -> ... }` to avoid using `orEmpty()` | it.projectJars.from(projectJars.get())
it.output.set(outputFile)
it.errorOutput.set(errorFile)
}
}
abstract class Action : WorkAction<Action.Parameters> {
interface Parameters : WorkParameters {
val projectJars: ConfigurableFileCollection
... | @@ -151,11 +152,26 @@ internal abstract class ProduceMappingFileTask @Inject constructor(
val errorOutput: RegularFileProperty
}
+ class LogLine(
+ val message: String,
+ val level: LogLevel
+ )
+
override fun execute() {
- val errors = mut... | libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt | 26 | Kotlin | 0.429 | suggestion | 89 | 51 | 51 | false | Allow Compose mapping analysis to read files compiled for Java 25+ | 5,614 | JetBrains/kotlin | 51,705 | Kotlin | Tapchicoma | ShikaSD | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-compose-compiler/src/common/kotlin/org/jetbrains/kotlin/compose/compiler/gradle/internal/ComposeAgpMappingFile.kt
PR Title: Allow Compose mapping analysis to read files compiled for Java 25+
BEFORE CODE: it.output.set(outputF... | Maybe better to wrap it to `e.message?.let { message -> ... }` to avoid using `orEmpty()` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrFunctionExpression
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator.IMPLICIT_CAST
import org.jetbrai... | Can you please also check
`pluginContext.languageVersionSettings.supportsFeature(LanguageFeature.IrRichCallableReferencesInKlibs)` here?
Otherwise, it would break with export to 2.2 after being backported to 2.3. In 2.4 branch, this check is not needed anymore (as you can't have 2.4 with LV 2.2 outside of jvm), so i... | import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrFunctionExpression
import org.jetbrains.kotlin.ir.expressi... | @@ -28,22 +28,25 @@ import org.jetbrains.kotlin.ir.expressions.IrFunctionExpression
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator.IMPLICIT_CAST
import org.jetbrains.kotlin.ir.expressions.IrTypeOperator.SAM_CONVERSION
import org.jetbrains.kotlin.ir.expressions.IrTypeOperatorCall
+import org.jetbrains.kotl... | plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableFunInterfaceLowering.kt | 26 | Kotlin | 0.643 | suggestion | 389 | 51 | 51 | false | [CMP] fix CMP-9456 | 5,648 | JetBrains/kotlin | 51,705 | Kotlin | kunyavskiy | shishkin-pavel | Review this pull request change.
Language: Kotlin
File: plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposableFunInterfaceLowering.kt
PR Title: [CMP] fix CMP-9456
BEFORE CODE: import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.declaration... | Can you please also check
`pluginContext.languageVersionSettings.supportsFeature(LanguageFeature.IrRichCallableReferencesInKlibs)` here?
Otherwise, it would break with export to 2.2 after being backported to 2.3. In 2.4 branch, this check is not needed anymore (as you can't have 2.4 with LV 2.2 outside of jvm), so i... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
public static ReplaceCallFix toSafeCall() {
return new ReplaceCallFix(true, true);
}
/**
* @return quickfix for replacing dot call with non-null asserted (!!.) call
*/
public static ReplaceCallFix toNonNullAssertedCall() {
return new ReplaceCallFix(false, true);
}
/**... | No issues found. | public static ReplaceCallFix toSafeCall() {
return new ReplaceCallFix(true, true);
}
/**
* @return quickfix for replacing dot call with non-null asserted (!!.) call
*/
public static ReplaceCallFix toNonNullAssertedCall() {
return new ReplaceCallFix(false, true);
}
/**... | @@ -21,33 +21,67 @@
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
+import com.intellij.psi.impl.source.tree.LeafPsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annot... | idea/src/org/jetbrains/jet/plugin/quickfix/ReplaceCallFix.java | 0 | Java | 1 | none | 16 | 51 | 51 | true | Fix for KT-2174 Need "Replace with unsafe call" intention | 80 | JetBrains/kotlin | 51,705 | Kotlin | Frostman | Review this pull request change.
Language: Java
File: idea/src/org/jetbrains/jet/plugin/quickfix/ReplaceCallFix.java
PR Title: Fix for KT-2174 Need "Replace with unsafe call" intention
BEFORE CODE: public static ReplaceCallFix toSafeCall() {
return new ReplaceCallFix(true, true);
}
/**
* @... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
fun constant(): String {
return """
|Hello,
|World
""".trimMargin()
}
private const val HAS_MARGIN = """Hello,
|World"""
fun interpolatedUsingConstant(): String {
return """
|Hello,
|$HAS_MARGIN
|World
""".trimMargin()
}
private const val SPACES = " ... | No issues found. | fun constant(): String {
return """
|Hello,
|World
""".trimMargin()
}
private const val HAS_MARGIN = """Hello,
|World"""
fun interpolatedUsingConstant(): String {
return """
|Hello,
|$HAS_MARGIN
|World
""".trimMargin()
}
private const val SPACES = " ... | @@ -1,5 +1,3 @@
-// IGNORE_BACKEND: JVM_IR
-
fun constant(): String {
return """
|Hello,
@@ -17,6 +15,17 @@ fun interpolatedUsingConstant(): String {
""".trimMargin()
}
+
+private const val SPACES = " "
+private const val HELLO = "Hello"
+private const val WORLD = "World"
+fun reliesOnNestedSt... | compiler/testData/codegen/bytecodeText/intrinsicsTrim/trimMarginPositive.kt | 0 | Kotlin | 1 | none | 16 | 49 | 49 | true | IR lowering for computing trimIndent/trimMargin on constants | 2,290 | JetBrains/kotlin | 51,705 | Kotlin | JakeWharton | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/bytecodeText/intrinsicsTrim/trimMarginPositive.kt
PR Title: IR lowering for computing trimIndent/trimMargin on constants
BEFORE CODE: fun constant(): String {
return """
|Hello,
|World
""".trimMargin()
}
priva... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
DeepRecursiveScopeImpl<T, R>(block, value).runCallLoop()
/**
* A scope class for [DeepRecursiveFunction] function declaration that defines [callRecursive] methods to
* recursively call this function or another [DeepRecursiveFunction] putting the call activation frame on the heap.
*
* @param [T] function parame... | No issues found. | DeepRecursiveScopeImpl<T, R>(block, value).runCallLoop()
/**
* A scope class for [DeepRecursiveFunction] function declaration that defines [callRecursive] methods to
* recursively call this function or another [DeepRecursiveFunction] putting the call activation frame on the heap.
*
* @param [T] function parame... | @@ -0,0 +1,218 @@
+/*
+ * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
+ */
+
+package kotlin
+
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
+
... | libraries/stdlib/src/kotlin/util/DeepRecursive.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | stdlib: DeepRecursiveFunction | 3,398 | JetBrains/kotlin | 51,705 | Kotlin | elizarov | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/src/kotlin/util/DeepRecursive.kt
PR Title: stdlib: DeepRecursiveFunction
BEFORE CODE: DeepRecursiveScopeImpl<T, R>(block, value).runCallLoop()
/**
* A scope class for [DeepRecursiveFunction] function declaration that defines [callRecursi... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.endOffset
class JoinToStringTemplateHandler : JoinRawLinesHandlerDelegate {
override fun tryJoinRawLines(document: Document, file: PsiFile, start: Int, end: Int): Int {
if (file !is KtFile) ... | No issues found. | import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.endOffset
class JoinToStringTemplateHandler : JoinRawLinesHandlerDelegate {
override fun tryJoinRawLines(document: Document, file: PsiFile, start: Int, end: Int): Int {
if (file !is KtFile) ... | @@ -21,12 +21,8 @@ import com.intellij.openapi.editor.Document
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.idea.core.util.getLineCount
import org.jetbrains.kotlin.idea.intentions.ConvertToStringTemplateIntention
-import org.jetbrains.kotlin.idea.intentions.branchedTransformations.lineCount
import or... | idea/src/org/jetbrains/kotlin/idea/joinLines/JoinToStringTemplateHandler.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | coutLines cleanup | 3,425 | JetBrains/kotlin | 51,705 | Kotlin | nikitabobko | Review this pull request change.
Language: Kotlin
File: idea/src/org/jetbrains/kotlin/idea/joinLines/JoinToStringTemplateHandler.kt
PR Title: coutLines cleanup
BEFORE CODE: import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.endOffset
class JoinToStr... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused", "IncompatibleAPI", "PropertyName")
package org.jetbrains.kotlin.idea.test
import co... | No issues found. | /*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused", "IncompatibleAPI", "PropertyName")
package org.jetbrains.kotlin.idea.test
import co... | @@ -15,7 +15,8 @@ import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import com.intellij.testFramework.LightIdeaTestCase
-// BUNCH: as36, 191
+// FIX ME WHEN BUNCH as36 REMOVED
+// FIX ME WHEN BUNCH 191 REMOVED
@Suppress("DEPRECATION")
@Deprecated("Use KotlinLightCodeInsightFixtureTestCas... | idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt | 0 | Kotlin | 1 | none | 16 | 39 | 39 | true | change "// BUNCH: xxx" format | 3,439 | JetBrains/kotlin | 51,705 | Kotlin | nikitabobko | Review this pull request change.
Language: Kotlin
File: idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt
PR Title: change "// BUNCH: xxx" format
BEFORE CODE: /*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is gover... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
fun testResolveSimple() {
resolveAndCheck("org.jetbrains.kotlin:kotlin-annotations-jvm:1.3.50") { files ->
files.any { it.name.startsWith("kotlin-annotations-jvm") }
}
}
@ExperimentalStdlibApi
fun testResolveWithRuntime() {
val compileOnly = "compile"
val co... | No issues found. |
fun testResolveSimple() {
resolveAndCheck("org.jetbrains.kotlin:kotlin-annotations-jvm:1.3.50") { files ->
files.any { it.name.startsWith("kotlin-annotations-jvm") }
}
}
@ExperimentalStdlibApi
fun testResolveWithRuntime() {
val compileOnly = "compile"
val co... | @@ -14,16 +14,21 @@ import kotlin.reflect.full.primaryConstructor
import kotlin.script.experimental.dependencies.maven.MavenDependenciesResolver
import kotlin.script.experimental.api.ResultWithDiagnostics
import kotlin.script.experimental.api.valueOrThrow
-import kotlin.script.experimental.dependencies.DependsOn
-im... | libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | Add dependency scopes option for scripting (Ivy and Maven) resolvers | 3,544 | JetBrains/kotlin | 51,705 | Kotlin | ileasile | Review this pull request change.
Language: Kotlin
File: libraries/scripting/dependencies-maven/test/kotlin/script/experimental/test/MavenResolverTest.kt
PR Title: Add dependency scopes option for scripting (Ivy and Maven) resolvers
BEFORE CODE:
fun testResolveSimple() {
resolveAndCheck("org.jetbrains.k... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
returns() implies (value != null)
}
return requireNotNull(value) { "Required value was null." }
}
/**
* Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is null. Otherwise
* returns the not null value.
*
* @sample samples.misc.Preconditions.failRequireNot... | No issues found. | returns() implies (value != null)
}
return requireNotNull(value) { "Required value was null." }
}
/**
* Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is null. Otherwise
* returns the not null value.
*
* @sample samples.misc.Preconditions.failRequireNot... | @@ -54,7 +54,7 @@ public inline fun <T : Any> requireNotNull(value: T?): T {
* Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is null. Otherwise
* returns the not null value.
*
- * @sample samples.misc.Preconditions.failRequireWithLazyMessage
+ * @sample samples.misc.... | libraries/stdlib/src/kotlin/util/Preconditions.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | KT-20357: Add a sample for requireNotNull | 3,584 | JetBrains/kotlin | 51,705 | Kotlin | yurano | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/src/kotlin/util/Preconditions.kt
PR Title: KT-20357: Add a sample for requireNotNull
BEFORE CODE: returns() implies (value != null)
}
return requireNotNull(value) { "Required value was null." }
}
/**
* Throws an [IllegalArgum... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.jvm.codegen
import org.jetbrains.kotlin.backend.jvm.lower.suspendFunctio... | No issues found. | /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.jvm.codegen
import org.jetbrains.kotlin.backend.jvm.lower.suspendFunctio... | @@ -0,0 +1,43 @@
+/*
+ * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
+ */
+
+package org.jetbrains.kotlin.backend.jvm.codegen
+
+import org.jetbrains.kotlin.backend... | compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCallGenerator.kt | 0 | Kotlin | 1 | none | 16 | 44 | 44 | true | JVM IR: Generate LVT entries for parameters in inline $default methods (KT-36769) | 3,660 | JetBrains/kotlin | 51,705 | Kotlin | sfs | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineCallGenerator.kt
PR Title: JVM IR: Generate LVT entries for parameters in inline $default methods (KT-36769)
BEFORE CODE: /*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Program... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
accessor.parent = parent
pendingAccessorsToAdd.add(accessor)
accessor.copyTypeParametersFrom(source, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR)
accessor.copyValueParametersToStatic(source, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR, expression.dispatchReceiver?.... | No issues found. | accessor.parent = parent
pendingAccessorsToAdd.add(accessor)
accessor.copyTypeParametersFrom(source, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR)
accessor.copyValueParametersToStatic(source, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR, expression.dispatchReceiver?.... | @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface
import org.jetbrains.kotlin.backend.jvm.intrinsics.receiverAndArgs
import org.jetbrains.kotlin.backend.jvm.ir.IrInlineReferenceLocator
import org.jetbrains.kotlin.backend.jvm.lower.inlineclasses.hasMangledParameters
-import org.jetbrain... | compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | [JVM_IR] Generate line numbers in synthetic bridges. | 3,725 | JetBrains/kotlin | 51,705 | Kotlin | madsager | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt
PR Title: [JVM_IR] Generate line numbers in synthetic bridges.
BEFORE CODE: accessor.parent = parent
pendingAccessorsToAdd.add(accessor)
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// TARGET_PLATFORM: JVM
// FILE: A.java
public class A {
public static String f() {
return "O";
}
}
// FILE: a.kt
open class C(x: String, y: String) {
val result = x + y
}
fun box() = object : C(y = "K", x = A.f()) {}.result
| No issues found. | // TARGET_PLATFORM: JVM
// FILE: A.java
public class A {
public static String f() {
return "O";
}
}
// FILE: a.kt
open class C(x: String, y: String) {
val result = x + y
}
fun box() = object : C(y = "K", x = A.f()) {}.result
| @@ -0,0 +1,13 @@
+// TARGET_PLATFORM: JVM
+// FILE: A.java
+public class A {
+ public static String f() {
+ return "O";
+ }
+}
+// FILE: a.kt
+open class C(x: String, y: String) {
+ val result = x + y
+}
+
+fun box() = object : C(y = "K", x = A.f()) {}.result | compiler/testData/codegen/box/argumentOrder/argumentOrderInObjectSuperCallWithPlatformType.kt | 0 | Kotlin | 1 | none | 16 | 14 | 14 | true | JVM_IR: fix lifting of arguments to object super constructors | 3,742 | JetBrains/kotlin | 51,705 | Kotlin | pyos | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/box/argumentOrder/argumentOrderInObjectSuperCallWithPlatformType.kt
PR Title: JVM_IR: fix lifting of arguments to object super constructors
BEFORE CODE: // TARGET_PLATFORM: JVM
// FILE: A.java
public class A {
public static String... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
expandInlineFunctionReferenceToLambda(expression, expression.getter!!.owner)
} else {
// ... else use field itself
expandInlineFieldReferenceToLambda(expression, expression.field!!.owner)
}
}
private fun expandInlineFieldReferenceToLambda(expression: IrProper... | No issues found. | expandInlineFunctionReferenceToLambda(expression, expression.getter!!.owner)
} else {
// ... else use field itself
expandInlineFieldReferenceToLambda(expression, expression.field!!.owner)
}
}
private fun expandInlineFieldReferenceToLambda(expression: IrProper... | @@ -42,20 +42,32 @@ internal val inlineCallableReferenceToLambdaPhase = makeIrFilePhase(
//
// foo(::smth) -> foo { a -> smth(a) }
//
-internal class InlineCallableReferenceToLambdaPhase(val context: JvmBackendContext) : FileLoweringPass,
- IrElementTransformerVoidWithContext() {
-
- private var inlinable... | compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InlineCallableReferenceToLambda.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | JVM_IR: fix bound suspend-converted references | 3,744 | JetBrains/kotlin | 51,705 | Kotlin | pyos | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/InlineCallableReferenceToLambda.kt
PR Title: JVM_IR: fix bound suspend-converted references
BEFORE CODE: expandInlineFunctionReferenceToLambda(expression, expression.getter!!.owner)... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
private val toStringFunction = stringBuilder.toStringFunction
private val defaultAppendFunction = stringBuilder.functions.single {
it.name.asString() == "append" &&
it.valueParameters.size == 1 &&
it.valueParameters.single().type.isNullableAny()
}
private val a... | No issues found. |
private val toStringFunction = stringBuilder.toStringFunction
private val defaultAppendFunction = stringBuilder.functions.single {
it.name.asString() == "append" &&
it.valueParameters.size == 1 &&
it.valueParameters.single().type.isNullableAny()
}
private val a... | @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.ir.JvmIrBuilder
import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder
+import org.jetbrains.kotlin.backend.jvm.lower.inlineclas... | compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStringConcatenationLowering.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | JVM_IR: check for null when converting unboxed inline classes to strings | 3,751 | JetBrains/kotlin | 51,705 | Kotlin | pyos | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmStringConcatenationLowering.kt
PR Title: JVM_IR: check for null when converting unboxed inline classes to strings
BEFORE CODE:
private val toStringFunction = stringBuilder.toStringFunct... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
value.materializeAt(fieldType, callee.type)
}
expression.markLineNumber(startOffset = true)
mv.visitFieldInsn(if (isStatic) Opcodes.PUTSTATIC else Opcodes.PUTFIELD, ownerName, fieldName, fieldType.descriptor)
assert(expression.type.isUnit())
u... | No issues found. | value.materializeAt(fieldType, callee.type)
}
expression.markLineNumber(startOffset = true)
mv.visitFieldInsn(if (isStatic) Opcodes.PUTSTATIC else Opcodes.PUTFIELD, ownerName, fieldName, fieldType.descriptor)
assert(expression.type.isUnit())
u... | @@ -792,9 +792,9 @@ class ExpressionCodegen(
override fun visitClass(declaration: IrClass, data: BlockInfo): PromisedValue {
if (declaration.origin != JvmLoweredDeclarationOrigin.CONTINUATION_CLASS) {
- closureReifiedMarkers[declaration] =
- ClassCodegen.getOrCreate(declaration... | compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | JVM_IR: slightly refactor ClassCodegen | 3,757 | JetBrains/kotlin | 51,705 | Kotlin | pyos | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt
PR Title: JVM_IR: slightly refactor ClassCodegen
BEFORE CODE: value.materializeAt(fieldType, callee.type)
}
expression.markLineNu... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
/**
* Creates a [Sequence] instance that wraps the original stream iterating through its elements.
*
* @sample samples.streams.Streams.streamAsSequence
*/
@SinceKotlin("1.2")
public fun <T> Stream<T>.asSequence(): Sequence<T> = Sequence { iterator() }
/**
* Creates a [Sequence] instance that wraps the original s... | No issues found. |
/**
* Creates a [Sequence] instance that wraps the original stream iterating through its elements.
*
* @sample samples.streams.Streams.streamAsSequence
*/
@SinceKotlin("1.2")
public fun <T> Stream<T>.asSequence(): Sequence<T> = Sequence { iterator() }
/**
* Creates a [Sequence] instance that wraps the original s... | @@ -24,55 +24,73 @@ import java.util.stream.*
/**
* Creates a [Sequence] instance that wraps the original stream iterating through its elements.
+ *
+ * @sample samples.streams.Streams.streamAsSequence
*/
@SinceKotlin("1.2")
public fun <T> Stream<T>.asSequence(): Sequence<T> = Sequence { iterator() }
/**
... | libraries/stdlib/jdk8/src/kotlin/streams/Streams.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | Added samples for the kotlin.streams package | 3,760 | JetBrains/kotlin | 51,705 | Kotlin | uzilan | Review this pull request change.
Language: Kotlin
File: libraries/stdlib/jdk8/src/kotlin/streams/Streams.kt
PR Title: Added samples for the kotlin.streams package
BEFORE CODE:
/**
* Creates a [Sequence] instance that wraps the original stream iterating through its elements.
*
* @sample samples.streams.Streams.s... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// !LANGUAGE: +InlineClasses
// FILE: A.kt
package z
inline class Z(val s: String)
class X {
fun Int.foo(z: Z, value: String = "OK") = value
}
// FILE: B.kt
import z.*
fun box(): String = with(X()) { 1.foo(Z("")) }
| No issues found. | // !LANGUAGE: +InlineClasses
// FILE: A.kt
package z
inline class Z(val s: String)
class X {
fun Int.foo(z: Z, value: String = "OK") = value
}
// FILE: B.kt
import z.*
fun box(): String = with(X()) { 1.foo(Z("")) }
| @@ -0,0 +1,14 @@
+// !LANGUAGE: +InlineClasses
+// FILE: A.kt
+package z
+
+inline class Z(val s: String)
+
+class X {
+ fun Int.foo(z: Z, value: String = "OK") = value
+}
+
+// FILE: B.kt
+import z.*
+
+fun box(): String = with(X()) { 1.foo(Z("")) } | compiler/testData/compileKotlinAgainstKotlin/defaultWithInlineClassAndReceivers.kt | 0 | Kotlin | 1 | none | 16 | 15 | 15 | true | JVM_IR: fix copying of receivers when unboxing inline class parameters | 3,764 | JetBrains/kotlin | 51,705 | Kotlin | pyos | Review this pull request change.
Language: Kotlin
File: compiler/testData/compileKotlinAgainstKotlin/defaultWithInlineClassAndReceivers.kt
PR Title: JVM_IR: fix copying of receivers when unboxing inline class parameters
BEFORE CODE: // !LANGUAGE: +InlineClasses
// FILE: A.kt
package z
inline class Z(val s: String)... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import org.jetbrains.org.objectweb.asm.Type.VOID_TYPE
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
class IrInlineIntrinsicsSupport(
private val context: JvmBackendContext,
private val typeMapper: IrTypeMapper
) : ReifiedTypeInliner.IntrinsicsSupport<IrType> {
override fun putClassInsta... | No issues found. | import org.jetbrains.org.objectweb.asm.Type.VOID_TYPE
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
class IrInlineIntrinsicsSupport(
private val context: JvmBackendContext,
private val typeMapper: IrTypeMapper
) : ReifiedTypeInliner.IntrinsicsSupport<IrType> {
override fun putClassInsta... | @@ -5,7 +5,7 @@
package org.jetbrains.kotlin.backend.jvm.codegen
-import org.jetbrains.kotlin.backend.common.ir.allParameters
+import org.jetbrains.kotlin.backend.common.ir.allParametersCount
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.intrinsics.SignatureStr... | compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineIntrinsicsSupport.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | [IR] Avoid extra lists creation during getting explicit/all parameters | 3,769 | JetBrains/kotlin | 51,705 | Kotlin | LepilkinaElena | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrInlineIntrinsicsSupport.kt
PR Title: [IR] Avoid extra lists creation during getting explicit/all parameters
BEFORE CODE: import org.jetbrains.org.objectweb.asm.Type.VOID_TYPE
import org.jet... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
if (isReal) return null
return resolveFakeOverride()?.run { if (parentAsClass.isInterface) this else null }
}
fun IrProperty.resolveFakeOverride(): IrProperty? = getter?.resolveFakeOverride()?.correspondingPropertySymbol?.owner
val IrClass.isAnnotationClass get() = kind == ClassKind.ANNOTATION_CLASS
val IrCl... | No issues found. | if (isReal) return null
return resolveFakeOverride()?.run { if (parentAsClass.isInterface) this else null }
}
fun IrProperty.resolveFakeOverride(): IrProperty? = getter?.resolveFakeOverride()?.correspondingPropertySymbol?.owner
val IrClass.isAnnotationClass get() = kind == ClassKind.ANNOTATION_CLASS
val IrCl... | @@ -285,7 +285,7 @@ fun IrAnnotationContainer.getAnnotation(name: FqName): IrConstructorCall? =
fun IrAnnotationContainer.hasAnnotation(name: FqName) =
annotations.any {
- it.symbol.owner.parentAsClass.fqNameWhenAvailable == name
+ it.symbol.owner.parentAsClass.hasEqualFqName(name)
}
fun I... | compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | [IR] Eliminated expensive calculating of fqNames | 3,815 | JetBrains/kotlin | 51,705 | Kotlin | LepilkinaElena | Review this pull request change.
Language: Kotlin
File: compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrUtils.kt
PR Title: [IR] Eliminated expensive calculating of fqNames
BEFORE CODE: if (isReal) return null
return resolveFakeOverride()?.run { if (parentAsClass.isInterface) this else null }
}
fun ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
override fun visitSetField(expression: IrSetField, data: BlockInfo): PromisedValue {
val expressionValue = expression.value
// Do not add redundant field initializers that initialize to default values.
val inClassInit = irFunction.origin == JvmLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZE... | No issues found. | override fun visitSetField(expression: IrSetField, data: BlockInfo): PromisedValue {
val expressionValue = expression.value
// Do not add redundant field initializers that initialize to default values.
val inClassInit = irFunction.origin == JvmLoweredDeclarationOrigin.CLASS_STATIC_INITIALIZE... | @@ -213,6 +213,10 @@ class ExpressionCodegen(
fun generate() {
mv.visitCode()
val startLabel = markNewLabel()
+ if (irFunction.origin == JvmLoweredDeclarationOrigin.MULTIFILE_BRIDGE) {
+ // Multifile bridges need to have line number 1 to be filtered out by the intellij debugging... | compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | [JVM_IR] Use line number 1 for multifile bridge methods. | 3,844 | JetBrains/kotlin | 51,705 | Kotlin | madsager | Review this pull request change.
Language: Kotlin
File: compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt
PR Title: [JVM_IR] Use line number 1 for multifile bridge methods.
BEFORE CODE: override fun visitSetField(expression: IrSetField, data: BlockInfo): PromisedValue {
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
factory
)
fun declareEnumEntry(
sig: IdSignature,
symbolFactory: () -> IrEnumEntrySymbol,
enumEntryFactory: (IrEnumEntrySymbol) -> IrEnumEntry
): IrEnumEntry = enumEntrySymbolTable.declare(sig, symbolFactory, enumEntryFactory)
fun declareEnumEntryIfNotExists(des... | No issues found. | factory
)
fun declareEnumEntry(
sig: IdSignature,
symbolFactory: () -> IrEnumEntrySymbol,
enumEntryFactory: (IrEnumEntrySymbol) -> IrEnumEntry
): IrEnumEntry = enumEntrySymbolTable.declare(sig, symbolFactory, enumEntryFactory)
fun declareEnumEntryIfNotExists(des... | @@ -216,9 +216,9 @@ class SymbolTable(
}
override fun set(d: D, s: S) {
- if (s.isPublicApi) {
- idSigToSymbol[s.signature] = s
- } else {
+ s.signature?.let {
+ idSigToSymbol[it] = s
+ } ?: run {
descriptorTo... | compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | [IR] Made signature nullable | 3,860 | JetBrains/kotlin | 51,705 | Kotlin | LepilkinaElena | Review this pull request change.
Language: Kotlin
File: compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt
PR Title: [IR] Made signature nullable
BEFORE CODE: factory
)
fun declareEnumEntry(
sig: IdSignature,
symbolFactory: () -> IrEnumEntrySymbol,
e... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// receiving the required environment variables happens on execution phase.
// TODO This needs to be fixed to improve UP-TO-DATE checks.
if (
isAvailableToProduceSynthetic
&& project.findPrope... | No issues found. | // receiving the required environment variables happens on execution phase.
// TODO This needs to be fixed to improve UP-TO-DATE checks.
if (
isAvailableToProduceSynthetic
&& project.findPrope... | @@ -197,7 +197,8 @@ open class KotlinCocoapodsPlugin : Plugin<Project> {
val frameworkPlatforms: List<KonanTarget> = when (requestedTargetName) {
KOTLIN_TARGET_FOR_IOS_DEVICE -> listOf(IOS_ARM64, IOS_ARM32)
KOTLIN_TARGET_FOR_WATCHOS_DEVICE -> listOf(WATCHOS_ARM32, WATCHOS_ARM64)
- ... | libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/cocoapods/KotlinCocoapodsPlugin.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | kotlin.native.cocoapods.targets can be a custom list of architectures | 3,861 | JetBrains/kotlin | 51,705 | Kotlin | MikeKulasinski-visa | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/native/cocoapods/KotlinCocoapodsPlugin.kt
PR Title: kotlin.native.cocoapods.targets can be a custom list of architectures
BEFORE CODE: // receiving... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import org.jetbrains.kotlinx.serialization.compiler.diagnostic.VersionReader
import org.jetbrains.kotlinx.serialization.compiler.resolve.*
abstract class SerializableCodegen(
protected val serializableDescriptor: ClassDescriptor,
bindingContext: BindingContext
) : AbstractSerialGenerator(bindingContext, serial... | No issues found. | import org.jetbrains.kotlinx.serialization.compiler.diagnostic.VersionReader
import org.jetbrains.kotlinx.serialization.compiler.resolve.*
abstract class SerializableCodegen(
protected val serializableDescriptor: ClassDescriptor,
bindingContext: BindingContext
) : AbstractSerialGenerator(bindingContext, serial... | @@ -16,18 +16,25 @@
package org.jetbrains.kotlinx.serialization.compiler.backend.common
+import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescri... | plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializableCodegen.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | Optimize check for missing fields in deserialization | 3,862 | JetBrains/kotlin | 51,705 | Kotlin | shanshin | Review this pull request change.
Language: Kotlin
File: plugins/kotlin-serialization/kotlin-serialization-compiler/src/org/jetbrains/kotlinx/serialization/compiler/backend/common/SerializableCodegen.kt
PR Title: Optimize check for missing fields in deserialization
BEFORE CODE: import org.jetbrains.kotlinx.serializa... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
@TestMetadata("itInLambda.kt")
public void testItInLambda() throws Exception {
runTest("compiler/testData/checkLocalVariablesTable/itInLambda.kt");
}
@TestMetadata("itInReturnedLambda.kt")
public void testItInReturnedLambda() throws Exception {
runTest("compiler/testData/checkLocalV... | No issues found. | @TestMetadata("itInLambda.kt")
public void testItInLambda() throws Exception {
runTest("compiler/testData/checkLocalVariablesTable/itInLambda.kt");
}
@TestMetadata("itInReturnedLambda.kt")
public void testItInReturnedLambda() throws Exception {
runTest("compiler/testData/checkLocalV... | @@ -188,10 +188,5 @@ public void testOtherParameters() throws Exception {
public void testParameters() throws Exception {
runTest("compiler/testData/checkLocalVariablesTable/parametersInSuspendLambda/parameters.kt");
}
-
- @TestMetadata("underscoreNames.kt")
- public void te... | compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java | 0 | Java | 1 | none | 16 | 51 | 51 | true | [JVM+IR] Rebase LVT test of destructuring in lambda params | 3,871 | JetBrains/kotlin | 51,705 | Kotlin | kandersen | Review this pull request change.
Language: Java
File: compiler/tests/org/jetbrains/kotlin/codegen/CheckLocalVariablesTableTestGenerated.java
PR Title: [JVM+IR] Rebase LVT test of destructuring in lambda params
BEFORE CODE: @TestMetadata("itInLambda.kt")
public void testItInLambda() throws Exception {
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// FILE: J.java
public class J {
public interface F {
public int call(String x)
}
public static void g(F r) {
r.call(null);
}
}
// FILE: test.kt
fun nonInlineFun() {
val f: (String?) -> Int = { s -> 0 }
J.g(f)
}
inline fun inlineFun() {
val f: (String?) -> Int = { s -> 0... | No issues found. | // FILE: J.java
public class J {
public interface F {
public int call(String x)
}
public static void g(F r) {
r.call(null);
}
}
// FILE: test.kt
fun nonInlineFun() {
val f: (String?) -> Int = { s -> 0 }
J.g(f)
}
inline fun inlineFun() {
val f: (String?) -> Int = { s -> 0... | @@ -0,0 +1,29 @@
+// FILE: J.java
+
+public class J {
+ public interface F {
+ public int call(String x)
+ }
+
+ public static void g(F r) {
+ r.call(null);
+ }
+}
+
+// FILE: test.kt
+
+fun nonInlineFun() {
+ val f: (String?) -> Int = { s -> 0 }
+ J.g(f)
+}
+
+inline fun inlineFun() {
+... | compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt | 0 | Kotlin | 1 | none | 16 | 29 | 29 | true | JVM IR: SAM wrapper ABI fixes | 3,873 | JetBrains/kotlin | 51,705 | Kotlin | sfs | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/bytecodeText/sam/samWrapperRawTypes.kt
PR Title: JVM IR: SAM wrapper ABI fixes
BEFORE CODE: // FILE: J.java
public class J {
public interface F {
public int call(String x)
}
public static void g(F r) {
r.... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// FILE: A.java
public abstract class A<T> {
protected abstract String doIt(T... args);
class B<S extends T, U extends S> {
public String test(T... args) {
return doIt(args);
}
public String test2(S... args) {
return doIt(args);
}
public String... | No issues found. | // FILE: A.java
public abstract class A<T> {
protected abstract String doIt(T... args);
class B<S extends T, U extends S> {
public String test(T... args) {
return doIt(args);
}
public String test2(S... args) {
return doIt(args);
}
public String... | @@ -0,0 +1,37 @@
+// FILE: A.java
+
+public abstract class A<T> {
+ protected abstract String doIt(T... args);
+
+ class B<S extends T, U extends S> {
+ public String test(T... args) {
+ return doIt(args);
+ }
+
+ public String test2(S... args) {
+ return doIt(args);
+ ... | compiler/testData/codegen/boxAgainstJava/varargs/varargsOverride3.kt | 0 | Kotlin | 1 | none | 16 | 38 | 38 | true | [JVM_IR] Determine correct type of empty varargs array. | 3,874 | JetBrains/kotlin | 51,705 | Kotlin | madsager | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/boxAgainstJava/varargs/varargsOverride3.kt
PR Title: [JVM_IR] Determine correct type of empty varargs array.
BEFORE CODE: // FILE: A.java
public abstract class A<T> {
protected abstract String doIt(T... args);
class B<S exte... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
abstract class A<T> {
protected abstract fun doIt(vararg args: T): String
fun test() = doIt()
}
class B : A<Void>() {
override fun doIt(vararg args: Void): String = "OK"
}
| No issues found. | abstract class A<T> {
protected abstract fun doIt(vararg args: T): String
fun test() = doIt()
}
class B : A<Void>() {
override fun doIt(vararg args: Void): String = "OK"
}
| @@ -0,0 +1,8 @@
+abstract class A<T> {
+ protected abstract fun doIt(vararg args: T): String
+ fun test() = doIt()
+}
+
+class B : A<Void>() {
+ override fun doIt(vararg args: Void): String = "OK"
+} | compiler/testData/codegen/bytecodeListing/varargsBridge.kt | 0 | Kotlin | 1 | none | 16 | 9 | 9 | true | [JVM_IR] Follow old backend in bridge visibility and varargs marking. | 3,879 | JetBrains/kotlin | 51,705 | Kotlin | madsager | Review this pull request change.
Language: Kotlin
File: compiler/testData/codegen/bytecodeListing/varargsBridge.kt
PR Title: [JVM_IR] Follow old backend in bridge visibility and varargs marking.
BEFORE CODE: abstract class A<T> {
protected abstract fun doIt(vararg args: T): String
fun test() = doIt()
}
cla... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
assertSuccessful()
// Main source set should have a *.kotlin_module file without '_main'
assertFileExists(kotlinClassesDir() + "META-INF/$archivesBaseName.kotlin_module")
assertFileExists(kotlinClassesDir(sourceSet = "deploy") + "META-INF/${archivesBaseName}_deploy.kotlin... | No issues found. | assertSuccessful()
// Main source set should have a *.kotlin_module file without '_main'
assertFileExists(kotlinClassesDir() + "META-INF/$archivesBaseName.kotlin_module")
assertFileExists(kotlinClassesDir(sourceSet = "deploy") + "META-INF/${archivesBaseName}_deploy.kotlin... | @@ -17,6 +17,7 @@
package org.jetbrains.kotlin.gradle
import org.gradle.api.logging.LogLevel
+import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_LOADED_WARNING
import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_SPECIFIC_PROJECTS... | libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt | 0 | Kotlin | 1 | none | 16 | 51 | 51 | true | MPP plugin: add expectedBy deps to "api" configuration | 3,909 | JetBrains/kotlin | 51,705 | Kotlin | bingranl | Review this pull request change.
Language: Kotlin
File: libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/KotlinGradlePluginIT.kt
PR Title: MPP plugin: add expectedBy deps to "api" configuration
BEFORE CODE: assertSuccessful()
// Main source s... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.