[MERGE] KT: build-1.5.0-dev-1963 KT/N: 52fe74ede OLD: ece5d9b10

This commit is contained in:
Nikolay Krasko
2021-01-26 17:38:13 +03:00
954 changed files with 10545 additions and 5727 deletions
@@ -26,7 +26,7 @@ import java.io.File.separator
class Kotlin2JvmTask : KotlinCompilerBaseTask() {
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
var includeRuntime: Boolean = true
var includeRuntime: Boolean = false
var moduleName: String? = null
var noReflect: Boolean = false
+4 -3
View File
@@ -426,7 +426,7 @@ allprojects {
jcenter()
maven(protobufRepo)
maven(intellijRepo)
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
maven("https://dl.google.com/dl/android/maven2")
bootstrapKotlinRepo?.let(::maven)
@@ -466,11 +466,12 @@ allprojects {
if (useJvmFir) {
freeCompilerArgs += "-Xuse-fir"
freeCompilerArgs += "-Xabi-stability=stable"
}
}
}
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
if (!kotlinBuildProperties.isInJpsBuildIdeaSync && !kotlinBuildProperties.useFir) {
// For compiler and stdlib, allWarningsAsErrors is configured in the corresponding "root" projects
// (compiler/build.gradle.kts and libraries/commonConfiguration.gradle).
val projectsWithWarningsAsErrors = listOf("core", "plugins").map { File(it).absoluteFile }
@@ -503,7 +504,7 @@ allprojects {
}
tasks.withType<Test> {
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { !isTestDistributionEnabled() }
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
}
normalization {
+3 -3
View File
@@ -12,10 +12,10 @@ buildscript {
repositories {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies")
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
} else {
jcenter()
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
}
project.bootstrapKotlinRepo?.let {
@@ -88,7 +88,7 @@ extra["customDepsOrg"] = "kotlin.build"
repositories {
jcenter()
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
maven("https://kotlin.bintray.com/kotlin-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
gradlePluginPortal()
extra["bootstrapKotlinRepo"]?.let {
+2 -2
View File
@@ -14,9 +14,9 @@ pluginManagement {
buildscript {
repositories {
if (cacheRedirectorEnabled == 'true') {
maven { url "https://cache-redirector.jetbrains.com/kotlin.bintray.com/kotlin-dependencies" }
maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
} else {
maven { url "https://kotlin.bintray.com/kotlin-dependencies" }
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
}
}
dependencies {
@@ -742,7 +742,11 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// Some forms of for-loop can be optimized as post-condition loops.
PseudoInsnsKt.fakeAlwaysFalseIfeq(v, continueLabel);
// Renew line number cause it could be reset by inline (resetLastLineNumber) in generator.checkPreCondition(loopExit).
markStartLineNumber(generator.getForExpression());
v.nop();
generator.beforeBody();
blockStackElements.push(new LoopBlockStackElement(loopExit, continueLabel, targetLabel(generator.getForExpression())));
generator.body();
blockStackElements.pop();
@@ -157,13 +157,8 @@ class MethodInliner(
// MethodRemapper doesn't extends LocalVariablesSorter, but RemappingMethodAdapter does.
// So wrapping with LocalVariablesSorter to keep old behavior
// TODO: investigate LocalVariablesSorter removing (see also same code in RemappingClassBuilder.java)
val remappingMethodAdapter = MethodRemapper(
LocalVariablesSorter(
resultNode.access,
resultNode.desc,
wrapWithMaxLocalCalc(resultNode)
), AsmTypeRemapper(remapper, result)
)
val localVariablesSorter = LocalVariablesSorter(resultNode.access, resultNode.desc, wrapWithMaxLocalCalc(resultNode))
val remappingMethodAdapter = MethodRemapper(localVariablesSorter, AsmTypeRemapper(remapper, result))
val fakeContinuationName = CoroutineTransformer.findFakeContinuationConstructorClassName(node)
val markerShift = calcMarkerShift(parameters, node)
@@ -174,7 +169,9 @@ class MethodInliner(
transformationInfo = iterator.next()
val oldClassName = transformationInfo!!.oldClassName
if (transformationInfo!!.shouldRegenerate(isSameModule)) {
if (inliningContext.parent?.transformationInfo?.oldClassName == oldClassName) {
// Object constructs itself, don't enter an infinite recursion of regeneration.
} else if (transformationInfo!!.shouldRegenerate(isSameModule)) {
//TODO: need poping of type but what to do with local funs???
val newClassName = transformationInfo!!.newClassName
remapper.addMapping(oldClassName, newClassName)
@@ -206,7 +203,7 @@ class MethodInliner(
ReifiedTypeInliner.putNeedClassReificationMarker(mv)
result.reifiedTypeParametersUsages.mergeAll(transformResult.reifiedTypeParametersUsages)
}
} else if (!transformationInfo!!.wasAlreadyRegenerated) {
} else {
result.addNotChangedClass(oldClassName)
}
}
@@ -300,7 +297,7 @@ class MethodInliner(
val varRemapper = LocalVarRemapper(lambdaParameters, valueParamShift)
//TODO add skipped this and receiver
val lambdaResult = inliner.doInline(this.mv, varRemapper, true, info, invokeCall.finallyDepthShift)
val lambdaResult = inliner.doInline(localVariablesSorter, varRemapper, true, info, invokeCall.finallyDepthShift)
result.mergeWithNotChangeInfo(lambdaResult)
result.reifiedTypeParametersUsages.mergeAll(lambdaResult.reifiedTypeParametersUsages)
@@ -312,19 +309,19 @@ class MethodInliner(
inlineOnlySmapSkipper?.onInlineLambdaEnd(remappingMethodAdapter)
} else if (isAnonymousConstructorCall(owner, name)) { //TODO add method
//TODO add proper message
var info = transformationInfo as? AnonymousObjectTransformationInfo ?: throw AssertionError(
val newInfo = transformationInfo as? AnonymousObjectTransformationInfo ?: throw AssertionError(
"<init> call doesn't correspond to object transformation info for '$owner.$name': $transformationInfo"
)
val objectConstructsItself = inlineCallSiteInfo.ownerClassName == info.oldClassName
if (objectConstructsItself) {
// inline fun f() -> new f$1 -> fun something() in class f$1 -> new f$1
// ^-- fetch the info that was created for this instruction
info = inliningContext.parent?.transformationInfo as? AnonymousObjectTransformationInfo
?: throw AssertionError("anonymous object $owner constructs itself, but we have no info on in")
}
// inline fun f() -> new f$1 -> fun something() in class f$1 -> new f$1
// ^-- fetch the info that was created for this instruction
// Currently, this self-reference pattern only happens in coroutine objects, which construct
// copies of themselves in `create` or `invoke` (not `invokeSuspend`).
val existingInfo = inliningContext.parent?.transformationInfo?.takeIf { it.oldClassName == newInfo.oldClassName }
as AnonymousObjectTransformationInfo?
val info = existingInfo ?: newInfo
if (info.shouldRegenerate(isSameModule)) {
for (capturedParamDesc in info.allRecapturedParameters) {
val realDesc = if (objectConstructsItself && capturedParamDesc.fieldName == AsmUtil.THIS) {
val realDesc = if (existingInfo != null && capturedParamDesc.fieldName == AsmUtil.THIS) {
// The captures in `info` are relative to the parent context, so a normal `this` there
// is a captured outer `this` here.
CapturedParamDesc(Type.getObjectType(owner), AsmUtil.CAPTURED_THIS_FIELD, capturedParamDesc.type)
@@ -26,10 +26,6 @@ interface TransformationInfo {
val nameGenerator: NameGenerator
val wasAlreadyRegenerated: Boolean
get() = false
fun shouldRegenerate(sameModule: Boolean): Boolean
fun canRemoveAfterTransformation(): Boolean
@@ -86,9 +82,6 @@ class AnonymousObjectTransformationInfo internal constructor(
lateinit var capturedLambdasToInline: Map<String, LambdaInfo>
override val wasAlreadyRegenerated: Boolean
get() = alreadyRegenerated
constructor(
ownerInternalName: String,
needReification: Boolean,
@@ -97,9 +90,14 @@ class AnonymousObjectTransformationInfo internal constructor(
nameGenerator: NameGenerator
) : this(ownerInternalName, needReification, hashMapOf(), false, alreadyRegenerated, null, isStaticOrigin, nameGenerator)
override fun shouldRegenerate(sameModule: Boolean): Boolean = !alreadyRegenerated &&
(!sameModule || capturedOuterRegenerated || needReification || capturesAnonymousObjectThatMustBeRegenerated ||
functionalArguments.values.any { it != NonInlineableArgumentForInlineableParameterCalledInSuspend })
// TODO: unconditionally regenerating an object if it has previously been regenerated is a hack that works around
// the fact that TypeRemapper cannot differentiate between different references to the same object. See the test
// boxInline/anonymousObject/constructOriginalInRegenerated.kt for an example where a single anonymous object
// is referenced twice with otherwise different `shouldRegenerate` results and the inliner gets confused, trying
// to map the inner reference to the outer regenerated type and producing an infinite recursion.
override fun shouldRegenerate(sameModule: Boolean): Boolean = alreadyRegenerated ||
!sameModule || capturedOuterRegenerated || needReification || capturesAnonymousObjectThatMustBeRegenerated ||
functionalArguments.values.any { it != NonInlineableArgumentForInlineableParameterCalledInSuspend }
override fun canRemoveAfterTransformation(): Boolean {
// Note: It is unsafe to remove anonymous class that is referenced by GETSTATIC within lambda
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.cli.metadata
import org.jetbrains.kotlin.metadata.builtins.BuiltInsBinaryVersion
import org.jetbrains.kotlin.serialization.ApproximatingStringTable
import org.jetbrains.kotlin.serialization.KotlinSerializerExtensionBase
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol
@@ -24,4 +25,5 @@ class MetadataSerializerExtension(
override val metadataVersion: BuiltInsBinaryVersion
) : KotlinSerializerExtensionBase(BuiltInSerializerProtocol) {
override fun shouldUseTypeTable(): Boolean = true
override val stringTable = ApproximatingStringTable()
}
@@ -39,6 +39,16 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypes.kt");
}
@TestMetadata("bareTypes2.kt")
public void testBareTypes2() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypes2.kt");
}
@TestMetadata("bareTypesWithFlexibleArguments.kt")
public void testBareTypesWithFlexibleArguments() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypesWithFlexibleArguments.kt");
}
@TestMetadata("cast.kt")
public void testCast() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/cast.kt");
@@ -2213,6 +2223,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/inference/lambdaInElvis.kt");
}
@TestMetadata("lambdasReturns.kt")
public void testLambdasReturns() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/lambdasReturns.kt");
}
@TestMetadata("nestedExtensionFunctionType.kt")
public void testNestedExtensionFunctionType() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/nestedExtensionFunctionType.kt");
@@ -30,11 +30,11 @@ FILE: integerLiteralTypes.kt
}
))
R|/takeByte|(R|kotlin/run|<R|kotlin/Byte|>(<L> = run@fun <anonymous>(): R|kotlin/Byte| <kind=EXACTLY_ONCE> {
^ Int(1)
^ Byte(1)
}
))
R|/takeLong|(R|kotlin/run|<R|kotlin/Long|>(<L> = run@fun <anonymous>(): R|kotlin/Long| <kind=EXACTLY_ONCE> {
^ Int(1)
^ Long(1)
}
))
}
@@ -0,0 +1,32 @@
FILE: bareTypes2.kt
public abstract interface A<D : R|A<D>|> : R|kotlin/Any| {
public abstract fun foo(): R|kotlin/Any|
public abstract val cond: R|kotlin/Boolean|
public get(): R|kotlin/Boolean|
public abstract val field: R|kotlin/Any|
public get(): R|kotlin/Any|
}
public abstract interface B<F : R|B<F>|> : R|A<F>| {
public abstract override fun foo(): R|kotlin/CharSequence|
}
public abstract interface C : R|B<C>| {
public abstract override fun foo(): R|kotlin/String|
}
public final fun test(x: R|A<*>|): R|kotlin/Unit| {
when ((R|<local>/x| as? R|C|)?.{ $subj$.R|/A.field| }) {
($subj$ is R|kotlin/String|) -> {
when () {
==((R|<local>/x| as? R|B<C>|)?.{ $subj$.R|/A.cond| }, Boolean(true)) -> {
R|<local>/x|.R|/C.foo|()
}
}
}
}
}
@@ -0,0 +1,25 @@
interface A<D : A<D>> {
fun foo(): Any
val cond: Boolean
val field: Any
}
interface B<F : B<F>> : A<F> {
override fun foo(): CharSequence
}
interface C : B<C> {
override fun foo(): String
}
fun test(x: A<*>) {
when ((x as? C)?.field) {
is String -> {
if ((x as? B)?.cond == true) {
x.foo()
}
}
}
}
@@ -0,0 +1,11 @@
FILE: bareTypesWithFlexibleArguments.kt
public final fun <T> R|kotlin/collections/Collection<T>?|.concat(collection: R|kotlin/collections/Collection<T>|): R|kotlin/collections/Collection<T>?| {
when () {
(this@R|/concat| is R|kotlin/collections/LinkedHashSet<T>|) -> {
this@R|/concat|.R|SubstitutionOverride<java/util/LinkedHashSet.addAll: R|kotlin/Boolean|>|(R|<local>/collection|)
^concat this@R|/concat|
}
}
^concat this@R|/concat|
}
@@ -0,0 +1,10 @@
// WITH_STDLIB
// FULL_JDK
fun <T> Collection<T>?.concat(collection: Collection<T>): Collection<T>? {
if (this is LinkedHashSet) {
addAll(collection)
return this
}
return this
}
@@ -44,21 +44,14 @@ digraph lambdaAsReturnOfLambda_kt {
7 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
}
18 [label="Postponed exit from lambda"];
subgraph cluster_6 {
color=blue
19 [label="Enter block"];
20 [label="Exit block"];
}
21 [label="Function call: R|/run|<R|(kotlin/String) -> kotlin/Unit|>(...)"];
22 [label="Exit property" style="filled" fillcolor=red];
19 [label="Function call: R|/run|<R|(kotlin/String) -> kotlin/Unit|>(...)"];
20 [label="Exit property" style="filled" fillcolor=red];
}
16 -> {17};
17 -> {18 0};
17 -> {0} [style=dashed];
18 -> {19};
19 -> {20};
20 -> {21};
21 -> {22};
0 -> {1};
1 -> {2};
2 -> {3 8};
@@ -74,39 +67,39 @@ digraph lambdaAsReturnOfLambda_kt {
11 -> {12};
12 -> {13};
subgraph cluster_7 {
subgraph cluster_6 {
color=red
23 [label="Enter function bar" style="filled" fillcolor=red];
subgraph cluster_8 {
21 [label="Enter function bar" style="filled" fillcolor=red];
subgraph cluster_7 {
color=blue
24 [label="Enter block"];
25 [label="Exit block"];
22 [label="Enter block"];
23 [label="Exit block"];
}
26 [label="Exit function bar" style="filled" fillcolor=red];
24 [label="Exit function bar" style="filled" fillcolor=red];
}
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
subgraph cluster_9 {
subgraph cluster_8 {
color=red
27 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_10 {
25 [label="Enter function run" style="filled" fillcolor=red];
subgraph cluster_9 {
color=blue
28 [label="Enter block"];
29 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()"];
30 [label="Jump: ^run R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()"];
31 [label="Stub" style="filled" fillcolor=gray];
32 [label="Exit block" style="filled" fillcolor=gray];
26 [label="Enter block"];
27 [label="Function call: R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()"];
28 [label="Jump: ^run R|<local>/block|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()"];
29 [label="Stub" style="filled" fillcolor=gray];
30 [label="Exit block" style="filled" fillcolor=gray];
}
33 [label="Exit function run" style="filled" fillcolor=red];
31 [label="Exit function run" style="filled" fillcolor=red];
}
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {33};
28 -> {31};
28 -> {29} [style=dotted];
29 -> {30} [style=dotted];
30 -> {31} [style=dotted];
31 -> {32} [style=dotted];
32 -> {33} [style=dotted];
}
@@ -19,9 +19,9 @@ FILE: constantValues.kt
public final val arrayNestedness: R|kotlin/Int| = R|<local>/arrayNestedness|
public get(): R|kotlin/Int|
public final fun component1(): R|ClassId|
public final operator fun component1(): R|ClassId|
public final fun component2(): R|kotlin/Int|
public final operator fun component2(): R|kotlin/Int|
public final fun copy(classId: R|ClassId| = this@R|/ClassLiteralValue|.R|/ClassLiteralValue.classId|, arrayNestedness: R|kotlin/Int| = this@R|/ClassLiteralValue|.R|/ClassLiteralValue.arrayNestedness|): R|ClassLiteralValue|
@@ -62,7 +62,7 @@ FILE: constantValues.kt
public final val arrayDimensions: R|kotlin/Int|
public get(): R|kotlin/Int|
public final fun component1(): R|ClassLiteralValue|
public final operator fun component1(): R|ClassLiteralValue|
public final fun copy(value: R|ClassLiteralValue| = this@R|/KClassValue.Value.NormalClass|.R|/KClassValue.Value.NormalClass.value|): R|KClassValue.Value.NormalClass|
@@ -76,7 +76,7 @@ FILE: constantValues.kt
public final val type: R|KotlinType| = R|<local>/type|
public get(): R|KotlinType|
public final fun component1(): R|KotlinType|
public final operator fun component1(): R|KotlinType|
public final fun copy(type: R|KotlinType| = this@R|/KClassValue.Value.LocalClass|.R|/KClassValue.Value.LocalClass.type|): R|KClassValue.Value.LocalClass|
+2 -2
View File
@@ -10,9 +10,9 @@ FILE: copy.kt
public final val y: R|kotlin/String| = R|<local>/y|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/Int|
public final operator fun component1(): R|kotlin/Int|
public final fun component2(): R|kotlin/String|
public final operator fun component2(): R|kotlin/String|
public final fun copy(x: R|kotlin/Int| = this@R|/Some|.R|/Some.x|, y: R|kotlin/String| = this@R|/Some|.R|/Some.y|): R|Some|
@@ -1,5 +1,5 @@
annotation class A() {
<!ANNOTATION_CLASS_MEMBER!><!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{PSI}!>constructor(s: Nothing?)<!><!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{LT}!><!> {}<!>
<!ANNOTATION_CLASS_MEMBER!><!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor(s: Nothing?)<!> {}<!>
<!ANNOTATION_CLASS_MEMBER!>init {}<!>
<!ANNOTATION_CLASS_MEMBER!>fun foo() {}<!>
<!ANNOTATION_CLASS_MEMBER!>val bar: Nothing?<!>
@@ -1,6 +1,6 @@
<!CONFLICTING_OVERLOADS!>fun test(x: Int) {}<!>
<!CONFLICTING_OVERLOADS!>fun test(x: Int)<!> {}
<!CONFLICTING_OVERLOADS!>fun test(y: Int) {}<!>
<!CONFLICTING_OVERLOADS!>fun test(y: Int)<!> {}
fun test() {}
@@ -17,9 +17,9 @@ fun test(z: Int, c: Char) {}
}<!>
<!REDECLARATION!>class B : A {
<!CONFLICTING_OVERLOADS!>override fun rest(s: String) {}<!>
<!CONFLICTING_OVERLOADS!>override fun rest(s: String)<!> {}
<!CONFLICTING_OVERLOADS!>fun rest(s: String) {}<!>
<!CONFLICTING_OVERLOADS!>fun rest(s: String)<!> {}
fun rest(l: Long) {}
@@ -45,11 +45,11 @@ fun <T : Int> kek(t: T) {}
fun lol(a: Array<Int>) {}
fun lol(a: Array<Boolean>) {}
<!CONFLICTING_OVERLOADS!>fun <T> mem(t: T) where T : () -> Boolean, T : String {}<!>
<!CONFLICTING_OVERLOADS!>fun <T> mem(t: T) where T : String, T : () -> Boolean {}<!>
<!CONFLICTING_OVERLOADS!>fun <T> mem(t: T)<!> where T : () -> Boolean, T : String {}
<!CONFLICTING_OVERLOADS!>fun <T> mem(t: T)<!> where T : String, T : () -> Boolean {}
class M {
<!REDECLARATION{LT}!>companion <!REDECLARATION{PSI}!>object<!> {}<!>
companion <!REDECLARATION!>object<!> {}
<!REDECLARATION!>val Companion = object : Any {}<!>
}
@@ -63,6 +63,6 @@ fun mest()
class mest
fun() {}
<!FUNCTION_DECLARATION_WITH_NO_NAME!>fun()<!> {}
private fun() {}
<!FUNCTION_DECLARATION_WITH_NO_NAME!>private fun()<!> {}
@@ -1,7 +1,7 @@
<!CONSTRUCTOR_IN_INTERFACE{LT}!>interface <!CONSTRUCTOR_IN_INTERFACE{PSI}!>A(val s: String)<!><!>
interface <!CONSTRUCTOR_IN_INTERFACE!>A(val s: String)<!>
<!CONSTRUCTOR_IN_INTERFACE{LT}!>interface <!CONSTRUCTOR_IN_INTERFACE{PSI}!>B constructor(val s: String)<!><!>
interface <!CONSTRUCTOR_IN_INTERFACE!>B constructor(val s: String)<!>
interface C {
<!CONSTRUCTOR_IN_INTERFACE{LT}!><!CONSTRUCTOR_IN_INTERFACE{PSI}!>constructor(val s: String)<!> {}<!>
<!CONSTRUCTOR_IN_INTERFACE!>constructor(val s: String)<!> {}
}
@@ -2,14 +2,14 @@ class B
class C
class A() {
constructor(a: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>("test")<!> {}
constructor(a: String) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>(10)<!> {}
constructor(a: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>("test") {}
constructor(a: String) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(10) {}
constructor(a: Boolean) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>('\n')<!> {}
constructor(a: Char) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>(0.0)<!> {}
constructor(a: Double) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>(false)<!> {}
constructor(a: Boolean) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>('\n') {}
constructor(a: Char) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(0.0) {}
constructor(a: Double) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(false) {}
constructor(b: B) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>(3.14159265)<!> {}
constructor(b: B) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(3.14159265) {}
constructor(c: C) : this() {}
constructor(a: List<Int>) : this(C()) {}
@@ -17,7 +17,7 @@ class A() {
class D {
constructor(i: Boolean) {}
constructor(i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>(3)<!> {}
constructor(i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(3) {}
}
class E<T> {
@@ -25,7 +25,7 @@ class E<T> {
// selection of the proper constructor
// but a type mismatch for the first
// argument
constructor(e: T, i: Int) : <!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>this<!>(i, 10)<!> {}
constructor(e: T, i: Int) : <!INAPPLICABLE_CANDIDATE!>this<!>(i, 10) {}
}
class I<T> {
@@ -33,7 +33,7 @@ class I<T> {
// selection of the proper constructor
// but a type mismatch for the first
// argument
constructor(e: T, i: Int) : <!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>this<!>(i, 10)<!>
constructor(e: T, i: Int) : <!INAPPLICABLE_CANDIDATE!>this<!>(i, 10)
}
class J<T> {
@@ -42,20 +42,20 @@ class J<T> {
}
class F(s: String) {
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{PSI}!>constructor(i: Boolean)<!><!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{LT}!><!> {}
constructor(i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>(3)<!> {}
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor(i: Boolean)<!> {}
constructor(i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(3) {}
}
class G(x: Int) {
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{PSI}!>constructor()<!><!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{LT}!><!> {}
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor()<!> {}
}
class H(x: Int) {
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{PSI}!>constructor()<!><!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{LT}!><!>
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor()<!>
}
class K(x: Int) {
constructor() : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{LT}!><!CYCLIC_CONSTRUCTOR_DELEGATION_CALL{PSI}!>this<!>()<!> {}
constructor() : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>() {}
}
class M {
@@ -63,5 +63,5 @@ class M {
}
class U : M {
<!INAPPLICABLE_CANDIDATE{PSI}!>constructor()<!><!INAPPLICABLE_CANDIDATE{LT}!><!>
<!INAPPLICABLE_CANDIDATE!>constructor()<!>
}
@@ -1,6 +1,6 @@
enum class A {
A(1), B(2), C("test");
constructor(x: Int) : <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR{LT}!><!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR{PSI}!>super<!>()<!>
constructor(x: Int) : <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>()
constructor(t: String) : this(10)
}
@@ -3,16 +3,16 @@ class A(x: Int) {
}
class B : A {
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE{PSI}!>constructor()<!><!NONE_APPLICABLE{LT}!><!>
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE!>constructor()<!>
constructor(z: String) : this()
}
<!SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR!>class C : A(20) {
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE{PSI}!>constructor()<!><!NONE_APPLICABLE{LT}!><!>
<!EXPLICIT_DELEGATION_CALL_REQUIRED, NONE_APPLICABLE!>constructor()<!>
constructor(z: String) : this()
}<!>
class D() : A(20) {
<!NONE_APPLICABLE{PSI}, PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{PSI}!>constructor(x: Int)<!><!NONE_APPLICABLE{LT}, PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED{LT}!><!>
<!NONE_APPLICABLE, PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor(x: Int)<!>
constructor(z: String) : this()
}
@@ -51,7 +51,7 @@ FILE: incompatibleModifiers.kt
public final val i: R|kotlin/Int| = R|<local>/i|
public get(): R|kotlin/Int|
public final fun component1(): R|kotlin/Int|
public final operator fun component1(): R|kotlin/Int|
public final fun copy(i: R|kotlin/Int| = this@R|/H|.R|/H.i|): R|H|
@@ -64,7 +64,7 @@ FILE: incompatibleModifiers.kt
public final val i: R|kotlin/Int| = R|<local>/i|
public get(): R|kotlin/Int|
public final fun component1(): R|kotlin/Int|
public final operator fun component1(): R|kotlin/Int|
public final fun copy(i: R|kotlin/Int| = this@R|/I|.R|/I.i|): R|I|
@@ -77,7 +77,7 @@ FILE: incompatibleModifiers.kt
public final val i: R|kotlin/Int| = R|<local>/i|
public get(): R|kotlin/Int|
public final fun component1(): R|kotlin/Int|
public final operator fun component1(): R|kotlin/Int|
public final fun copy(i: R|kotlin/Int| = this@R|/J|.R|/J.i|): R|J|
@@ -119,7 +119,7 @@ FILE: incompatibleModifiers.kt
public final val i: R|kotlin/Int| = R|<local>/i|
public get(): R|kotlin/Int|
public final fun component1(): R|kotlin/Int|
public final operator fun component1(): R|kotlin/Int|
public final fun copy(i: R|kotlin/Int| = this@R|/X.Y|.R|/X.Y.i|): R|X.Y|
@@ -7,10 +7,10 @@ class A {
class B(other: B = <!NO_THIS!>this<!>)
class C() {
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>this<!>({
constructor(x: Int) : <!INAPPLICABLE_CANDIDATE!>this<!>({
val a = 10
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>
})<!> {}
}) {}
}
class D {
@@ -6,19 +6,19 @@ object A {
interface X
val a = object : Any() {
<!LOCAL_OBJECT_NOT_ALLOWED{LT}!><!LOCAL_OBJECT_NOT_ALLOWED{PSI}!>object D<!> {
<!LOCAL_OBJECT_NOT_ALLOWED!>object D<!> {
<!LOCAL_OBJECT_NOT_ALLOWED!>object G<!>
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface Z<!>
}<!>
}
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface Y<!>
}
fun b() {
<!LOCAL_OBJECT_NOT_ALLOWED{LT}!><!LOCAL_OBJECT_NOT_ALLOWED{PSI}!>object E<!> {
<!LOCAL_OBJECT_NOT_ALLOWED!>object E<!> {
<!LOCAL_OBJECT_NOT_ALLOWED!>object F<!>
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface M<!>
}<!>
}
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface N<!>
@@ -1,11 +1,11 @@
class A {
<!REDECLARATION{LT}!>companion <!REDECLARATION{PSI}!>object<!> {
companion <!REDECLARATION!>object<!> {
}<!>
}
<!MANY_COMPANION_OBJECTS{LT}, REDECLARATION{LT}!>companion <!MANY_COMPANION_OBJECTS{PSI}, REDECLARATION{PSI}!>object<!> {
companion <!MANY_COMPANION_OBJECTS, REDECLARATION!>object<!> {
}<!>
}
}
class B {
@@ -13,7 +13,7 @@ class B {
}
<!MANY_COMPANION_OBJECTS{LT}!>companion <!MANY_COMPANION_OBJECTS{PSI}!>object B<!> {
companion <!MANY_COMPANION_OBJECTS!>object B<!> {
}<!>
}
}
@@ -28,9 +28,9 @@ sealed class P {
class K : P()
<!REDECLARATION{LT}!><!REDECLARATION{PSI}!>object B<!> {
<!REDECLARATION!>object B<!> {
class I : <!SEALED_SUPERTYPE!>P<!>()
}<!>
}
fun test() {
class L : <!SEALED_SUPERTYPE_IN_LOCAL_CLASS!>P<!>()
@@ -12,7 +12,7 @@ FILE: typeArgumentsNotAllowed.kt
}
public final fun <T> foo(): R|kotlin/Unit| {
R|rest/bar|<<ERROR TYPE REF: Type arguments not allowed>>()
R|rest/bar|<<ERROR TYPE REF: Type arguments not allowed>>()
R|rest/bar|<R|kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>|>()
}
public final fun <T> bar(): R|kotlin/Unit| {
}
@@ -41,9 +41,9 @@ FILE: typeArgumentsNotAllowed.kt
public final fun <G> gest(): R|kotlin/Unit| {
}
public final fun <T> fest(): R|kotlin/Unit| {
lval b: <ERROR TYPE REF: Type arguments not allowed>
lval b: R|kotlin/collections/List<ERROR CLASS: Type arguments not allowed>|
R|rest/gest|<<ERROR TYPE REF: Type arguments not allowed>>()
R|rest/gest|<R|T|>()
lval c: <ERROR TYPE REF: Type arguments not allowed>
R|rest/gest|<<ERROR TYPE REF: Type arguments not allowed>>()
lval c: R|kotlin/collections/List<kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>>|
R|rest/gest|<R|kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>|>()
}
@@ -1,15 +1,15 @@
<!TYPE_PARAMETERS_IN_OBJECT{LT}!><!TYPE_PARAMETERS_IN_OBJECT{PSI}!>object A<!><T, K : T> {
<!TYPE_PARAMETERS_IN_OBJECT{LT}!><!TYPE_PARAMETERS_IN_OBJECT{PSI}!>object B<!><L><!>
}<!>
<!TYPE_PARAMETERS_IN_OBJECT!>object A<!><T, K : T> {
<!TYPE_PARAMETERS_IN_OBJECT!>object B<!><L>
}
class N {
<!TYPE_PARAMETERS_IN_OBJECT{LT}!>companion <!TYPE_PARAMETERS_IN_OBJECT{PSI}!>object<!><T> {
companion <!TYPE_PARAMETERS_IN_OBJECT!>object<!><T> {
}<!>
}
}
fun test() {
<!LOCAL_OBJECT_NOT_ALLOWED{LT}, TYPE_PARAMETERS_IN_OBJECT{LT}!><!LOCAL_OBJECT_NOT_ALLOWED{PSI}, TYPE_PARAMETERS_IN_OBJECT{PSI}!>object M<!><H> {
<!LOCAL_OBJECT_NOT_ALLOWED, TYPE_PARAMETERS_IN_OBJECT!>object M<!><H> {
}<!>
}
}
@@ -23,7 +23,7 @@ FILE: upperBoundViolated.kt
lval b2: R|B<C>| = R|/B.B|<R|C|>()
lval b3: R|B<kotlin/Any?>| = R|/B.B|<R|kotlin/Any?|>()
lval b4: R|B<A>| = R|/B.B|<<ERROR TYPE REF: Symbol not found, for `UnexistingType`>>()
lval b5: R|B<A>| = R|/B.B|<<ERROR TYPE REF: Symbol not found, for `UnexistingType`>>()
lval b5: R|B<B<ERROR CLASS: Symbol not found, for `UnexistingType`>>| = R|/B.B|<R|B<ERROR CLASS: Symbol not found, for `UnexistingType`>|>()
R|/fest|<R|kotlin/Boolean|>()
R|/fest|<R|C|>()
R|/fest|<R|C|>()
@@ -15,7 +15,7 @@ fun test() {
val b2 = B<C>()
val b3 = B<<!UPPER_BOUND_VIOLATED!>Any?<!>>()
val b4 = B<<!UNRESOLVED_REFERENCE!>UnexistingType<!>>()
val b5 = B<<!UNRESOLVED_REFERENCE!>B<UnexistingType><!>>()
val b5 = B<<!UPPER_BOUND_VIOLATED!>B<<!UNRESOLVED_REFERENCE!>UnexistingType<!>><!>>()
fest<<!UPPER_BOUND_VIOLATED!>Boolean<!>>()
fest<C>()
fest<HHH>()
@@ -1,4 +1,4 @@
annotation class A(
<!VAR_ANNOTATION_PARAMETER{LT}!><!VAR_ANNOTATION_PARAMETER{PSI}!>var<!> a: Int<!>,
<!VAR_ANNOTATION_PARAMETER!>var<!> a: Int,
<!MISSING_VAL_ON_ANNOTATION_PARAMETER!>b: String<!>
)
@@ -36,7 +36,7 @@ FILE: access.kt
^plus String()
}
public final fun R|Foo|.check(): R|ERROR CLASS: Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]| {
public final fun R|Foo|.check(): <ERROR TYPE REF: Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]> {
^check this@R|/Bar.check|.R|/Foo.abc|().<Ambiguity: plus, [kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus, kotlin/Int.plus]>#(this@R|/Bar|.R|/Bar.bar|())
}
@@ -1,5 +1,5 @@
// FILE: Descriptor.java
// FULL_JDK
// FILE: Descriptor.java
public interface Descriptor
@@ -1,5 +1,5 @@
// FILE: Element.java
// FULL_JDK
// FILE: Element.java
public interface Element {}
@@ -12,9 +12,9 @@ fun test() {
}
b.foo()
<!LOCAL_OBJECT_NOT_ALLOWED{LT}!><!LOCAL_OBJECT_NOT_ALLOWED{PSI}!>object B<!> {
<!LOCAL_OBJECT_NOT_ALLOWED!>object B<!> {
fun foo() {}
}<!>
}
B.foo()
}
@@ -4,14 +4,14 @@ fun foo(p: Int) {
val a = arrayOf(1, 2, 3)
val b = arrayOf(3, 2, 1)
if (<!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{LT}!>a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{PSI}!>==<!> b<!>) { }
if (a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS!>==<!> b) { }
}
fun testsFromIdea() {
val a = arrayOf("a")
val b = a
val c: Any? = null
<!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{LT}!>a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{PSI}!>==<!> b<!>
a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS!>==<!> b
a == c
<!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{LT}!>a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS{PSI}!>!=<!> b<!>
a <!ARRAY_EQUALITY_OPERATOR_CAN_BE_REPLACED_WITH_EQUALS!>!=<!> b
}
@@ -23,7 +23,7 @@ operator fun C.plusAssign(a: Any) {}
fun testOperatorAssignment() {
val c = C()
c += ""
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> c1 = C()<!>
<!CAN_BE_VAL!>var<!> c1 = C()
<!ASSIGN_OPERATOR_AMBIGUITY!>c1 += ""<!>
var a = 1
@@ -33,7 +33,7 @@ fun testOperatorAssignment() {
fun destructuringDeclaration() {
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> (v1, <!UNUSED_VARIABLE!>v2<!>) = getPair()<!>
<!CAN_BE_VAL!>var<!> (v1, <!UNUSED_VARIABLE!>v2<!>) = getPair()
print(v1)
var (v3, <!VARIABLE_NEVER_READ!>v4<!>) = getPair()
@@ -49,11 +49,11 @@ fun destructuringDeclaration() {
val (<!UNUSED_VARIABLE!>a<!>, <!UNUSED_VARIABLE!>b<!>, <!UNUSED_VARIABLE!>c<!>) = Triple(1, 1, 1)
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> (<!UNUSED_VARIABLE!>x<!>, <!UNUSED_VARIABLE!>y<!>, <!UNUSED_VARIABLE!>z<!>) = Triple(1, 1, 1)<!>
<!CAN_BE_VAL!>var<!> (<!UNUSED_VARIABLE!>x<!>, <!UNUSED_VARIABLE!>y<!>, <!UNUSED_VARIABLE!>z<!>) = Triple(1, 1, 1)
}
fun stackOverflowBug() {
<!CAN_BE_VAL{LT}, VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL{PSI}!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
<!VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 1
for (i in 1..10)
print(i)
@@ -71,8 +71,8 @@ fun smth(flag: Boolean) {
}
fun withAnnotation(p: List<Any>) {
<!CAN_BE_VAL{LT}!>@Suppress("UNCHECKED_CAST")
<!CAN_BE_VAL{PSI}!>var<!> v = p as List<String><!>
@Suppress("UNCHECKED_CAST")
<!CAN_BE_VAL!>var<!> v = p as List<String>
print(v)
}
@@ -88,7 +88,7 @@ fun listReceiver(p: List<String>) {}
fun withInitializer() {
<!VARIABLE_NEVER_READ{LT}!>var <!VARIABLE_NEVER_READ{PSI}!>v1<!> = 1<!>
var v2 = 2
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> v3 = 3<!>
<!CAN_BE_VAL!>var<!> v3 = 3
<!ASSIGNED_VALUE_IS_NEVER_READ!>v1<!> = 1
<!ASSIGNED_VALUE_IS_NEVER_READ!>v2<!>++ // todo mark this UNUSED_CHANGED_VALUES
print(v3)
@@ -102,7 +102,7 @@ fun test() {
}
fun foo() {
<!CAN_BE_VAL{LT}, VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL{PSI}!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
<!VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
val bool = true
if (bool) <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 4 else <!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 42
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>b<!>: String<!>
@@ -130,7 +130,7 @@ fun assignedTwice(p: Int) {
}
fun main(args: Array<String?>) {
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> a: String?<!>
<!CAN_BE_VAL!>var<!> a: String?
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>unused<!> = 0<!>
if (args.size == 1) {
@@ -153,7 +153,7 @@ fun lambda() {
}
fun lambdaInitialization() {
<!CAN_BE_VAL{LT}, VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL{PSI}!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
<!VARIABLE_NEVER_READ{LT}!><!CAN_BE_VAL!>var<!> <!VARIABLE_NEVER_READ{PSI}!>a<!>: Int<!>
run {
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = 20
@@ -161,7 +161,7 @@ fun lambdaInitialization() {
}
fun notAssignedWhenNotUsed(p: Int) {
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> v: Int<!>
<!CAN_BE_VAL!>var<!> v: Int
if (p > 0) {
v = 1
print(v)
@@ -7,7 +7,7 @@ FILE: nullable2.kt
public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final operator fun component1(): R|kotlin/String|
public final fun copy(name: R|kotlin/String| = this@R|/Foo|.R|/Foo.name|): R|Foo|
@@ -7,7 +7,7 @@ FILE: safeString2.kt
public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final operator fun component1(): R|kotlin/String|
public final fun copy(name: R|kotlin/String| = this@R|/Foo|.R|/Foo.name|): R|Foo|
@@ -52,7 +52,7 @@ fun foo() {
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>piFloat<!>: <!REDUNDANT_EXPLICIT_TYPE!>Float<!> = 3.14f<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>piDouble<!>: <!REDUNDANT_EXPLICIT_TYPE!>Double<!> = 3.14<!>
<!UNUSED_VARIABLE{LT}!>val <!UNUSED_VARIABLE{PSI}!>charZ<!>: <!REDUNDANT_EXPLICIT_TYPE!>Char<!> = 'z'<!>
<!CAN_BE_VAL{LT}, UNUSED_VARIABLE{LT}!><!CAN_BE_VAL{PSI}!>var<!> <!UNUSED_VARIABLE{PSI}!>alpha<!>: <!REDUNDANT_EXPLICIT_TYPE!>Int<!> = 0<!>
<!UNUSED_VARIABLE{LT}!><!CAN_BE_VAL!>var<!> <!UNUSED_VARIABLE{PSI}!>alpha<!>: <!REDUNDANT_EXPLICIT_TYPE!>Int<!> = 0<!>
}
fun test(boolean: Boolean) {
@@ -4,23 +4,23 @@ object O {
// Interface
interface Interface {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Questionable cuz compiler reports warning here in FE 1.0
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> val gav: Int
get() = 42<!>
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> fun foo()<!>
<!PRIVATE_FUNCTION_WITH_NO_BODY{LT}!>// error
<!PRIVATE_FUNCTION_WITH_NO_BODY{PSI}!>private<!> final fun bar()<!>
// Questionable cuz compiler reports warning here in FE 1.0
<!REDUNDANT_MODALITY_MODIFIER!>open<!> val gav: Int
get() = 42
// Redundant
<!REDUNDANT_MODALITY_MODIFIER!>abstract<!> fun foo()
// error
<!PRIVATE_FUNCTION_WITH_NO_BODY!>private<!> final fun bar()
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> fun goo() {}<!>
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> fun tar()<!>
<!REDUNDANT_MODALITY_MODIFIER!>open<!> fun goo() {}
<!REDUNDANT_MODALITY_MODIFIER!>abstract<!> fun tar()
<!ABSTRACT_FUNCTION_WITH_BODY{LT}!>// error
<!ABSTRACT_FUNCTION_WITH_BODY{PSI}!>abstract<!> fun too() {}<!>
// error
<!ABSTRACT_FUNCTION_WITH_BODY!>abstract<!> fun too() {}
}
interface B {
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> var bar: Unit<!>
<!REDUNDANT_MODALITY_MODIFIER{LT}!><!REDUNDANT_MODALITY_MODIFIER{PSI}!>abstract<!> fun foo()<!>
<!REDUNDANT_MODALITY_MODIFIER!>abstract<!> var bar: Unit
<!REDUNDANT_MODALITY_MODIFIER!>abstract<!> fun foo()
}
interface Foo
@@ -35,8 +35,8 @@ expect abstract class AbstractClass : Foo {
// Abstract
abstract class Base {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant final
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>final<!> fun foo() {}<!>
// Redundant final
<!REDUNDANT_MODALITY_MODIFIER!>final<!> fun foo() {}
// Abstract
abstract fun bar()
// Open
@@ -44,8 +44,8 @@ abstract class Base {
}
class FinalDerived : Base() {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant final
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>final<!> fun bar() {}<!>
// Redundant final
override <!REDUNDANT_MODALITY_MODIFIER!>final<!> fun bar() {}
// Non-final member in final class
override open val gav = 13
}
@@ -53,33 +53,33 @@ class FinalDerived : Base() {
open class OpenDerived : Base() {
// Final
override final fun bar() {}
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant open
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> val gav = 13<!>
// Redundant open
override <!REDUNDANT_MODALITY_MODIFIER!>open<!> val gav = 13
}
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant final
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>final<!> class Final<!>
// Redundant final
<!REDUNDANT_MODALITY_MODIFIER!>final<!> class Final
// Derived interface
interface Derived : Interface {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> fun foo() {}<!>
// Redundant
override <!REDUNDANT_MODALITY_MODIFIER!>open<!> fun foo() {}
// error
final class Nested
}
// Derived abstract class
abstract class AbstractDerived1(override final val gav: Int) : Interface {
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> fun foo() {}<!>
// Redundant
override <!REDUNDANT_MODALITY_MODIFIER!>open<!> fun foo() {}
}
// Derived abstract class
abstract class AbstractDerived2 : Interface {
// Final
override final fun foo() {}
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant
override <!REDUNDANT_MODALITY_MODIFIER{PSI}!>open<!> val gav = 13<!>
// Redundant
override <!REDUNDANT_MODALITY_MODIFIER!>open<!> val gav = 13
}
// Redundant abstract interface
abstract interface AbstractInterface
<!REDUNDANT_MODALITY_MODIFIER{LT}!>// Redundant final object
<!REDUNDANT_MODALITY_MODIFIER{PSI}!>final<!> object FinalObject<!>
// Redundant final object
<!REDUNDANT_MODALITY_MODIFIER!>final<!> object FinalObject
// Open interface
open interface OpenInterface
@@ -7,7 +7,7 @@ FILE: RedundantReturnUnitTypeChecker.kt
public final val x: R|kotlin/Unit| = R|<local>/x|
public get(): R|kotlin/Unit|
public final fun component1(): R|kotlin/Unit|
public final operator fun component1(): R|kotlin/Unit|
public final fun copy(x: R|kotlin/Unit| = this@R|/My|.R|/My.x|): R|My|
@@ -22,7 +22,7 @@ FILE: RedundantReturnUnitTypeChecker.kt
super<R|kotlin/Any|>()
}
public final fun too(): @R|kotlin/Annotation|() R|kotlin/Unit| {
public final fun too(): @R|kotlin/Annotation|() R|@R|kotlin/Annotation|() kotlin/Unit| {
}
public final fun foo(): R|kotlin/Unit| {
@@ -30,9 +30,9 @@ FILE: RedundantSingleExpressionStringTemplateChecker.kt
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final operator fun component1(): R|kotlin/String|
public final fun component2(): R|ProductGroup?|
public final operator fun component2(): R|ProductGroup?|
public final fun copy(short_name: R|kotlin/String| = this@R|/ProductGroup|.R|/ProductGroup.short_name|, parent: R|ProductGroup?| = this@R|/ProductGroup|.R|/ProductGroup.parent|): R|ProductGroup|
@@ -1,7 +1,7 @@
fun f() {
<!CAN_BE_VAL{LT}, REDUNDANT_VISIBILITY_MODIFIER{LT}, UNUSED_VARIABLE{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> <!CAN_BE_VAL{PSI}!>var<!> <!UNUSED_VARIABLE{PSI}!>baz<!> = 0<!>
<!UNUSED_VARIABLE{LT}!><!REDUNDANT_VISIBILITY_MODIFIER!>public<!> <!CAN_BE_VAL!>var<!> <!UNUSED_VARIABLE{PSI}!>baz<!> = 0<!>
class LocalClass {
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>internal<!> var foo = 0<!>
<!REDUNDANT_VISIBILITY_MODIFIER!>internal<!> var foo = 0
}
LocalClass().foo = 1
}
@@ -26,10 +26,10 @@ class Foo2<
internal inner class B<T,T2,>
}
<!REDECLARATION, REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> class C {
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> val foo: Int = 0<!>
<!REDECLARATION!><!REDUNDANT_VISIBILITY_MODIFIER!>public<!> class C {
<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> val foo: Int = 0
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> fun bar() {}<!>
<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> fun bar() {}
}<!>
@@ -42,19 +42,19 @@ open class D {
}
class E : D() {
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>protected<!> override fun willRemainProtected() {
}<!>
<!REDUNDANT_VISIBILITY_MODIFIER!>protected<!> override fun willRemainProtected() {
}
public override fun willBecomePublic() {
}
}
enum class F <!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>private<!> constructor(val x: Int)<!> {
enum class F <!REDUNDANT_VISIBILITY_MODIFIER!>private<!> constructor(val x: Int) {
FIRST(42)
}
sealed class G constructor(val y: Int) {
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>private<!> constructor(): this(42)<!>
<!REDUNDANT_VISIBILITY_MODIFIER!>private<!> constructor(): this(42)
object H : G()
}
@@ -63,16 +63,16 @@ interface I {
fun bar()
}
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> var baz = 0<!>
<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> var baz = 0
open class J {
protected val baz = 0
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>protected<!> get() = field * 2<!>
<!REDUNDANT_VISIBILITY_MODIFIER!>protected<!> get() = field * 2
var baf = 0
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> get() = 1<!>
<!REDUNDANT_VISIBILITY_MODIFIER{LT}!><!REDUNDANT_VISIBILITY_MODIFIER{PSI}!>public<!> set(value) {
<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> get() = 1
<!REDUNDANT_VISIBILITY_MODIFIER!>public<!> set(value) {
field = value
}<!>
}
var buf = 0
private get() = 42
@@ -1,7 +1,7 @@
fun goo() {
var a = 2
val b = 4
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!>a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> a + 1 + b<!>
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!>a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> (a + 1)<!>
a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> a + 1 + b
a <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> (a + 1)
<!ASSIGNED_VALUE_IS_NEVER_READ!>a<!> = a * b + 1
}
@@ -1,5 +1,5 @@
fun foo() {
var x = 0
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> y = 0<!>
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> x + y + 5<!>
<!CAN_BE_VAL!>var<!> y = 0
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x + y + 5
}
@@ -1,5 +1,5 @@
fun foo() {
var x = 0
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> y = 0<!>
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> y + x + 5<!>
<!CAN_BE_VAL!>var<!> y = 0
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> y + x + 5
}
@@ -1,8 +1,8 @@
fun foo() {
var x = 0
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!>x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> x - 1 - 1<!>
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x - 1 - 1
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!>x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> x / 1<!>
x <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x / 1
x = 1 / x
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> -1 + x<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> -1 + x
}
@@ -1,4 +1,4 @@
fun foo() {
var x = 0
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> 1 + x<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> 1 + x
}
@@ -1,5 +1,5 @@
fun foo() {
var y = 0
val x = 0
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>y<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> y + x<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>y<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> y + x
}
@@ -1,4 +1,4 @@
fun foo() {
var x = 0
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> x + 1<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x + 1
}
@@ -1,4 +1,4 @@
fun foo() {
var x = 0
<!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{LT}!><!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT{PSI}!>=<!> x - 1<!>
<!ASSIGNED_VALUE_IS_NEVER_READ!>x<!> <!CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT!>=<!> x - 1
}
@@ -1,5 +1,5 @@
fun foo() {
<!CAN_BE_VAL{LT}!><!CAN_BE_VAL{PSI}!>var<!> a = 1<!>
<!CAN_BE_VAL!>var<!> a = 1
var b = <!VARIABLE_INITIALIZER_IS_REDUNDANT!>2<!>
var c = 3
@@ -0,0 +1,15 @@
FILE: lambdasReturns.kt
public final fun <R> myRun(b: R|() -> R|): R|R| {
^myRun R|<local>/b|.R|SubstitutionOverride<kotlin/Function0.invoke: R|R|>|()
}
public final fun <T> materialize(): R|T| {
^materialize R|kotlin/TODO|()
}
public final fun foo(x: R|kotlin/String?|): R|kotlin/Unit| {
lval r: R|kotlin/Int| = R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| {
lval y: R|kotlin/String| = R|<local>/x| ?: ^@myRun R|/materialize|<R|kotlin/Int|>()
^ R|<local>/y|.R|kotlin/String.length|
}
)
R|<local>/r|.R|kotlin/Int.minus|(Int(1))
}
@@ -0,0 +1,15 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// !WITH_NEW_INFERENCE
fun <R> myRun(b: () -> R): R = b()
fun <T> materialize(): T = TODO()
fun foo(x: String?) {
val r = myRun {
val y = x ?: return@myRun materialize()
y.length
}
r.minus(1)
}
@@ -1,12 +1,12 @@
interface Some {
<!REDUNDANT_OPEN_IN_INTERFACE{LT}!><!REDUNDANT_OPEN_IN_INTERFACE{PSI}!>open<!> fun foo()<!>
<!REDUNDANT_OPEN_IN_INTERFACE!>open<!> fun foo()
open fun bar() {}
<!REDUNDANT_OPEN_IN_INTERFACE{LT}!><!REDUNDANT_OPEN_IN_INTERFACE{PSI}!>open<!> val x: Int<!>
<!REDUNDANT_OPEN_IN_INTERFACE!>open<!> val x: Int
open val y = <!PROPERTY_INITIALIZER_IN_INTERFACE!>1<!>
open val z get() = 1
<!REDUNDANT_OPEN_IN_INTERFACE{LT}!><!REDUNDANT_OPEN_IN_INTERFACE{PSI}!>open<!> var xx: Int<!>
<!REDUNDANT_OPEN_IN_INTERFACE!>open<!> var xx: Int
open var yy = <!PROPERTY_INITIALIZER_IN_INTERFACE!>1<!>
open var zz: Int
set(value) {
@@ -42,11 +42,11 @@ FILE: problems2.kt
public final val s: R|kotlin/String?| = R|<local>/s|
public get(): R|kotlin/String?|
public final fun component1(): R|kotlin/Int|
public final operator fun component1(): R|kotlin/Int|
public final fun component2(): R|kotlin/Array<kotlin/String>?|
public final operator fun component2(): R|kotlin/Array<kotlin/String>?|
public final fun component3(): R|kotlin/String?|
public final operator fun component3(): R|kotlin/String?|
public final fun copy(x: R|kotlin/Int| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.x|, arr: R|kotlin/Array<kotlin/String>?| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.arr|, s: R|kotlin/String?| = this@R|/Some.WithPrimary|.R|/Some.WithPrimary.s|): R|Some.WithPrimary|
@@ -1,10 +1,10 @@
FILE: main.kt
public final fun main(): R|kotlin/Unit| {
R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/String| {
R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
}
)
R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
R|/MyFunction|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Any.toString|()
}
)
@@ -6,23 +6,23 @@ FILE: main.kt
public final fun <X, Y> foo3(f: R|MyFunction<X, Y>|, x: R|X|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
R|/foo1|(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/String| {
R|/foo1|(R|/MyFunction|<R|kotlin/Int|, R|kotlin/String|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Int.toInt|().R|kotlin/Any.toString|()
}
))
R|/foo2|(R|/MyFunction|<R|kotlin/Number|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Number, kotlin/Number?>!|): R|kotlin/String| {
R|/foo2|(R|/MyFunction|<R|kotlin/Number|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Number, kotlin/Number?>!|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
}
))
<Inapplicable(INAPPLICABLE): /foo2>#(R|/MyFunction|<R|kotlin/Number|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|kotlin/String| {
<Inapplicable(INAPPLICABLE): /foo2>#(R|/MyFunction|<R|kotlin/Number|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Int|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Any.toString|()
}
))
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/String| {
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Any.toString|()
}
), Int(1))
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
R|/foo3|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(R|/MyFunction|<R|kotlin/Int|, R|ft<kotlin/String, kotlin/String?>!|>(<L> = MyFunction@fun <anonymous>(x: R|kotlin/Number|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
}
), Int(2))
@@ -12,11 +12,11 @@ FILE: main.kt
^ R|<local>/x|.R|kotlin/Any.toString|()
}
)
Q|JavaUsage|.R|/JavaUsage.foo3|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(foo3@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|): R|kotlin/String| {
Q|JavaUsage|.R|/JavaUsage.foo3|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(foo3@fun <anonymous>(x: R|ft<kotlin/Int, kotlin/Int?>!|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Int.plus|(Int(1)).R|kotlin/Any.toString|()
}
, Int(1))
Q|JavaUsage|.R|/JavaUsage.foo3|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(foo3@fun <anonymous>(x: R|kotlin/Number|): R|kotlin/String| {
Q|JavaUsage|.R|/JavaUsage.foo3|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/String, kotlin/String?>!|>(foo3@fun <anonymous>(x: R|kotlin/Number|): R|ft<kotlin/String, kotlin/String?>!| {
^ R|<local>/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|()
}
, Int(2))
@@ -38,12 +38,12 @@ FILE: kotlinSam.kt
}
)
R|/foo1|(R|<local>/f|)
<Inapplicable(INAPPLICABLE): /foo2>#(<L> = foo2@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
<Inapplicable(INAPPLICABLE): /foo2>#(<L> = foo2@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Nothing| {
^ CMP(>, R|<local>/x|.<Unresolved name: compareTo>#(Int(1)))
}
)
<Inapplicable(INAPPLICABLE): /foo2>#(R|<local>/f|)
<Inapplicable(INAPPLICABLE): /foo3>#(<L> = foo3@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
<Inapplicable(INAPPLICABLE): /foo3>#(<L> = foo3@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Nothing| {
^ CMP(>, R|<local>/x|.<Unresolved name: compareTo>#(Int(1)))
}
)
@@ -2,7 +2,7 @@ FILE: main.kt
public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
Q|JavaUsage|.<Inapplicable(INAPPLICABLE): /JavaUsage.foo>#(<L> = foo@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
Q|JavaUsage|.<Inapplicable(INAPPLICABLE): /JavaUsage.foo>#(<L> = foo@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Nothing| {
^ CMP(>, R|<local>/x|.<Unresolved name: compareTo>#(Int(1)))
}
)
@@ -13,7 +13,7 @@ FILE: lambdaInWhenBranch.kt
public final val t: R|kotlin/String| = R|<local>/t|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/String|
public final operator fun component1(): R|kotlin/String|
public final fun copy(t: R|kotlin/String| = this@R|/SubClass1|.R|/SubClass1.t|): R|SubClass1|
@@ -1,4 +1,4 @@
<!CONFLICTING_OVERLOADS!>fun takeString(s: String) {}<!>
<!CONFLICTING_OVERLOADS!>fun takeString(s: String)<!> {}
class Wrapper(val s: String?) {
fun withThis() {
@@ -11,4 +11,4 @@ class Wrapper(val s: String?) {
}
}
<!CONFLICTING_OVERLOADS!>fun takeString(s: String) {}<!>
<!CONFLICTING_OVERLOADS!>fun takeString(s: String)<!> {}
@@ -23,11 +23,11 @@ fun test_2(a: A?) {
}
}
<!CONFLICTING_OVERLOADS!>fun test_3(x: Any?) {
<!CONFLICTING_OVERLOADS!>fun test_3(x: Any?)<!> {
val a = x as? A ?: return
a.foo() // Should be OK
x.foo() // Should be OK
}<!>
}
// ----------------- Unstable -----------------
@@ -53,8 +53,8 @@ fun test_2(a: B?) {
}
}
<!CONFLICTING_OVERLOADS!>fun test_3(x: Any?) {
<!CONFLICTING_OVERLOADS!>fun test_3(x: Any?)<!> {
val a = x as? B ?: return
a.foo() // Should be OK
x.foo() // Should be OK
}<!>
}
@@ -10,10 +10,10 @@ interface C {
fun baz()
}
<!CONSTRUCTOR_IN_INTERFACE{LT}!>interface <!CONSTRUCTOR_IN_INTERFACE{PSI}!>Inv<K, T>()<!> {
interface <!CONSTRUCTOR_IN_INTERFACE!>Inv<K, T>()<!> {
fun k(): K
fun t(): T
}<!>
}
typealias Inv0 = Inv<A, B>
typealias Inv1<X> = Inv<A, X>
@@ -18,11 +18,11 @@ FILE: typeParameterVsNested.kt
public abstract fun foo(arg: R|test/My.T<T>|): R|kotlin/Unit|
public abstract val y: <ERROR TYPE REF: Type argument not defined>
public get(): <ERROR TYPE REF: Type argument not defined>
public abstract val y: <ERROR TYPE REF: Wrong number of type arguments>
public get(): <ERROR TYPE REF: Wrong number of type arguments>
public abstract val z: <ERROR TYPE REF: Type argument not defined>
public get(): <ERROR TYPE REF: Type argument not defined>
public abstract val z: <ERROR TYPE REF: Wrong number of type arguments>
public get(): <ERROR TYPE REF: Wrong number of type arguments>
public final class Some : <ERROR TYPE REF: Type parameter cannot be a super-type: T> {
public constructor(): R|test/My.Some| {
@@ -9,9 +9,9 @@ abstract class My<T : Some> {
abstract fun foo(arg: T)
abstract val y: My.T
abstract val y: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>My.T<!>
abstract val z: test.My.T
abstract val z: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>test.My.T<!>
class Some : <!UNRESOLVED_REFERENCE{LT}!><!OTHER_ERROR, UNRESOLVED_REFERENCE{PSI}!>T<!>()<!>
}
@@ -27,5 +27,5 @@ FILE: capturedParametersOfInnerClasses.kt
}
public final fun <R1, R2, R3> foo(c: R|A.B.C<R3, R3, R2, R2, R1, R1>|): R|kotlin/Unit| {
}
public final fun <R3> foo(c: <ERROR TYPE REF: Type argument not defined>): R|kotlin/Unit| {
public final fun <R3> foo(c: <ERROR TYPE REF: Wrong number of type arguments>): R|kotlin/Unit| {
}
@@ -10,4 +10,4 @@ class A<T1, T2> {
fun <R1, R2, R3> foo(c: A<R1, R1>.B<R2, R2>.C<R3, R3>) {}
fun <R3> foo(c: A.B.C<R3, R3>) {}
fun <R3> foo(c: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A.B.C<R3, R3><!>) {}
+4 -4
View File
@@ -13,7 +13,7 @@ class B()
class C(val b : B)
fun get(f: Boolean) = if (f) {A.A1} else {""}
<!CONFLICTING_OVERLOADS!>fun case2() {
<!CONFLICTING_OVERLOADS!>fun case2()<!> {
val flag: Any = get(false) //string
val l1 = when (flag!!) { // should be NO_ELSE_IN_WHEN
@@ -25,9 +25,9 @@ fun get(f: Boolean) = if (f) {A.A1} else {""}
A.A1 -> B()
A.A2 -> B()
}
}<!>
}
<!CONFLICTING_OVERLOADS!>fun case2() {
<!CONFLICTING_OVERLOADS!>fun case2()<!> {
val flag: Any = get(true) //A
val l1 = when (flag!!) {// should be NO_ELSE_IN_WHEN
@@ -39,7 +39,7 @@ fun get(f: Boolean) = if (f) {A.A1} else {""}
A.A1 -> B()
A.A2 -> B()
}
}<!>
}
fun case3() {
@@ -1,5 +1,5 @@
<!CONFLICTING_OVERLOADS!>fun bar(x: String): Int = 1<!>
<!CONFLICTING_OVERLOADS!>fun bar(x: String): Double = 1<!>
<!CONFLICTING_OVERLOADS{LT}!><!CONFLICTING_OVERLOADS!>fun bar(x: String): Int<!> = 1<!>
<!CONFLICTING_OVERLOADS{LT}!><!CONFLICTING_OVERLOADS!>fun bar(x: String): Double<!> = 1<!>
fun baz(x: String): Int = 1
fun <T, R> foobaz(x: T): R = TODO()
@@ -11,6 +11,6 @@ FILE: implicitTypes.kt
public final fun loop1(): R|(kotlin/Any?) -> kotlin/Nothing| {
^loop1 <Inapplicable(INAPPLICABLE): /use>#<R|kotlin/Any?|, R|kotlin/Nothing|>(::<Unresolved reference: loop2>#)
}
public final fun loop2(): R|ERROR CLASS: cycle| {
public final fun loop2(): <ERROR TYPE REF: cycle> {
^loop2 R|/loop1|()
}
@@ -10,9 +10,9 @@ FILE: components.kt
public final val y: R|kotlin/String| = R|<local>/y|
public get(): R|kotlin/String|
public final fun component1(): R|kotlin/Int|
public final operator fun component1(): R|kotlin/Int|
public final fun component2(): R|kotlin/String|
public final operator fun component2(): R|kotlin/String|
public final fun copy(x: R|kotlin/Int| = this@R|/D|.R|/D.x|, y: R|kotlin/String| = this@R|/D|.R|/D.y|): R|D|
@@ -19,7 +19,7 @@ FILE: delegateTypeMismatch.kt
public get(): R|kotlin/Boolean|
private final fun <T> property(initialValue: R|T|): R|kotlin/properties/ReadWriteProperty<A, T>| {
^property Q|kotlin/properties/Delegates|.R|kotlin/properties/Delegates.vetoable|<R|T|>(R|<local>/initialValue|, <L> = vetoable@fun <anonymous>(_: R|kotlin/reflect/KProperty<*>|, _: R|T|, _: R|T|): R|kotlin/Boolean| <kind=UNKNOWN> {
^property Q|kotlin/properties/Delegates|.R|kotlin/properties/Delegates.vetoable|<R|T|>(R|<local>/initialValue|, <L> = vetoable@fun <anonymous>(_: R|@R|kotlin/ParameterName|(name = String(property)) kotlin/reflect/KProperty<*>|, _: R|T|, _: R|T|): R|kotlin/Boolean| <kind=UNKNOWN> {
^ when () {
this@R|/A|.R|/A.isLocked| -> {
throw R|java/lang/IllegalStateException.IllegalStateException|(String(Cannot modify readonly DescriptorRendererOptions))
@@ -1,6 +1,6 @@
FILE: test.kt
public final fun test(map: R|MyMap|): R|kotlin/Unit| {
lval result: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = R|<local>/map|.R|kotlin/collections/getOrPut|<R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|>(String(key), <L> = getOrPut@fun <anonymous>(): R|kotlin/String| <kind=UNKNOWN> {
lval result: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| = R|<local>/map|.R|kotlin/collections/getOrPut|<R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|>(String(key), <L> = getOrPut@fun <anonymous>(): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!| <kind=UNKNOWN> {
^ String(value)
}
)
@@ -1,5 +1,5 @@
// FILE: StaticOwner.java
// FULL_JDK
// FILE: StaticOwner.java
import org.jetbrains.annotations.NotNull;
@@ -21,4 +21,4 @@ abstract class User<T : Freezable> {
fun foo() {
settings = StaticOwner.newInstance(settings.javaClass)
}
}
}
@@ -1,8 +1,8 @@
<!CONFLICTING_OVERLOADS!>@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
<!CONFLICTING_OVERLOADS{LT}!><!CONFLICTING_OVERLOADS!>@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
<!HIDDEN!>@kotlin.internal.LowPriorityInOverloadResolution<!>
fun foo(): Int = 1<!>
fun foo(): Int<!> = 1<!>
<!CONFLICTING_OVERLOADS!>fun foo(): String = ""<!>
<!CONFLICTING_OVERLOADS{LT}!><!CONFLICTING_OVERLOADS!>fun foo(): String<!> = ""<!>
fun test() {
val s = foo()
@@ -0,0 +1,85 @@
FILE: selfReferenceToCompanionObject.kt
public abstract class Base : R|kotlin/Any| {
public constructor(fn: R|() -> kotlin/String|): R|Base| {
super<R|kotlin/Any|>()
}
public final val fn: R|() -> kotlin/String| = R|<local>/fn|
public get(): R|() -> kotlin/String|
}
public final class Host : R|kotlin/Any| {
public constructor(): R|Host| {
super<R|kotlin/Any|>()
}
public final companion object Companion : R|Base| {
private constructor(): R|Host.Companion| {
super<R|Base|>(R|kotlin/run|<R|() -> kotlin/String|>(<L> = run@fun <anonymous>(): R|() -> kotlin/String| <kind=EXACTLY_ONCE> {
^ run@fun <anonymous>(): R|kotlin/String| {
^ Q|Host|.R|/Host.Companion.ok|()
}
}
))
}
public final fun ok(): R|kotlin/String| {
^ok String(OK)
}
}
}
public final enum class Test : R|kotlin/Enum<Test>| {
private constructor(x: R|kotlin/String|, closure1: R|() -> kotlin/String|): R|Test| {
super<R|kotlin/Enum<Test>|>()
}
public final val x: R|kotlin/String| = R|<local>/x|
public get(): R|kotlin/String|
public final val closure1: R|() -> kotlin/String| = R|<local>/closure1|
public get(): R|() -> kotlin/String|
public final static enum entry FOO: R|Test| = object : R|Test| {
private constructor(): R|<anonymous>| {
super<R|Test|>(String(O), this@R|kotlin/Enum.Companion|.R|kotlin/run|<R|kotlin/Enum.Companion|, R|() -> kotlin/String|>(<L> = run@fun R|kotlin/Enum.Companion|.<anonymous>(): R|() -> kotlin/String| <kind=EXACTLY_ONCE> {
^ run@fun <anonymous>(): R|kotlin/String| {
^ R|/Test.FOO|.R|/Test.x|
}
}
))
}
public final override val y: R|kotlin/String| = String(K)
public get(): R|kotlin/String|
public final val closure2: R|() -> kotlin/String| = fun <anonymous>(): R|kotlin/String| {
^ this@R|/<anonymous>|.R|/<anonymous>.y|
}
public get(): R|() -> kotlin/String|
public final override val z: R|kotlin/String| = this@R|/<anonymous>|.R|/<anonymous>.closure2|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/String|>|()
public get(): R|kotlin/String|
}
public abstract val y: R|kotlin/String|
public get(): R|kotlin/String|
public abstract val z: R|kotlin/String|
public get(): R|kotlin/String|
public final static fun values(): R|kotlin/Array<Test>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|Test| {
}
}
public final fun box(): R|kotlin/String| {
^box Q|Host.Companion|.R|/Base.fn|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/String|>|()
}
@@ -0,0 +1,20 @@
abstract class Base(val fn: () -> String)
class Host {
companion object : Base(run { { Host.ok() } }) {
fun ok() = "OK"
}
}
enum class Test(val x: String, val closure1: () -> String) {
FOO("O", run { { FOO.x } }) {
override val y: String = "K"
val closure2 = { y } // Implicit 'FOO'
override val z: String = closure2()
};
abstract val y: String
abstract val z: String
}
fun box() = Host.Companion.fn()
@@ -38,6 +38,18 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypes.kt");
}
@Test
@TestMetadata("bareTypes2.kt")
public void testBareTypes2() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypes2.kt");
}
@Test
@TestMetadata("bareTypesWithFlexibleArguments.kt")
public void testBareTypesWithFlexibleArguments() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypesWithFlexibleArguments.kt");
}
@Test
@TestMetadata("cast.kt")
public void testCast() throws Exception {
@@ -2535,6 +2547,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/lambdaInElvis.kt");
}
@Test
@TestMetadata("lambdasReturns.kt")
public void testLambdasReturns() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/lambdasReturns.kt");
}
@Test
@TestMetadata("nestedExtensionFunctionType.kt")
public void testNestedExtensionFunctionType() throws Exception {
@@ -4889,6 +4907,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/receiverResolutionInLambda.kt");
}
@Test
@TestMetadata("selfReferenceToCompanionObject.kt")
public void testSelfReferenceToCompanionObject() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/selfReferenceToCompanionObject.kt");
}
@Test
@TestMetadata("SpecialCallsWithLambdas.kt")
public void testSpecialCallsWithLambdas() throws Exception {
@@ -39,6 +39,18 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypes.kt");
}
@Test
@TestMetadata("bareTypes2.kt")
public void testBareTypes2() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypes2.kt");
}
@Test
@TestMetadata("bareTypesWithFlexibleArguments.kt")
public void testBareTypesWithFlexibleArguments() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/bareTypesWithFlexibleArguments.kt");
}
@Test
@TestMetadata("cast.kt")
public void testCast() throws Exception {
@@ -2556,6 +2568,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/inference/lambdaInElvis.kt");
}
@Test
@TestMetadata("lambdasReturns.kt")
public void testLambdasReturns() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/inference/lambdasReturns.kt");
}
@Test
@TestMetadata("nestedExtensionFunctionType.kt")
public void testNestedExtensionFunctionType() throws Exception {
@@ -10054,6 +10054,28 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/functionLiterals/return/unresolvedReferenceInReturnBlock.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/functionLiterals/suspend")
@TestDataPath("$PROJECT_ROOT")
public class Suspend extends AbstractFirDiagnosticTest {
@Test
public void testAllFilesPresentInSuspend() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/functionLiterals/suspend"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("disabled.kt")
public void testDisabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/functionLiterals/suspend/disabled.kt");
}
@Test
@TestMetadata("enabled.kt")
public void testEnabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/functionLiterals/suspend/enabled.kt");
}
}
}
@Nested
@@ -22940,6 +22962,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt");
}
@Test
@TestMetadata("reportFunctionExpectedOnSimpleUnresolved.kt")
public void testReportFunctionExpectedOnSimpleUnresolved() throws Exception {
runTest("compiler/testData/diagnostics/tests/resolve/invoke/reportFunctionExpectedOnSimpleUnresolved.kt");
}
@Test
@TestMetadata("reportFunctionExpectedWhenOneInvokeExist.kt")
public void testReportFunctionExpectedWhenOneInvokeExist() throws Exception {
@@ -8562,6 +8562,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/fromJava.kt");
}
@Test
@TestMetadata("lambdaParameterUsed.kt")
public void testLambdaParameterUsed() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/lambdaParameterUsed.kt");
}
@Test
@TestMetadata("longArgs.kt")
public void testLongArgs() throws Exception {
@@ -13178,6 +13184,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionFunctions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("classMethodCallExtensionSuper.kt")
public void testClassMethodCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/classMethodCallExtensionSuper.kt");
}
@Test
@TestMetadata("defaultMethodInterfaceCallExtensionSuper.kt")
public void testDefaultMethodInterfaceCallExtensionSuper() throws Exception {
runTest("compiler/testData/codegen/box/extensionFunctions/defaultMethodInterfaceCallExtensionSuper.kt");
}
@Test
@TestMetadata("executionOrder.kt")
public void testExecutionOrder() throws Exception {
@@ -13679,6 +13697,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/fir")
@TestDataPath("$PROJECT_ROOT")
public class Fir extends AbstractFirBlackBoxCodegenTest {
@Test
public void testAllFilesPresentInFir() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("ExtensionAlias.kt")
public void testExtensionAlias() throws Exception {
runTest("compiler/testData/codegen/box/fir/ExtensionAlias.kt");
}
@Test
@TestMetadata("SuspendExtension.kt")
public void testSuspendExtension() throws Exception {
runTest("compiler/testData/codegen/box/fir/SuspendExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/fullJdk")
@TestDataPath("$PROJECT_ROOT")
@@ -16214,6 +16254,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/kt38680b.kt");
}
@Test
@TestMetadata("kt44141.kt")
public void testKt44141() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
}
@Test
@TestMetadata("mangledDefaultParameterFunction.kt")
public void testMangledDefaultParameterFunction() throws Exception {
@@ -16328,6 +16374,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
}
@Test
@TestMetadata("result.kt")
public void testResult() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/result.kt");
}
@Test
@TestMetadata("resultInlining.kt")
public void testResultInlining() throws Exception {
@@ -17660,6 +17712,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/result.kt");
}
@Test
@TestMetadata("resultAny.kt")
public void testResultAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/funInterface/resultAny.kt");
}
@Test
@TestMetadata("string.kt")
public void testString() throws Exception {
@@ -17712,6 +17770,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/result.kt");
}
@Test
@TestMetadata("resultAny.kt")
public void testResultAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/lambda/resultAny.kt");
}
@Test
@TestMetadata("string.kt")
public void testString() throws Exception {
@@ -17764,6 +17828,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/result.kt");
}
@Test
@TestMetadata("resultAny.kt")
public void testResultAny() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/unboxGenericParameter/objectLiteral/resultAny.kt");
}
@Test
@TestMetadata("string.kt")
public void testString() throws Exception {
@@ -37112,6 +37182,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/when/implicitExhaustiveAndReturn.kt");
}
@Test
@TestMetadata("inferredTypeParameters.kt")
public void testInferredTypeParameters() throws Exception {
runTest("compiler/testData/codegen/box/when/inferredTypeParameters.kt");
}
@Test
@TestMetadata("integralWhenWithNoInlinedConstants.kt")
public void testIntegralWhenWithNoInlinedConstants() throws Exception {
+1
View File
@@ -47,6 +47,7 @@ val generateCheckersComponents by tasks.registering(NoDebugJavaExec::class) {
outputs.dirs(generationRoot)
args(generationRoot)
workingDir = rootDir
classpath = generatorClasspath
main = "org.jetbrains.kotlin.fir.checkers.generator.MainKt"
systemProperties["line.separator"] = "\n"
@@ -27,6 +27,7 @@ fun main(args: Array<String>) {
generateCheckersComponents(generationPath, declarationPackage, "FirDeclarationChecker") {
alias<FirDeclaration>("BasicDeclarationChecker")
alias<FirMemberDeclaration>("MemberDeclarationChecker")
alias<FirFunction<*>>("FunctionChecker")
alias<FirProperty>("PropertyChecker")
alias<FirRegularClass>("RegularClassChecker")
alias<FirConstructor>("ConstructorChecker")
@@ -19,6 +19,8 @@ internal class ComposedDeclarationCheckers : DeclarationCheckers() {
get() = _basicDeclarationCheckers
override val memberDeclarationCheckers: Set<FirMemberDeclarationChecker>
get() = _memberDeclarationCheckers
override val functionCheckers: Set<FirFunctionChecker>
get() = _functionCheckers
override val propertyCheckers: Set<FirPropertyChecker>
get() = _propertyCheckers
override val regularClassCheckers: Set<FirRegularClassChecker>
@@ -34,6 +36,7 @@ internal class ComposedDeclarationCheckers : DeclarationCheckers() {
private val _basicDeclarationCheckers: MutableSet<FirBasicDeclarationChecker> = mutableSetOf()
private val _memberDeclarationCheckers: MutableSet<FirMemberDeclarationChecker> = mutableSetOf()
private val _functionCheckers: MutableSet<FirFunctionChecker> = mutableSetOf()
private val _propertyCheckers: MutableSet<FirPropertyChecker> = mutableSetOf()
private val _regularClassCheckers: MutableSet<FirRegularClassChecker> = mutableSetOf()
private val _constructorCheckers: MutableSet<FirConstructorChecker> = mutableSetOf()
@@ -45,6 +48,7 @@ internal class ComposedDeclarationCheckers : DeclarationCheckers() {
internal fun register(checkers: DeclarationCheckers) {
_basicDeclarationCheckers += checkers.allBasicDeclarationCheckers
_memberDeclarationCheckers += checkers.allMemberDeclarationCheckers
_functionCheckers += checkers.allFunctionCheckers
_propertyCheckers += checkers.allPropertyCheckers
_regularClassCheckers += checkers.allRegularClassCheckers
_constructorCheckers += checkers.allConstructorCheckers
@@ -21,6 +21,7 @@ abstract class DeclarationCheckers {
open val basicDeclarationCheckers: Set<FirBasicDeclarationChecker> = emptySet()
open val memberDeclarationCheckers: Set<FirMemberDeclarationChecker> = emptySet()
open val functionCheckers: Set<FirFunctionChecker> = emptySet()
open val propertyCheckers: Set<FirPropertyChecker> = emptySet()
open val regularClassCheckers: Set<FirRegularClassChecker> = emptySet()
open val constructorCheckers: Set<FirConstructorChecker> = emptySet()
@@ -31,8 +32,9 @@ abstract class DeclarationCheckers {
@CheckersComponentInternal internal val allBasicDeclarationCheckers: Set<FirBasicDeclarationChecker> get() = basicDeclarationCheckers
@CheckersComponentInternal internal val allMemberDeclarationCheckers: Set<FirMemberDeclarationChecker> get() = memberDeclarationCheckers + allBasicDeclarationCheckers
@CheckersComponentInternal internal val allFunctionCheckers: Set<FirFunctionChecker> get() = functionCheckers + allBasicDeclarationCheckers
@CheckersComponentInternal internal val allPropertyCheckers: Set<FirPropertyChecker> get() = propertyCheckers + allMemberDeclarationCheckers
@CheckersComponentInternal internal val allRegularClassCheckers: Set<FirRegularClassChecker> get() = regularClassCheckers + allMemberDeclarationCheckers
@CheckersComponentInternal internal val allConstructorCheckers: Set<FirConstructorChecker> get() = constructorCheckers + allMemberDeclarationCheckers
@CheckersComponentInternal internal val allConstructorCheckers: Set<FirConstructorChecker> get() = constructorCheckers + allFunctionCheckers
@CheckersComponentInternal internal val allFileCheckers: Set<FirFileChecker> get() = fileCheckers + allBasicDeclarationCheckers
}
@@ -13,12 +13,14 @@ package org.jetbrains.kotlin.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.fir.declarations.FirConstructor
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
import org.jetbrains.kotlin.fir.declarations.FirFile
import org.jetbrains.kotlin.fir.declarations.FirFunction
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
import org.jetbrains.kotlin.fir.declarations.FirProperty
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
typealias FirBasicDeclarationChecker = FirDeclarationChecker<FirDeclaration>
typealias FirMemberDeclarationChecker = FirDeclarationChecker<FirMemberDeclaration>
typealias FirFunctionChecker = FirDeclarationChecker<FirFunction<*>>
typealias FirPropertyChecker = FirDeclarationChecker<FirProperty>
typealias FirRegularClassChecker = FirDeclarationChecker<FirRegularClass>
typealias FirConstructorChecker = FirDeclarationChecker<FirConstructor>
@@ -23,9 +23,8 @@ import org.jetbrains.kotlin.KtNodeTypes.VALUE_PARAMETER
import org.jetbrains.kotlin.fir.analysis.diagnostics.*
import org.jetbrains.kotlin.name.ClassId
object FirAnnotationClassDeclarationChecker : FirBasicDeclarationChecker() {
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
if (declaration !is FirRegularClass) return
object FirAnnotationClassDeclarationChecker : FirRegularClassChecker() {
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
if (declaration.classKind != ANNOTATION_CLASS) return
if (declaration.isLocal) reporter.report(declaration.source, FirErrors.LOCAL_ANNOTATION_CLASS_ERROR)
@@ -5,18 +5,17 @@
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.analysis.diagnostics.hasPrimaryConstructor
import org.jetbrains.kotlin.fir.declarations.FirClass
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.isInterface
object FirConstructorInInterfaceChecker : FirBasicDeclarationChecker() {
override fun check(declaration: FirDeclaration, context: CheckerContext, reporter: DiagnosticReporter) {
if (declaration !is FirClass<*> || declaration.classKind != ClassKind.INTERFACE) {
object FirConstructorInInterfaceChecker : FirRegularClassChecker() {
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
if (!declaration.isInterface) {
return
}
@@ -6,16 +6,16 @@
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.isInterface
object FirDelegationInInterfaceChecker : FirRegularClassChecker() {
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
if (declaration.classKind != ClassKind.INTERFACE) {
if (!declaration.isInterface) {
return
}
@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.fir.FirFakeSourceElementKind
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
@@ -13,10 +12,11 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.FirConstructor
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.isEnumClass
object FirDelegationSuperCallInEnumConstructorChecker : FirRegularClassChecker() {
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
if (declaration.classKind != ClassKind.ENUM_CLASS) {
if (!declaration.isEnumClass) {
return
}
@@ -0,0 +1,122 @@
/*
* Copyright 2010-2021 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.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.extended.report
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.FirProperty
import org.jetbrains.kotlin.fir.declarations.FirValueParameter
import org.jetbrains.kotlin.fir.declarations.FirVariable
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.references.FirErrorNamedReference
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError
import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedNameError
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
object FirDestructuringDeclarationChecker : FirPropertyChecker() {
override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) {
val source = declaration.source ?: return
// val (...) = `destructuring_declaration`
if (source.elementType == KtNodeTypes.DESTRUCTURING_DECLARATION) {
assert(declaration.name.isSpecial && declaration.name.asString() == "<destruct>") {
"Unexpected name: ${declaration.name.asString()} for destructuring declaration"
}
checkInitializer(source, declaration.initializer, reporter)
return
}
// val (`destructuring_declaration_entry`, ...) = ...
if (source.elementType != KtNodeTypes.DESTRUCTURING_DECLARATION_ENTRY) return
val componentCall = declaration.initializer as? FirComponentCall ?: return
val reference = componentCall.calleeReference as? FirErrorNamedReference ?: return
val originalExpression = componentCall.explicitReceiverOfQualifiedAccess ?: return
val originalDestructuringDeclaration = originalExpression.resolvedVariable ?: return
val originalDestructuringDeclarationOrInitializer =
when (originalDestructuringDeclaration) {
is FirProperty -> {
if (originalDestructuringDeclaration.initializer?.source?.elementType == KtNodeTypes.FOR) {
// for ((entry, ...) = `destructuring_declaration`) { ... }
// It will be wrapped as `next()` call whose explicit receiver is `iterator()` on the actual source.
val iterator = originalDestructuringDeclaration.initializer?.explicitReceiverOfQualifiedAccess
(iterator?.resolvedVariable as? FirProperty)?.initializer?.explicitReceiverOfQualifiedAccess
} else {
// val (entry, ...) = `destructuring_declaration`
originalDestructuringDeclaration.initializer
}
}
is FirValueParameter -> {
// ... = { `(entry, ...)` -> ... } // value parameter itself is a destructuring declaration
originalDestructuringDeclaration
}
else -> null
} ?: return
val originalDestructuringDeclarationOrInitializerSource = originalDestructuringDeclarationOrInitializer.source ?: return
val originalDestructuringDeclarationType =
when (originalDestructuringDeclarationOrInitializer) {
is FirVariable<*> -> originalDestructuringDeclarationOrInitializer.returnTypeRef
is FirExpression -> originalDestructuringDeclarationOrInitializer.typeRef
else -> null
} ?: return
when (val diagnostic = reference.diagnostic) {
is ConeUnresolvedNameError -> {
reporter.report(
FirErrors.COMPONENT_FUNCTION_MISSING.on(
originalDestructuringDeclarationOrInitializerSource,
diagnostic.name,
originalDestructuringDeclarationType
)
)
}
is ConeAmbiguityError -> {
reporter.report(
FirErrors.COMPONENT_FUNCTION_AMBIGUITY.on(
originalDestructuringDeclarationOrInitializerSource,
diagnostic.name,
diagnostic.candidates
)
)
}
// TODO: COMPONENT_FUNCTION_ON_NULLABLE
// TODO: COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH
}
}
private fun checkInitializer(source: FirSourceElement, initializer: FirExpression?, reporter: DiagnosticReporter) {
val needToReport =
when (initializer) {
null -> true
is FirErrorExpression -> (initializer.diagnostic as? ConeSimpleDiagnostic)?.kind == DiagnosticKind.Syntax
else -> false
}
if (needToReport) {
reporter.report(source, FirErrors.INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION)
}
}
private val FirExpression.explicitReceiverOfQualifiedAccess: FirQualifiedAccessExpression?
get() = (this as? FirQualifiedAccess)?.explicitReceiver?.unwrapped as? FirQualifiedAccessExpression
private val FirExpression.unwrapped: FirExpression
get() =
when (this) {
is FirExpressionWithSmartcast -> this.originalExpression
is FirWrappedExpression -> this.expression
else -> this
}
private val FirQualifiedAccessExpression.resolvedVariable: FirVariable<*>?
get() = ((calleeReference as? FirResolvedNamedReference)?.resolvedSymbol as? FirVariableSymbol)?.fir as? FirVariable<*>
}
@@ -1,35 +0,0 @@
/*
* Copyright 2010-2021 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.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.fir.FirFakeSourceElementKind
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.extended.report
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.FirProperty
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
import org.jetbrains.kotlin.fir.expressions.FirErrorExpression
object FirDestructuringDeclarationInitializerChecker : FirPropertyChecker() {
override fun check(declaration: FirProperty, context: CheckerContext, reporter: DiagnosticReporter) {
if (!declaration.name.isSpecial || declaration.name.asString() != "<destruct>") return
val source = declaration.source
if (source == null || source.kind is FirFakeSourceElementKind) return
if (source.elementType != KtNodeTypes.DESTRUCTURING_DECLARATION) return
val needToReport =
when (val initializer = declaration.initializer) {
null -> true
is FirErrorExpression -> (initializer.diagnostic as? ConeSimpleDiagnostic)?.kind == DiagnosticKind.Syntax
else -> false
}
if (needToReport) {
reporter.report(source, FirErrors.INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION)
}
}
}
@@ -5,17 +5,17 @@
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.findNonInterfaceSupertype
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.isEnumClass
object FirEnumClassSimpleChecker : FirRegularClassChecker() {
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
if (declaration.classKind != ClassKind.ENUM_CLASS) {
if (!declaration.isEnumClass) {
return
}
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2021 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.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.fir.FirFakeSourceElementKind
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.checkers.extended.report
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.declarations.FirClass
import org.jetbrains.kotlin.fir.declarations.FirFile
import org.jetbrains.kotlin.fir.declarations.FirFunction
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
import org.jetbrains.kotlin.name.SpecialNames
object FirFunctionNameChecker : FirFunctionChecker() {
override fun check(declaration: FirFunction<*>, context: CheckerContext, reporter: DiagnosticReporter) {
val source = declaration.source
if (source == null || source.kind is FirFakeSourceElementKind) return
val containingDeclaration = context.containingDeclarations.lastOrNull()
val isNonLocal = containingDeclaration is FirFile || containingDeclaration is FirClass<*>
if (declaration is FirSimpleFunction && declaration.name == SpecialNames.NO_NAME_PROVIDED && isNonLocal) {
reporter.report(source, FirErrors.FUNCTION_DECLARATION_WITH_NO_NAME)
}
}
}

Some files were not shown because too many files have changed in this diff Show More