Compare commits

...

6 Commits

Author SHA1 Message Date
Nicolay Mitropolsky
4a4eee7b36 JavaClassifierTypeImpl.resolutionResult dropped 2020-06-18 10:34:22 +03:00
Ilya Gorbunov
e13a38a758 Fix OnlyInputType usage in tests where it can be invisible 2020-06-18 09:34:13 +03:00
Jinseong Jeon
9e9ca4953f FIR2IR: coerce to Unit when "when" expr is not effectively exhaustive 2020-06-18 09:23:32 +03:00
Vladimir Ilmov
62dcfcde79 (CoroutineDebugger) -core jar has precedence over -debug
#KT-39412 fixed
 #KT-39648 fixed
2020-06-17 23:48:09 +02:00
Dmitry Petrov
4739adb6dc KT-36992 Do not generate annotations on synthetic accessors
Also, do not generate nullability annotations on synthetic methods.
2020-06-17 23:54:51 +03:00
Steven Schäfer
03651f1dd4 IR: Fix inner class type parameters in IrTypeSystemContext 2020-06-17 22:10:00 +03:00
34 changed files with 202 additions and 50 deletions

View File

@@ -581,11 +581,15 @@ class Fir2IrVisitor(
KtNodeTypes.POSTFIX_EXPRESSION -> IrStatementOrigin.EXCLEXCL
else -> null
}
// If the constant true branch has empty body, it won't be converted. Thus, the entire `when` expression is effectively _not_
// exhaustive anymore. In that case, coerce the return type of `when` expression to Unit as per the backend expectation.
val effectivelyNotExhaustive = !whenExpression.isExhaustive ||
whenExpression.branches.any { it.condition is FirElseIfTrueCondition && it.result.statements.isEmpty() }
return conversionScope.withWhenSubject(subjectVariable) {
whenExpression.convertWithOffsets { startOffset, endOffset ->
val irWhen = IrWhenImpl(
startOffset, endOffset,
whenExpression.typeRef.toIrType(),
if (effectivelyNotExhaustive) irBuiltIns.unitType else whenExpression.typeRef.toIrType(),
origin
).apply {
var unconditionalBranchFound = false

View File

@@ -14130,6 +14130,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/innerNested/innerGenericClassFromJava.kt");
}
@TestMetadata("innerImplicitParameter.kt")
public void testInnerImplicitParameter() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
}
@TestMetadata("innerJavaClass.kt")
public void testInnerJavaClass() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerJavaClass.kt");

View File

@@ -24,8 +24,6 @@ import java.util.ArrayList
class JavaClassifierTypeImpl(psiClassType: PsiClassType) : JavaTypeImpl<PsiClassType>(psiClassType), JavaClassifierType {
private var resolutionResult: ResolutionResult? = null
override val classifier: JavaClassifierImpl<*>?
get() = resolve().classifier
@@ -65,15 +63,13 @@ class JavaClassifierTypeImpl(psiClassType: PsiClassType) : JavaTypeImpl<PsiClass
)
private fun resolve(): ResolutionResult {
return resolutionResult ?: run {
return run {
val result = psi.resolveGenerics()
val psiClass = result.element
val substitutor = result.substitutor
ResolutionResult(
psiClass?.let { JavaClassifierImpl.create(it) }, substitutor, PsiClassType.isRaw(result)
).apply {
resolutionResult = this
}
)
}
}

View File

@@ -18,6 +18,8 @@ interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin {
object LAMBDA_IMPL : IrDeclarationOriginImpl("LAMBDA_IMPL")
object FUNCTION_REFERENCE_IMPL : IrDeclarationOriginImpl("FUNCTION_REFERENCE_IMPL", isSynthetic = true)
object SYNTHETIC_ACCESSOR : IrDeclarationOriginImpl("SYNTHETIC_ACCESSOR", isSynthetic = true)
object SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR :
IrDeclarationOriginImpl("SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR", isSynthetic = true)
object SYNTHETIC_MARKER_PARAMETER : IrDeclarationOriginImpl("SYNTHETIC_MARKER_PARAMETER", isSynthetic = true)
object TO_ARRAY : IrDeclarationOriginImpl("TO_ARRAY")
object JVM_STATIC_WRAPPER : IrDeclarationOriginImpl("JVM_STATIC_WRAPPER")

View File

@@ -277,12 +277,15 @@ abstract class AnnotationCodegen(
companion object {
private fun isInvisibleFromTheOutside(declaration: IrDeclaration?): Boolean {
if (declaration is IrSimpleFunction && declaration.origin === JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR) {
if (declaration is IrSimpleFunction && declaration.origin.isSynthetic) {
return true
}
if (declaration is IrDeclarationWithVisibility) {
return !declaration.visibility.isVisibleOutside()
}
if (declaration is IrValueParameter && (declaration.parent as IrDeclaration).origin.isSynthetic) {
return true
}
return false
}

View File

@@ -130,6 +130,7 @@ internal fun IrFunction.shouldContainSuspendMarkers(): Boolean = !isInvokeSuspen
origin != JvmLoweredDeclarationOrigin.JVM_OVERLOADS_WRAPPER &&
origin != JvmLoweredDeclarationOrigin.MULTIFILE_BRIDGE &&
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR &&
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR &&
origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE &&
origin != JvmLoweredDeclarationOrigin.DEFAULT_IMPLS_BRIDGE_TO_SYNTHETIC &&
origin != IrDeclarationOrigin.BRIDGE &&

View File

@@ -69,7 +69,9 @@ class FunctionCodegen(
generateParameterNames(irFunction, methodVisitor, signature, context.state)
}
if (irFunction.origin != IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER) {
if (irFunction.origin != IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER &&
irFunction.origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR
) {
object : AnnotationCodegen(classCodegen, context) {
override fun visitAnnotation(descr: String?, visible: Boolean): AnnotationVisitor {
return methodVisitor.visitAnnotation(descr, visible)

View File

@@ -217,12 +217,13 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
get() = this in context.hiddenConstructors || (
!Visibilities.isPrivate(visibility) && !constructedClass.isInline && hasMangledParameters &&
origin != IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER &&
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR)
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR &&
origin != JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR)
private fun handleHiddenConstructor(declaration: IrConstructor): IrConstructorImpl {
require(declaration.isOrShouldBeHidden, declaration::render)
return context.hiddenConstructors.getOrPut(declaration) {
declaration.makeConstructorAccessor().also { accessor ->
declaration.makeConstructorAccessor(JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR_FOR_HIDDEN_CONSTRUCTOR).also { accessor ->
// There's a special case in the JVM backend for serializing the metadata of hidden
// constructors - we serialize the descriptor of the original constructor, but the
// signature of the accessor. We implement this special case in the JVM IR backend by
@@ -249,11 +250,14 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
candidates.lastOrNull { parent is IrClass && it.isSubclassOf(parent) } ?: classes.last()
} else parent
private fun IrConstructor.makeConstructorAccessor(): IrConstructorImpl {
private fun IrConstructor.makeConstructorAccessor(
originForConstructorAccessor: IrDeclarationOrigin =
JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR
): IrConstructorImpl {
val source = this
return buildConstructor {
origin = JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR
origin = originForConstructorAccessor
name = source.name
visibility = Visibilities.PUBLIC
}.also { accessor ->

View File

@@ -112,7 +112,7 @@ interface IrTypeSystemContext : TypeSystemContext, TypeSystemCommonSuperTypesCon
private fun getTypeParameters(typeConstructor: TypeConstructorMarker): List<IrTypeParameter> {
return when (typeConstructor) {
is IrTypeParameterSymbol -> emptyList()
is IrClassSymbol -> typeConstructor.owner.typeParameters
is IrClassSymbol -> extractTypeParameters(typeConstructor.owner)
else -> error("unsupported type constructor")
}
}

View File

@@ -42,7 +42,7 @@ public final class Override5Kt$inlineMe$1$generic$2 {
inner class Override5Kt$inlineMe$1$generic$2
static method <clinit>(): void
public method <init>(): void
public synthetic bridge @org.jetbrains.annotations.Nullable method invoke(): java.lang.Object
public synthetic bridge method invoke(): java.lang.Object
public final method invoke(): void
}

View File

@@ -0,0 +1,11 @@
open class C<T> {
inner class A<U>(val x: T?, val y: U)
class D : C<Nothing>() {
fun f() = A<String>(null, "OK")
}
}
fun box(): String {
return C.D().f().y
}

View File

@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME

View File

@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME

View File

@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME

View File

@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
annotation class Ann
class Foo private @Ann constructor(@Ann s: String) {

View File

@@ -0,0 +1,22 @@
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class Ann
@kotlin.Metadata
public final class Foo$Companion {
inner class Foo$Companion
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public final method foo(): void
}
@kotlin.Metadata
public final class Foo {
public final static @org.jetbrains.annotations.NotNull field Companion: Foo$Companion
inner class Foo$Companion
static method <clinit>(): void
private @Ann method <init>(@Ann p0: java.lang.String): void
public synthetic method <init>(p0: java.lang.String, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic final static method access$foo(p0: Foo, p1: java.lang.String): void
private final @Ann method foo(@Ann p0: java.lang.String): void
}

View File

@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
// IGNORE_BACKEND: JVM_IR
annotation class Ann

View File

@@ -0,0 +1,69 @@
@java.lang.annotation.Retention
@kotlin.Metadata
public annotation class Ann
@kotlin.Metadata
public final class Sealed$Derived {
inner class Sealed$Derived
private method <init>(p0: int): void
public synthetic @Ann method <init>(p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
}
@kotlin.Metadata
public final class Sealed$Inner {
synthetic final @org.jetbrains.annotations.NotNull field this$0: Sealed
private final field z2: int
inner class Sealed$Inner
public synthetic @Ann method <init>(p0: Sealed, p1: int, @Ann p2: int, @Ann p3: java.lang.String, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
private method <init>(p0: Sealed, p1: int, p2: int, p3: java.lang.String): void
public final method getZ2-a_XrcN0(): int
}
@kotlin.Metadata
public abstract class Sealed {
private final field z: int
inner class Sealed$Derived
inner class Sealed$Inner
private @Ann method <init>(@Ann p0: int): void
public synthetic method <init>(p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
public final method getZ-a_XrcN0(): int
}
@kotlin.Metadata
public final class Test$Inner {
synthetic final @org.jetbrains.annotations.NotNull field this$0: Test
private final field z2: int
inner class Test$Inner
public synthetic @Ann method <init>(p0: Test, p1: int, @Ann p2: int, @Ann p3: java.lang.String, p4: kotlin.jvm.internal.DefaultConstructorMarker): void
private method <init>(p0: Test, p1: int, p2: int, p3: java.lang.String): void
public final method getZ2-a_XrcN0(): int
}
@kotlin.Metadata
public final class Test {
private final field z: int
inner class Test$Inner
public synthetic @Ann method <init>(@Ann p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
private method <init>(p0: int): void
public synthetic @Ann method <init>(p0: int, @Ann p1: int, p2: kotlin.jvm.internal.DefaultConstructorMarker): void
private @Ann method <init>(p0: int, @Ann p1: java.lang.String): void
private method <init>(p0: int, p1: int): void
public final method getZ-a_XrcN0(): int
}
@kotlin.Metadata
public final class Z {
private final field x: int
private synthetic method <init>(p0: int): void
public synthetic final static method box-impl(p0: int): Z
public static method constructor-impl(p0: int): int
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public final method getX(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static @org.jetbrains.annotations.NotNull method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}

View File

@@ -10,13 +10,13 @@ synthetic final class Hello/Foo__MultifileSuspendKt$main$2 {
inner class Hello/Foo__MultifileSuspendKt$main$2
method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String[]): void
public final @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
public synthetic bridge @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
public synthetic bridge method invoke(p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
@kotlin.jvm.JvmName
synthetic final class Hello/Foo__MultifileSuspendKt {
inner class Hello/Foo__MultifileSuspendKt$main$2
public synthetic final static method main(@org.jetbrains.annotations.NotNull p0: java.lang.String[]): void
public final static @org.jetbrains.annotations.Nullable method main(@org.jetbrains.annotations.NotNull p0: java.lang.String[], @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public synthetic final static method main(p0: java.lang.String[]): void
}

View File

@@ -1,5 +1,5 @@
@kotlin.Metadata
public final class ParameterlessMainKt {
public final static method main(): void
public synthetic final static method main(@org.jetbrains.annotations.NotNull p0: java.lang.String[]): void
public synthetic final static method main(p0: java.lang.String[]): void
}

View File

@@ -4,12 +4,12 @@ synthetic final class SuspendMainKt$main$2 {
inner class SuspendMainKt$main$2
method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String[]): void
public final @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
public synthetic bridge @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
public synthetic bridge method invoke(p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class SuspendMainKt {
inner class SuspendMainKt$main$2
public synthetic final static method main(@org.jetbrains.annotations.NotNull p0: java.lang.String[]): void
public final static @org.jetbrains.annotations.Nullable method main(@org.jetbrains.annotations.NotNull p0: java.lang.String[], @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object
public synthetic final static method main(p0: java.lang.String[]): void
}

View File

@@ -31,7 +31,7 @@ FILE fqName:<root> fileName:/ifElseIf.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Boolean type=kotlin.Boolean value=true
WHEN type=kotlin.Any origin=IF
WHEN type=kotlin.Unit origin=IF
BRANCH
if: GET_VAR 'flag: kotlin.Boolean declared in <root>.testEmptyBranches1' type=kotlin.Boolean origin=null
then: CONST Boolean type=kotlin.Boolean value=true
@@ -45,7 +45,7 @@ FILE fqName:<root> fileName:/ifElseIf.kt
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Boolean type=kotlin.Boolean value=true
WHEN type=kotlin.Any origin=IF
WHEN type=kotlin.Unit origin=IF
BRANCH
if: GET_VAR 'flag: kotlin.Boolean declared in <root>.testEmptyBranches2' type=kotlin.Boolean origin=null
then: CONST Boolean type=kotlin.Boolean value=true

View File

@@ -15350,6 +15350,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/innerNested/innerGenericClassFromJava.kt");
}
@TestMetadata("innerImplicitParameter.kt")
public void testInnerImplicitParameter() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
}
@TestMetadata("innerJavaClass.kt")
public void testInnerJavaClass() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerJavaClass.kt");

View File

@@ -15350,6 +15350,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/innerNested/innerGenericClassFromJava.kt");
}
@TestMetadata("innerImplicitParameter.kt")
public void testInnerImplicitParameter() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
}
@TestMetadata("innerJavaClass.kt")
public void testInnerJavaClass() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerJavaClass.kt");

View File

@@ -14130,6 +14130,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/innerNested/innerGenericClassFromJava.kt");
}
@TestMetadata("innerImplicitParameter.kt")
public void testInnerImplicitParameter() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
}
@TestMetadata("innerJavaClass.kt")
public void testInnerJavaClass() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerJavaClass.kt");

View File

@@ -30,19 +30,21 @@ class KotlinGradleCoroutineDebugProjectResolver : AbstractProjectResolverExtensi
gradle.taskGraph.beforeTask { Task task ->
if (task instanceof Test) {
def kotlinxCoroutinesDebugJar = task.classpath.find { it.name.startsWith("kotlinx-coroutines-debug") }
if (kotlinxCoroutinesDebugJar)
task.jvmArgs ("-javaagent:${'$'}{kotlinxCoroutinesDebugJar?.absolutePath}", "-ea")
else {
for (lib in task.getClasspath()) {
def results = (lib.getName() =~ /kotlinx-coroutines-core\-([\d\.]+)\.jar${'$'}/).findAll()
if (results) {
def version = results.first()[1]
if (org.gradle.util.VersionNumber.parse( version ) >= org.gradle.util.VersionNumber.parse( '1.3.6' )) {
task.jvmArgs ("-javaagent:${'$'}{lib?.absolutePath}", "-ea")
}
def kotlinxCoroutinesCoreJar = task.classpath.find { it.name.startsWith("kotlinx-coroutines-core") }
if (kotlinxCoroutinesCoreJar) {
def results = (kotlinxCoroutinesCoreJar.getName() =~ /kotlinx-coroutines-core\-([\d\.]+)\.jar${'$'}/).findAll()
if (results) {
def version = results.first()[1]
if (org.gradle.util.VersionNumber.parse( version ) >= org.gradle.util.VersionNumber.parse('1.3.6')) {
task.jvmArgs ("-javaagent:${'$'}{kotlinxCoroutinesCoreJar?.absolutePath}", "-ea")
return
}
}
}
if (kotlinxCoroutinesDebugJar) {
task.jvmArgs ("-javaagent:${'$'}{kotlinxCoroutinesDebugJar?.absolutePath}", "-ea")
return
}
}
}
""".trimIndent()

View File

@@ -47,12 +47,14 @@ class DebuggerConnection(
val kotlinxCoroutinesDebug = params.classPath?.pathList?.firstOrNull { it.contains("kotlinx-coroutines-debug") }
val mode = when {
kotlinxCoroutinesDebug != null -> {
CoroutineDebuggerMode.VERSION_UP_TO_1_3_5
}
kotlinxCoroutinesCore != null -> {
determineCoreVersionMode(kotlinxCoroutinesCore)
val coreVersion = determineCoreVersionMode(kotlinxCoroutinesCore)
if (coreVersion == CoroutineDebuggerMode.DISABLED && kotlinxCoroutinesDebug != null)
CoroutineDebuggerMode.VERSION_UP_TO_1_3_5
else
CoroutineDebuggerMode.DISABLED
}
kotlinxCoroutinesDebug != null -> CoroutineDebuggerMode.VERSION_UP_TO_1_3_5
else -> CoroutineDebuggerMode.DISABLED
}
@@ -68,10 +70,10 @@ class DebuggerConnection(
private fun determineCoreVersionMode(kotlinxCoroutinesCore: String): CoroutineDebuggerMode {
val regex = Regex(""".+\Wkotlinx-coroutines-core-(.+)?\.jar""")
val matchResult = regex.matchEntire(kotlinxCoroutinesCore) ?: return CoroutineDebuggerMode.DISABLED
val versionToCompareTo = DefaultArtifactVersion("1.3.5-255")
val coroutinesCoreVersion = DefaultArtifactVersion(matchResult.groupValues[1])
val versionToCompareTo = DefaultArtifactVersion("1.3.5")
return if (versionToCompareTo < coroutinesCoreVersion)
val artifactVersion = DefaultArtifactVersion(matchResult.groupValues[1])
return if (artifactVersion >= versionToCompareTo)
CoroutineDebuggerMode.VERSION_1_3_6_AND_UP
else
CoroutineDebuggerMode.DISABLED

View File

@@ -55,7 +55,6 @@ class ContinuationHolder private constructor(val context: DefaultExecutionContex
}
CoroutineNameIdState.instance(ci)
} else {
CoroutineInfoData.log.warn("Coroutine agent information not found.")
CoroutineNameIdState(CoroutineInfoData.DEFAULT_COROUTINE_NAME, "-1", State.UNKNOWN, null)
}
}

View File

@@ -13,6 +13,7 @@ import com.sun.jdi.AbsentInformationException
import com.sun.jdi.Location
import com.sun.jdi.ReferenceType
import org.jetbrains.kotlin.idea.debugger.evaluate.DefaultExecutionContext
import org.jetbrains.kotlin.utils.checkWithAttachment
class LocationCache(val context: DefaultExecutionContext) {
private val classesByName = ClassesByNameProvider.createCache(context.vm.allClasses())
@@ -39,8 +40,13 @@ class LocationCache(val context: DefaultExecutionContext) {
} catch (ignored: AbsentInformationException) {
}
}
checkWithAttachment(type != null, {
"Bad type: $type"
}) {
it.withAttachment("type", type)
it.withAttachment("methodName", methodName)
it.withAttachment("line", line)
}
return GeneratedLocation(context.debugProcess, type, methodName, line)
}
}

View File

@@ -112,7 +112,7 @@ class CoroutineInfo private constructor(
private const val AGENT_135_AND_UP_CLASS_NAME = "kotlinx.coroutines.debug.internal.DebugCoroutineInfo"
fun instance(debugProbesImplMirror: DebugProbesImpl, context: DefaultExecutionContext): CoroutineInfo? {
val classType = context.findClassSafe(AGENT_134_CLASS_NAME) ?: context.findClassSafe(AGENT_135_AND_UP_CLASS_NAME) ?: return null
val classType = context.findClassSafe(AGENT_135_AND_UP_CLASS_NAME) ?: context.findClassSafe(AGENT_134_CLASS_NAME) ?: return null
return try {
CoroutineInfo(debugProbesImplMirror, context, classType.name())
} catch (e: IllegalStateException) {

View File

@@ -12285,6 +12285,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/innerNested/innerGeneric.kt");
}
@TestMetadata("innerImplicitParameter.kt")
public void testInnerImplicitParameter() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
}
@TestMetadata("innerLabeledThis.kt")
public void testInnerLabeledThis() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerLabeledThis.kt");

View File

@@ -12295,6 +12295,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/innerNested/innerGeneric.kt");
}
@TestMetadata("innerImplicitParameter.kt")
public void testInnerImplicitParameter() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
}
@TestMetadata("innerLabeledThis.kt")
public void testInnerLabeledThis() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerLabeledThis.kt");

View File

@@ -12360,6 +12360,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/innerNested/innerGeneric.kt");
}
@TestMetadata("innerImplicitParameter.kt")
public void testInnerImplicitParameter() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
}
@TestMetadata("innerLabeledThis.kt")
public void testInnerLabeledThis() throws Exception {
runTest("compiler/testData/codegen/box/innerNested/innerLabeledThis.kt");

View File

@@ -7,7 +7,6 @@ package test.reflection
import org.junit.Test
import java.lang.reflect.*
import kotlin.internal.OnlyInputTypes
import kotlin.reflect.javaType
import kotlin.reflect.typeOf
import kotlin.test.assertEquals
@@ -322,7 +321,7 @@ class JavaTypeTest {
private inline fun <reified T> javaTypeOf(): Type =
typeOf<T>().javaType
private fun <@OnlyInputTypes T> assertEqualsAndHashCode(expected: T, actual: T, message: String? = null) {
private fun <@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @kotlin.internal.OnlyInputTypes T> assertEqualsAndHashCode(expected: T, actual: T, message: String? = null) {
assertEquals(expected, actual, message)
assertEquals(actual, expected, message)
assertEquals(expected.hashCode(), actual.hashCode(), message)