mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-01 00:21:29 +00:00
Compare commits
179 Commits
build-1.4.
...
rr/mitropo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a4eee7b36 | ||
|
|
e13a38a758 | ||
|
|
9e9ca4953f | ||
|
|
62dcfcde79 | ||
|
|
4739adb6dc | ||
|
|
03651f1dd4 | ||
|
|
650469024e | ||
|
|
2be94d9d2f | ||
|
|
c015463926 | ||
|
|
1bb3f60bad | ||
|
|
36f22dafc5 | ||
|
|
41131e46d7 | ||
|
|
95625d0fae | ||
|
|
2fe222e8e7 | ||
|
|
de6154980d | ||
|
|
d2ea108123 | ||
|
|
388e619d90 | ||
|
|
f3a2ff8646 | ||
|
|
117aae8a6b | ||
|
|
9e37b62f62 | ||
|
|
55595fe2c6 | ||
|
|
db127bb414 | ||
|
|
3d86e92bf5 | ||
|
|
64b1cc7fd4 | ||
|
|
cc95c16ac2 | ||
|
|
bc16fbf438 | ||
|
|
7d31d7f20c | ||
|
|
b9fda902fb | ||
|
|
ce20196006 | ||
|
|
631e68c99a | ||
|
|
ace7ae19b4 | ||
|
|
07654b4c0e | ||
|
|
b2e629dceb | ||
|
|
0234678804 | ||
|
|
caa5aadc98 | ||
|
|
463908f6f4 | ||
|
|
cc67ac631f | ||
|
|
a150014e74 | ||
|
|
b543588ccd | ||
|
|
9096d21fcd | ||
|
|
632e88459e | ||
|
|
de7d82e42b | ||
|
|
6f0bd6c122 | ||
|
|
7384c89ddd | ||
|
|
fd9b14ed29 | ||
|
|
2ed68643cb | ||
|
|
d8892ced9d | ||
|
|
5ed7abd15d | ||
|
|
69dc963f97 | ||
|
|
19cc9c81dc | ||
|
|
7b1b50499d | ||
|
|
a3750b6419 | ||
|
|
c0f4ee7dc9 | ||
|
|
447308dcfc | ||
|
|
1cccceabb9 | ||
|
|
d9821412d0 | ||
|
|
a292eb865b | ||
|
|
1329030281 | ||
|
|
10e5dc1f63 | ||
|
|
d9e5407ecb | ||
|
|
439808952d | ||
|
|
901b794af3 | ||
|
|
02f6a03ff7 | ||
|
|
2656eeb164 | ||
|
|
d385a9b29e | ||
|
|
f64f9c2144 | ||
|
|
6f957c7b31 | ||
|
|
aaacbaaaec | ||
|
|
a035404c96 | ||
|
|
3297237f3d | ||
|
|
175e94c0aa | ||
|
|
fe61530357 | ||
|
|
ab5cb13dae | ||
|
|
cbbb497edf | ||
|
|
c4b24548cb | ||
|
|
293df7bd50 | ||
|
|
63394858ac | ||
|
|
e787dbf374 | ||
|
|
1c2fbb61fe | ||
|
|
7a0f986823 | ||
|
|
67158caf73 | ||
|
|
41306d25fd | ||
|
|
8e8710efec | ||
|
|
982cbf1148 | ||
|
|
d3d3b41dea | ||
|
|
74c697af92 | ||
|
|
8fb41e4562 | ||
|
|
a72eeb800d | ||
|
|
060b2eaf27 | ||
|
|
ca15c33a62 | ||
|
|
9db9e2ad57 | ||
|
|
71f53d49ca | ||
|
|
d9b4e24b29 | ||
|
|
7b89717092 | ||
|
|
aaf3410708 | ||
|
|
48ec104a34 | ||
|
|
4080bd1325 | ||
|
|
8f156f3609 | ||
|
|
e51874d46a | ||
|
|
464c8eb77a | ||
|
|
4a52596344 | ||
|
|
1f5012684b | ||
|
|
aab4fd7225 | ||
|
|
92c224b616 | ||
|
|
1a81f02377 | ||
|
|
d0c0ddd7e5 | ||
|
|
3283a10561 | ||
|
|
db42b5b062 | ||
|
|
49710c9509 | ||
|
|
8f679bf1d3 | ||
|
|
1ab6a9bc84 | ||
|
|
34aff5953f | ||
|
|
791dfb78ab | ||
|
|
99e05b777a | ||
|
|
10c501d474 | ||
|
|
f5db4b12ba | ||
|
|
cf65b1f87a | ||
|
|
9f45ef8df5 | ||
|
|
0f47a38042 | ||
|
|
f285a31a5a | ||
|
|
2ca0e37be7 | ||
|
|
eb6e797001 | ||
|
|
6316949e36 | ||
|
|
85840578ad | ||
|
|
af1dd6251e | ||
|
|
ee455abe52 | ||
|
|
3766dbff69 | ||
|
|
846fc13519 | ||
|
|
b93c49afae | ||
|
|
99c5585790 | ||
|
|
1a7b30c13a | ||
|
|
2f89ba9499 | ||
|
|
cb8addc4cd | ||
|
|
9cac2e1945 | ||
|
|
1b47d538ae | ||
|
|
51d74d78c6 | ||
|
|
d5ae06e7ed | ||
|
|
05f9154bdd | ||
|
|
d7df249480 | ||
|
|
a6feae0fbb | ||
|
|
a22fb2c1ba | ||
|
|
fe4bb24a3e | ||
|
|
db50afeafe | ||
|
|
1186d1affd | ||
|
|
d7ee168dff | ||
|
|
7c57c4a2fb | ||
|
|
535534cf66 | ||
|
|
f0ff8f202c | ||
|
|
c95216dc5d | ||
|
|
01707800c1 | ||
|
|
9d6ea3c073 | ||
|
|
306abc79ed | ||
|
|
d69ce74ca5 | ||
|
|
da5b2cfb64 | ||
|
|
63a0b5bfde | ||
|
|
447549f20d | ||
|
|
145b2c260b | ||
|
|
f833b4fe63 | ||
|
|
cf655a829c | ||
|
|
a8cb6b2ede | ||
|
|
7c99a6fef4 | ||
|
|
acc15e5fad | ||
|
|
7a58a59114 | ||
|
|
e72fb755a0 | ||
|
|
201b115ee0 | ||
|
|
8e7bbf1780 | ||
|
|
c0d7e565bc | ||
|
|
29ceb25f5c | ||
|
|
3a6b9c8d08 | ||
|
|
9d98240272 | ||
|
|
0f10faabbf | ||
|
|
205510863a | ||
|
|
f7ceacb15c | ||
|
|
077853d2ad | ||
|
|
3b4cef1b56 | ||
|
|
cbabb4f76a | ||
|
|
7b61bf9178 | ||
|
|
24948a8b3f | ||
|
|
063c973eaa |
15
.idea/codeStyles/Project.xml
generated
15
.idea/codeStyles/Project.xml
generated
@@ -13,6 +13,21 @@
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" alias="false" withSubpackages="false" />
|
||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||
<value>
|
||||
<package name="" alias="false" withSubpackages="true" />
|
||||
<package name="java" alias="false" withSubpackages="true" />
|
||||
<package name="javax" alias="false" withSubpackages="true" />
|
||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<MarkdownNavigatorCodeStyleSettings>
|
||||
|
||||
2
.idea/dictionaries/dmitriy_dolovov.xml
generated
2
.idea/dictionaries/dmitriy_dolovov.xml
generated
@@ -9,9 +9,11 @@
|
||||
<w>commonizer</w>
|
||||
<w>commonizers</w>
|
||||
<w>commonizes</w>
|
||||
<w>commonizing</w>
|
||||
<w>jetbrains</w>
|
||||
<w>konan</w>
|
||||
<w>kotlinx</w>
|
||||
<w>macos</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
21
.idea/runConfigurations/Test__stdlib_js_public_kotlin_api_test__overwrite_results.xml
generated
Normal file
21
.idea/runConfigurations/Test__stdlib_js_public_kotlin_api_test__overwrite_results.xml
generated
Normal file
@@ -0,0 +1,21 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="--tests "org.jetbrains.kotlin.js.test.ApiTest" -Poverwrite.output=true" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":js:js.tests:test" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
2
.idea/scopes/Apply_copyright.xml
generated
2
.idea/scopes/Apply_copyright.xml
generated
@@ -1,3 +1,3 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&&!file[*]:testData//*&&!file[*]:*.gradle.kts&&!file[*]:*.gradle&&!file[kotlin.kotlin-ultimate]:*/&&!file[kotlin.kotlin-ultimate.*]:*/" />
|
||||
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&&!file[*]:testData//*&&!file[*]:*.gradle.kts&&!file[*]:*.gradle&&!file[kotlin.kotlin-ultimate]:*/&&!file[kotlin.kotlin-ultimate.*]:*/&&!file[kotlin.libraries]:stdlib/api//*" />
|
||||
</component>
|
||||
@@ -1047,3 +1047,15 @@ val Jar.outputFile: File
|
||||
|
||||
val Project.sourceSetsOrNull: SourceSetContainer?
|
||||
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
|
||||
|
||||
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
|
||||
if (disableVerificationTasks) {
|
||||
gradle.taskGraph.whenReady {
|
||||
allTasks.forEach {
|
||||
if (it is VerificationTask) {
|
||||
logger.info("DISABLED: '$it'")
|
||||
it.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,10 @@ fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
|
||||
}
|
||||
|
||||
fun Project.addEmptyJarArtifacts(publication: MavenPublication) {
|
||||
val emptyJar = getOrCreateTask<Jar>("emptyJar") { }
|
||||
val emptyJar = getOrCreateTask<Jar>("emptyJar") {
|
||||
archiveBaseName.set("empty")
|
||||
}
|
||||
|
||||
publication.artifact(emptyJar.get()) { }
|
||||
publication.artifact(emptyJar.get()) { classifier = "sources" }
|
||||
publication.artifact(emptyJar.get()) { classifier = "javadoc" }
|
||||
|
||||
@@ -52,7 +52,6 @@ import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi;
|
||||
import org.jetbrains.kotlin.resolve.sam.SamConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.load.kotlin.MethodSignatureMappingKt;
|
||||
import org.jetbrains.kotlin.load.kotlin.TypeSignatureMappingKt;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
@@ -77,6 +76,7 @@ import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
import org.jetbrains.kotlin.resolve.sam.SamConstructorDescriptor;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.*;
|
||||
import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
@@ -1585,7 +1585,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
assert topOfStack == tryWithFinallyBlockStackElement : "Top element of stack doesn't equals processing finally block";
|
||||
|
||||
KtTryExpression jetTryExpression = tryWithFinallyBlockStackElement.expression;
|
||||
Label finallyStart = new Label();
|
||||
Label finallyStart = linkedLabel();
|
||||
v.mark(finallyStart);
|
||||
tryWithFinallyBlockStackElement.addGapLabel(finallyStart);
|
||||
addGapLabelsForNestedTryCatchWithoutFinally(state, nestedTryBlocksWithoutFinally, finallyStart);
|
||||
|
||||
@@ -60,6 +60,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import org.jetbrains.org.objectweb.asm.tree.LabelNode
|
||||
import java.util.*
|
||||
|
||||
fun generateIsCheck(
|
||||
@@ -666,3 +667,22 @@ private fun generateLambdaForRunSuspend(
|
||||
lambdaBuilder.done()
|
||||
return lambdaBuilder.thisName
|
||||
}
|
||||
|
||||
internal fun LabelNode.linkWithLabel(): LabelNode {
|
||||
// Remember labelNode in label and vise versa.
|
||||
// Before ASM 8 there was JB patch in MethodNode that makes such linking in constructor of LabelNode.
|
||||
//
|
||||
// protected LabelNode getLabelNode(final Label label) {
|
||||
// if (!(label.info instanceof LabelNode)) {
|
||||
// //label.info = new LabelNode(label); //[JB: needed for Coverage agent]
|
||||
// label.info = new LabelNode(); //ASM 8
|
||||
// }
|
||||
// return (LabelNode) label.info;
|
||||
// }
|
||||
if (label.info == null) {
|
||||
label.info = this
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
fun linkedLabel(): Label = LabelNode().linkWithLabel().label
|
||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.codegen.coroutines
|
||||
import com.intellij.util.ArrayUtil
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil
|
||||
import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype
|
||||
import org.jetbrains.kotlin.cfg.index
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure
|
||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
|
||||
@@ -22,6 +23,7 @@ import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.isReleaseCoroutines
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
@@ -229,6 +231,7 @@ class CoroutineCodegenForLambda private constructor(
|
||||
|
||||
override fun generateClosureBody() {
|
||||
for (parameter in allFunctionParameters()) {
|
||||
if (parameter.isUnused()) continue
|
||||
val fieldInfo = parameter.getFieldInfoForCoroutineLambdaParameter()
|
||||
v.newField(
|
||||
OtherOrigin(parameter),
|
||||
@@ -241,6 +244,10 @@ class CoroutineCodegenForLambda private constructor(
|
||||
generateResumeImpl()
|
||||
}
|
||||
|
||||
private fun ParameterDescriptor.isUnused(): Boolean =
|
||||
originalSuspendFunctionDescriptor is AnonymousFunctionDescriptor &&
|
||||
bindingContext[BindingContext.SUSPEND_LAMBDA_PARAMETER_USED, originalSuspendFunctionDescriptor to index()] != true
|
||||
|
||||
private val generateErasedCreate: Boolean = allFunctionParameters().size <= 1
|
||||
|
||||
private val doNotGenerateInvokeBridge: Boolean = !originalSuspendFunctionDescriptor.isLocalSuspendFunctionNotSuspendLambda()
|
||||
@@ -398,39 +405,41 @@ class CoroutineCodegenForLambda private constructor(
|
||||
var index = 1
|
||||
for (parameter in allFunctionParameters()) {
|
||||
val fieldInfoForCoroutineLambdaParameter = parameter.getFieldInfoForCoroutineLambdaParameter()
|
||||
if (isBigArity) {
|
||||
load(cloneIndex, fieldInfoForCoroutineLambdaParameter.ownerType)
|
||||
load(1, AsmTypes.OBJECT_TYPE)
|
||||
iconst(index - 1)
|
||||
aload(AsmTypes.OBJECT_TYPE)
|
||||
StackValue.coerce(
|
||||
AsmTypes.OBJECT_TYPE, builtIns.nullableAnyType,
|
||||
fieldInfoForCoroutineLambdaParameter.fieldType, fieldInfoForCoroutineLambdaParameter.fieldKotlinType,
|
||||
this
|
||||
)
|
||||
putfield(
|
||||
fieldInfoForCoroutineLambdaParameter.ownerInternalName,
|
||||
fieldInfoForCoroutineLambdaParameter.fieldName,
|
||||
fieldInfoForCoroutineLambdaParameter.fieldType.descriptor
|
||||
)
|
||||
} else {
|
||||
if (generateErasedCreate) {
|
||||
load(index, AsmTypes.OBJECT_TYPE)
|
||||
if (!parameter.isUnused()) {
|
||||
if (isBigArity) {
|
||||
load(cloneIndex, fieldInfoForCoroutineLambdaParameter.ownerType)
|
||||
load(1, AsmTypes.OBJECT_TYPE)
|
||||
iconst(index - 1)
|
||||
aload(AsmTypes.OBJECT_TYPE)
|
||||
StackValue.coerce(
|
||||
AsmTypes.OBJECT_TYPE, builtIns.nullableAnyType,
|
||||
fieldInfoForCoroutineLambdaParameter.fieldType, fieldInfoForCoroutineLambdaParameter.fieldKotlinType,
|
||||
this
|
||||
)
|
||||
putfield(
|
||||
fieldInfoForCoroutineLambdaParameter.ownerInternalName,
|
||||
fieldInfoForCoroutineLambdaParameter.fieldName,
|
||||
fieldInfoForCoroutineLambdaParameter.fieldType.descriptor
|
||||
)
|
||||
} else {
|
||||
load(index, fieldInfoForCoroutineLambdaParameter.fieldType)
|
||||
if (generateErasedCreate) {
|
||||
load(index, AsmTypes.OBJECT_TYPE)
|
||||
StackValue.coerce(
|
||||
AsmTypes.OBJECT_TYPE, builtIns.nullableAnyType,
|
||||
fieldInfoForCoroutineLambdaParameter.fieldType, fieldInfoForCoroutineLambdaParameter.fieldKotlinType,
|
||||
this
|
||||
)
|
||||
} else {
|
||||
load(index, fieldInfoForCoroutineLambdaParameter.fieldType)
|
||||
}
|
||||
AsmUtil.genAssignInstanceFieldFromParam(
|
||||
fieldInfoForCoroutineLambdaParameter,
|
||||
index,
|
||||
this,
|
||||
cloneIndex,
|
||||
generateErasedCreate
|
||||
)
|
||||
}
|
||||
AsmUtil.genAssignInstanceFieldFromParam(
|
||||
fieldInfoForCoroutineLambdaParameter,
|
||||
index,
|
||||
this,
|
||||
cloneIndex,
|
||||
generateErasedCreate
|
||||
)
|
||||
}
|
||||
index += if (isBigArity || generateErasedCreate) 1 else fieldInfoForCoroutineLambdaParameter.fieldType.size
|
||||
}
|
||||
@@ -442,6 +451,7 @@ class CoroutineCodegenForLambda private constructor(
|
||||
|
||||
private fun ExpressionCodegen.initializeCoroutineParameters() {
|
||||
for (parameter in allFunctionParameters()) {
|
||||
if (parameter.isUnused()) continue
|
||||
val fieldStackValue =
|
||||
StackValue.field(
|
||||
parameter.getFieldInfoForCoroutineLambdaParameter(), generateThisOrOuter(context.thisDescriptor, false)
|
||||
@@ -463,7 +473,11 @@ class CoroutineCodegenForLambda private constructor(
|
||||
v.visitLocalVariable(name, mappedType.descriptor, null, label, endLabel, newIndex)
|
||||
}
|
||||
|
||||
initializeVariablesForDestructuredLambdaParameters(this, originalSuspendFunctionDescriptor.valueParameters, endLabel)
|
||||
initializeVariablesForDestructuredLambdaParameters(
|
||||
this,
|
||||
originalSuspendFunctionDescriptor.valueParameters.filter { !it.isUnused() },
|
||||
endLabel
|
||||
)
|
||||
}
|
||||
|
||||
private fun allFunctionParameters(): List<ParameterDescriptor> =
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.codegen.TransformationMethodVisitor
|
||||
import org.jetbrains.kotlin.codegen.inline.*
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.*
|
||||
import org.jetbrains.kotlin.codegen.optimization.fixStack.FixStackMethodTransformer
|
||||
import org.jetbrains.kotlin.codegen.linkWithLabel
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.config.isReleaseCoroutines
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
@@ -593,7 +594,7 @@ class CoroutineTransformerMethodVisitor(
|
||||
|
||||
private fun spillVariables(suspensionPoints: List<SuspensionPoint>, methodNode: MethodNode): List<List<SpilledVariableDescriptor>> {
|
||||
val instructions = methodNode.instructions
|
||||
val frames = performSpilledVariableFieldTypesAnalysis(methodNode, containingClassInternalName)
|
||||
val frames = performRefinedTypeAnalysis(methodNode, containingClassInternalName)
|
||||
fun AbstractInsnNode.index() = instructions.indexOf(this)
|
||||
|
||||
// We postpone these actions because they change instruction indices that we use when obtaining frames
|
||||
@@ -641,11 +642,11 @@ class CoroutineTransformerMethodVisitor(
|
||||
.map { Pair(it, frame.getLocal(it)) }
|
||||
.filter { (index, value) ->
|
||||
(index == 0 && needDispatchReceiver && isForNamedFunction) ||
|
||||
(value.type != null && livenessFrame.isAlive(index))
|
||||
(value != StrictBasicValue.UNINITIALIZED_VALUE && livenessFrame.isAlive(index))
|
||||
}
|
||||
|
||||
for ((index, basicValue) in variablesToSpill) {
|
||||
if (basicValue.type == NULL_TYPE) {
|
||||
if (basicValue === StrictBasicValue.NULL_VALUE) {
|
||||
postponedActions.add {
|
||||
with(instructions) {
|
||||
insert(suspension.tryCatchBlockEndLabelAfterSuspensionCall, withInstructionAdapter {
|
||||
@@ -657,7 +658,7 @@ class CoroutineTransformerMethodVisitor(
|
||||
continue
|
||||
}
|
||||
|
||||
val type = basicValue.type!!
|
||||
val type = basicValue.type
|
||||
val normalizedType = type.normalize()
|
||||
|
||||
val indexBySort = varsCountByType[normalizedType]?.plus(1) ?: 0
|
||||
@@ -741,7 +742,7 @@ class CoroutineTransformerMethodVisitor(
|
||||
suspendMarkerVarIndex: Int,
|
||||
suspendPointLineNumber: LineNumberNode?
|
||||
): LabelNode {
|
||||
val continuationLabel = LabelNode()
|
||||
val continuationLabel = LabelNode().linkWithLabel()
|
||||
val continuationLabelAfterLoadedResult = LabelNode()
|
||||
val suspendElementLineNumber = lineNumber
|
||||
var nextLineNumberNode = nextDefinitelyHitLineNumber(suspension)
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicInterpreter
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
|
||||
|
||||
private class PossibleSpilledValue(val source: AbstractInsnNode, type: Type?) : BasicValue(type) {
|
||||
val usages = mutableSetOf<AbstractInsnNode>()
|
||||
|
||||
@@ -1,309 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.coroutines
|
||||
|
||||
import org.jetbrains.kotlin.codegen.inline.insnOpcodeText
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.MethodAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.org.objectweb.asm.Handle
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes.*
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.Interpreter
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.Value
|
||||
|
||||
// BasicValue interpreter from ASM does not distinct 'int' types from other int-like types like 'byte' or 'boolean',
|
||||
// neither do HotSpot and JVM spec.
|
||||
// But it seems like Dalvik does not follow it, and spilling boolean value into an 'int' field fails with VerifyError on Android 4,
|
||||
// so this function calculates refined frames' markup.
|
||||
// Note that type of some values is only possible to determine by their usages (e.g. ICONST_1, BALOAD both may push boolean or byte on stack)
|
||||
// In this case, update the type of the value.
|
||||
|
||||
// StrictBasicValue with mutable type
|
||||
internal open class SpilledVariableFieldTypeValue(open var type: Type?, val insn: AbstractInsnNode?) : Value {
|
||||
override fun getSize(): Int = type?.size ?: 1
|
||||
|
||||
override fun equals(other: Any?): Boolean = other is SpilledVariableFieldTypeValue && type == other.type && insn == other.insn
|
||||
|
||||
override fun hashCode(): Int = (type?.hashCode() ?: 0) xor insn.hashCode()
|
||||
|
||||
override fun toString() = if (type == null) "." else "$type"
|
||||
}
|
||||
|
||||
private class MergedSpilledVariableFieldTypeValue(
|
||||
val values: Set<SpilledVariableFieldTypeValue>
|
||||
) : SpilledVariableFieldTypeValue(null, null) {
|
||||
override var type: Type?
|
||||
get() = values.first().type
|
||||
set(newType) {
|
||||
for (value in values) {
|
||||
value.type = newType
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean = other is MergedSpilledVariableFieldTypeValue && other.values == values
|
||||
|
||||
override fun hashCode(): Int = values.hashCode()
|
||||
|
||||
override fun toString(): String = "M$values"
|
||||
}
|
||||
|
||||
private operator fun SpilledVariableFieldTypeValue?.plus(other: SpilledVariableFieldTypeValue?): SpilledVariableFieldTypeValue? = when {
|
||||
this == null -> other
|
||||
other == null -> this
|
||||
this == other -> this
|
||||
this is MergedSpilledVariableFieldTypeValue -> {
|
||||
if (other is MergedSpilledVariableFieldTypeValue) MergedSpilledVariableFieldTypeValue(values + other.values)
|
||||
else MergedSpilledVariableFieldTypeValue(values + other)
|
||||
}
|
||||
other is MergedSpilledVariableFieldTypeValue -> MergedSpilledVariableFieldTypeValue(other.values + this)
|
||||
else -> MergedSpilledVariableFieldTypeValue(setOf(this, other))
|
||||
}
|
||||
|
||||
internal val NULL_TYPE = Type.getObjectType("null")
|
||||
|
||||
// Same as BasicInterpreter, but updates types based on usages
|
||||
private class SpilledVariableFieldTypesInterpreter(
|
||||
private val methodNode: MethodNode
|
||||
) : Interpreter<SpilledVariableFieldTypeValue>(API_VERSION) {
|
||||
override fun newValue(type: Type?): SpilledVariableFieldTypeValue? =
|
||||
if (type == Type.VOID_TYPE) null else SpilledVariableFieldTypeValue(type, null)
|
||||
|
||||
// INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC, INVOKEINTERFACE,
|
||||
// MULTIANEWARRAY and INVOKEDYNAMIC
|
||||
override fun naryOperation(
|
||||
insn: AbstractInsnNode,
|
||||
values: MutableList<out SpilledVariableFieldTypeValue?>
|
||||
): SpilledVariableFieldTypeValue? {
|
||||
fun updateTypes(argTypes: Array<Type>, withReceiver: Boolean) {
|
||||
val offset = if (withReceiver) 1 else 0
|
||||
for ((index, argType) in argTypes.withIndex()) {
|
||||
val value = values[index + offset] ?: continue
|
||||
if (argType.isIntType()) {
|
||||
value.type = argType
|
||||
} else if (
|
||||
(value.type == AsmTypes.OBJECT_TYPE && argType != AsmTypes.OBJECT_TYPE) ||
|
||||
value.type == NULL_TYPE || value.type == null
|
||||
) {
|
||||
value.type = argType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SpilledVariableFieldTypeValue(
|
||||
when (insn.opcode) {
|
||||
MULTIANEWARRAY -> {
|
||||
Type.getType((insn as MultiANewArrayInsnNode).desc)
|
||||
}
|
||||
INVOKEDYNAMIC -> {
|
||||
updateTypes(Type.getArgumentTypes((insn as InvokeDynamicInsnNode).desc), false)
|
||||
Type.getReturnType(insn.desc)
|
||||
}
|
||||
INVOKESTATIC -> {
|
||||
updateTypes(Type.getArgumentTypes((insn as MethodInsnNode).desc), false)
|
||||
Type.getReturnType(insn.desc)
|
||||
}
|
||||
INVOKEVIRTUAL, INVOKEINTERFACE, INVOKESPECIAL -> {
|
||||
updateTypes(Type.getArgumentTypes((insn as MethodInsnNode).desc), true)
|
||||
Type.getReturnType(insn.desc)
|
||||
}
|
||||
else -> {
|
||||
unreachable(insn)
|
||||
}
|
||||
}, insn
|
||||
)
|
||||
}
|
||||
|
||||
private fun Type.isIntType(): Boolean = when (sort) {
|
||||
Type.BOOLEAN, Type.BYTE, Type.CHAR, Type.SHORT, Type.INT -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
private fun unreachable(insn: AbstractInsnNode): Nothing = error("Unreachable instruction ${insn.insnOpcodeText}")
|
||||
|
||||
// IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE
|
||||
override fun ternaryOperation(
|
||||
insn: AbstractInsnNode,
|
||||
arrayref: SpilledVariableFieldTypeValue?,
|
||||
index: SpilledVariableFieldTypeValue?,
|
||||
value: SpilledVariableFieldTypeValue?
|
||||
): SpilledVariableFieldTypeValue? {
|
||||
when (insn.opcode) {
|
||||
IASTORE, LASTORE, FASTORE, DASTORE, AASTORE -> {
|
||||
// nothing to do
|
||||
}
|
||||
BASTORE -> {
|
||||
value?.type = if (arrayref?.type?.descriptor == "[Z") Type.BOOLEAN_TYPE else Type.BYTE_TYPE
|
||||
}
|
||||
CASTORE -> {
|
||||
value?.type = Type.CHAR_TYPE
|
||||
}
|
||||
SASTORE -> {
|
||||
value?.type = Type.SHORT_TYPE
|
||||
}
|
||||
else -> unreachable(insn)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun merge(v: SpilledVariableFieldTypeValue?, w: SpilledVariableFieldTypeValue?): SpilledVariableFieldTypeValue? = when {
|
||||
v?.type?.isIntType() == true && w?.type?.isIntType() == true -> v + w
|
||||
v != null && v.type == null -> w
|
||||
w != null && w.type == null -> v
|
||||
v?.type == w?.type -> v
|
||||
v?.type?.sort == Type.OBJECT && w?.type?.sort == Type.OBJECT -> {
|
||||
when {
|
||||
v.type == AsmTypes.OBJECT_TYPE -> v
|
||||
w.type == AsmTypes.OBJECT_TYPE -> w
|
||||
else -> SpilledVariableFieldTypeValue(AsmTypes.OBJECT_TYPE, v.insn)
|
||||
}
|
||||
}
|
||||
else -> SpilledVariableFieldTypeValue(null, v?.insn ?: w?.insn)
|
||||
}
|
||||
|
||||
// IRETURN, LRETURN, FRETURN, DRETURN, ARETURN
|
||||
override fun returnOperation(insn: AbstractInsnNode, value: SpilledVariableFieldTypeValue?, expected: SpilledVariableFieldTypeValue?) {
|
||||
if (insn.opcode == IRETURN) {
|
||||
value?.type = expected?.type
|
||||
}
|
||||
}
|
||||
|
||||
// INEG, LNEG, FNEG, DNEG, IINC, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L,
|
||||
// F2D, D2I, D2L, D2F, I2B, I2C, I2S, IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE,
|
||||
// TABLESWITCH, LOOKUPSWITCH, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN,
|
||||
// PUTSTATIC, GETFIELD, NEWARRAY, ANEWARRAY, ARRAYLENGTH, ATHROW, CHECKCAST,
|
||||
// INSTANCEOF, MONITORENTER, MONITOREXIT, IFNULL, IFNONNULL
|
||||
override fun unaryOperation(insn: AbstractInsnNode, value: SpilledVariableFieldTypeValue?): SpilledVariableFieldTypeValue? =
|
||||
when (insn.opcode) {
|
||||
INEG, LNEG, FNEG, DNEG, IINC -> SpilledVariableFieldTypeValue(value?.type, insn)
|
||||
I2L, F2L, D2L -> SpilledVariableFieldTypeValue(Type.LONG_TYPE, insn)
|
||||
I2F, L2F, D2F -> SpilledVariableFieldTypeValue(Type.FLOAT_TYPE, insn)
|
||||
L2D, I2D, F2D -> SpilledVariableFieldTypeValue(Type.DOUBLE_TYPE, insn)
|
||||
L2I, F2I, D2I, ARRAYLENGTH -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
|
||||
I2B -> SpilledVariableFieldTypeValue(Type.BYTE_TYPE, insn)
|
||||
I2C -> SpilledVariableFieldTypeValue(Type.CHAR_TYPE, insn)
|
||||
I2S -> SpilledVariableFieldTypeValue(Type.SHORT_TYPE, insn)
|
||||
IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, TABLESWITCH, LOOKUPSWITCH, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN,
|
||||
ATHROW, MONITORENTER, MONITOREXIT, IFNULL, IFNONNULL -> null
|
||||
PUTSTATIC -> {
|
||||
val expectedType = Type.getType((insn as FieldInsnNode).desc)
|
||||
if (expectedType.isIntType()) {
|
||||
value?.type = expectedType
|
||||
}
|
||||
null
|
||||
}
|
||||
GETFIELD -> SpilledVariableFieldTypeValue(Type.getType((insn as FieldInsnNode).desc), insn)
|
||||
NEWARRAY -> when ((insn as IntInsnNode).operand) {
|
||||
T_BOOLEAN -> SpilledVariableFieldTypeValue(Type.getType("[Z"), insn)
|
||||
T_CHAR -> SpilledVariableFieldTypeValue(Type.getType("[C"), insn)
|
||||
T_BYTE -> SpilledVariableFieldTypeValue(Type.getType("[B"), insn)
|
||||
T_SHORT -> SpilledVariableFieldTypeValue(Type.getType("[S"), insn)
|
||||
T_INT -> SpilledVariableFieldTypeValue(Type.getType("[I"), insn)
|
||||
T_FLOAT -> SpilledVariableFieldTypeValue(Type.getType("[F"), insn)
|
||||
T_DOUBLE -> SpilledVariableFieldTypeValue(Type.getType("[D"), insn)
|
||||
T_LONG -> SpilledVariableFieldTypeValue(Type.getType("[J"), insn)
|
||||
else -> unreachable(insn)
|
||||
}
|
||||
ANEWARRAY -> SpilledVariableFieldTypeValue(Type.getType("[${Type.getObjectType((insn as TypeInsnNode).desc)}"), insn)
|
||||
CHECKCAST -> SpilledVariableFieldTypeValue(Type.getObjectType((insn as TypeInsnNode).desc), insn)
|
||||
INSTANCEOF -> SpilledVariableFieldTypeValue(Type.BOOLEAN_TYPE, insn)
|
||||
else -> unreachable(insn)
|
||||
}
|
||||
|
||||
// IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IADD,
|
||||
// LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV,
|
||||
// LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, ISHL, LSHL, ISHR, LSHR, IUSHR,
|
||||
// LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, LCMP, FCMPL, FCMPG, DCMPL,
|
||||
// DCMPG, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE,
|
||||
// IF_ACMPEQ, IF_ACMPNE, PUTFIELD
|
||||
override fun binaryOperation(
|
||||
insn: AbstractInsnNode,
|
||||
v: SpilledVariableFieldTypeValue?,
|
||||
w: SpilledVariableFieldTypeValue?
|
||||
): SpilledVariableFieldTypeValue? =
|
||||
when (insn.opcode) {
|
||||
IALOAD, IADD, ISUB, IMUL, IDIV, IREM, ISHL, ISHR, IUSHR, IAND, IOR, IXOR, LCMP, FCMPL, FCMPG, DCMPL,
|
||||
DCMPG -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
|
||||
LALOAD, LADD, LSUB, LMUL, LDIV, LREM, LSHL, LSHR, LUSHR, LAND, LOR, LXOR -> SpilledVariableFieldTypeValue(Type.LONG_TYPE, insn)
|
||||
FALOAD, FADD, FSUB, FMUL, FDIV, FREM -> SpilledVariableFieldTypeValue(Type.FLOAT_TYPE, insn)
|
||||
DALOAD, DADD, DSUB, DMUL, DDIV, DREM -> SpilledVariableFieldTypeValue(Type.DOUBLE_TYPE, insn)
|
||||
AALOAD -> SpilledVariableFieldTypeValue(AsmTypes.OBJECT_TYPE, insn)
|
||||
BALOAD -> SpilledVariableFieldTypeValue(if (v?.type?.descriptor == "[Z") Type.BOOLEAN_TYPE else Type.BYTE_TYPE, insn)
|
||||
CALOAD -> SpilledVariableFieldTypeValue(Type.CHAR_TYPE, insn)
|
||||
SALOAD -> SpilledVariableFieldTypeValue(Type.SHORT_TYPE, insn)
|
||||
IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE -> null
|
||||
PUTFIELD -> {
|
||||
val expectedType = Type.getType((insn as FieldInsnNode).desc)
|
||||
if (expectedType.isIntType()) {
|
||||
w?.type = expectedType
|
||||
}
|
||||
null
|
||||
}
|
||||
else -> unreachable(insn)
|
||||
}
|
||||
|
||||
// ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE,
|
||||
// ASTORE, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP
|
||||
override fun copyOperation(insn: AbstractInsnNode, value: SpilledVariableFieldTypeValue?): SpilledVariableFieldTypeValue? =
|
||||
when (insn.opcode) {
|
||||
// If same ICONST is stored into several slots, thay can have different types
|
||||
// For example,
|
||||
// val b: Byte = 1
|
||||
// val i: Int = b.toInt()
|
||||
// In this case, `b` and `i` have the same source, but different types.
|
||||
// The example also shows, that the types should be `I`.
|
||||
ISTORE -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
|
||||
// Sometimes we cannot get the type from the usage only
|
||||
// For example,
|
||||
// val c = '1'
|
||||
// if (c == '2) ...
|
||||
// In this case, update the type using information from LVT
|
||||
ILOAD -> {
|
||||
methodNode.localVariables.find { local ->
|
||||
local.index == (insn as VarInsnNode).`var` &&
|
||||
methodNode.instructions.indexOf(local.start) < methodNode.instructions.indexOf(insn) &&
|
||||
methodNode.instructions.indexOf(insn) < methodNode.instructions.indexOf(local.end)
|
||||
}?.let { local ->
|
||||
value?.type = Type.getType(local.desc)
|
||||
}
|
||||
value
|
||||
}
|
||||
else -> value
|
||||
}
|
||||
|
||||
// ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4,
|
||||
// ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0,
|
||||
// DCONST_1, BIPUSH, SIPUSH, LDC, JSR, GETSTATIC, NEW
|
||||
override fun newOperation(insn: AbstractInsnNode): SpilledVariableFieldTypeValue? = when (insn.opcode) {
|
||||
ACONST_NULL -> SpilledVariableFieldTypeValue(NULL_TYPE, insn)
|
||||
ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5 -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
|
||||
LCONST_0, LCONST_1 -> SpilledVariableFieldTypeValue(Type.LONG_TYPE, insn)
|
||||
FCONST_0, FCONST_1, FCONST_2 -> SpilledVariableFieldTypeValue(Type.FLOAT_TYPE, insn)
|
||||
DCONST_0, DCONST_1 -> SpilledVariableFieldTypeValue(Type.DOUBLE_TYPE, insn)
|
||||
BIPUSH -> SpilledVariableFieldTypeValue(Type.BYTE_TYPE, insn)
|
||||
SIPUSH -> SpilledVariableFieldTypeValue(Type.SHORT_TYPE, insn)
|
||||
LDC -> when (val cst = (insn as LdcInsnNode).cst) {
|
||||
is Int -> SpilledVariableFieldTypeValue(Type.INT_TYPE, insn)
|
||||
is Long -> SpilledVariableFieldTypeValue(Type.LONG_TYPE, insn)
|
||||
is Float -> SpilledVariableFieldTypeValue(Type.FLOAT_TYPE, insn)
|
||||
is Double -> SpilledVariableFieldTypeValue(Type.DOUBLE_TYPE, insn)
|
||||
is String -> SpilledVariableFieldTypeValue(AsmTypes.JAVA_STRING_TYPE, insn)
|
||||
is Type -> SpilledVariableFieldTypeValue(AsmTypes.JAVA_CLASS_TYPE, insn)
|
||||
else -> SpilledVariableFieldTypeValue(AsmTypes.OBJECT_TYPE, insn)
|
||||
}
|
||||
JSR -> SpilledVariableFieldTypeValue(Type.VOID_TYPE, insn)
|
||||
GETSTATIC -> SpilledVariableFieldTypeValue(Type.getType((insn as FieldInsnNode).desc), insn)
|
||||
NEW -> SpilledVariableFieldTypeValue(Type.getObjectType((insn as TypeInsnNode).desc), insn)
|
||||
else -> unreachable(insn)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun performSpilledVariableFieldTypesAnalysis(
|
||||
methodNode: MethodNode,
|
||||
thisName: String
|
||||
): Array<out Frame<SpilledVariableFieldTypeValue>?> =
|
||||
MethodAnalyzer(thisName, methodNode, SpilledVariableFieldTypesInterpreter(methodNode)).analyze()
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.coroutines
|
||||
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.*
|
||||
import org.jetbrains.kotlin.codegen.optimization.fixStack.peek
|
||||
import org.jetbrains.kotlin.codegen.optimization.fixStack.top
|
||||
import org.jetbrains.kotlin.codegen.optimization.transformer.MethodTransformer
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.*
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.Frame
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceInterpreter
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.SourceValue
|
||||
import java.util.*
|
||||
|
||||
// BasicValue interpreter from ASM does not distinct 'int' types from other int-like types like 'byte' or 'boolean',
|
||||
// neither do HotSpot and JVM spec.
|
||||
// But it seems like Dalvik does not follow it, and spilling boolean value into an 'int' field fails with VerifyError on Android 4,
|
||||
// so this function calculates refined frames' markup.
|
||||
// Note that type of some values is only possible to determine by their usages (e.g. ICONST_1, BALOAD both may push boolean or byte on stack)
|
||||
internal fun performRefinedTypeAnalysis(methodNode: MethodNode, thisName: String): Array<out Frame<out BasicValue>?> {
|
||||
val insnList = methodNode.instructions
|
||||
val basicFrames = MethodTransformer.analyze(thisName, methodNode, OptimizationBasicInterpreter())
|
||||
val sourceValueFrames = MethodTransformer.analyze(thisName, methodNode, MySourceInterpreter())
|
||||
|
||||
val expectedTypeAndSourcesByInsnIndex: Array<Pair<Type, List<SourceValue>>?> = arrayOfNulls(insnList.size())
|
||||
|
||||
fun AbstractInsnNode.index() = insnList.indexOf(this)
|
||||
|
||||
fun saveExpectedType(value: SourceValue?, expectedType: Type) {
|
||||
if (value == null) return
|
||||
if (expectedType.sort !in REFINED_INT_SORTS) return
|
||||
|
||||
for (insn in value.insns) {
|
||||
// If source is something like ICONST_0, ignore it
|
||||
if (!insn.isIntLoad()) continue
|
||||
val index = insnList.indexOf(insn)
|
||||
|
||||
checkUpdatedExpectedType(expectedTypeAndSourcesByInsnIndex[index]?.first, expectedType)
|
||||
|
||||
expectedTypeAndSourcesByInsnIndex[index] =
|
||||
Pair(expectedType,
|
||||
expectedTypeAndSourcesByInsnIndex[index]?.second.orEmpty() + value)
|
||||
}
|
||||
}
|
||||
|
||||
fun saveExpectedTypeForArrayStore(insn: AbstractInsnNode, sourceValueFrame: Frame<SourceValue>) {
|
||||
val arrayStoreType =
|
||||
when (insn.opcode) {
|
||||
Opcodes.BASTORE -> Type.BYTE_TYPE
|
||||
Opcodes.CASTORE -> Type.CHAR_TYPE
|
||||
Opcodes.SASTORE -> Type.SHORT_TYPE
|
||||
else -> return
|
||||
}
|
||||
|
||||
val insnIndex = insnList.indexOf(insn)
|
||||
|
||||
val arrayArg = basicFrames[insnIndex].peek(2)
|
||||
// may be different from 'arrayStoreType' in case of boolean arrays (BASTORE opcode is also used for them)
|
||||
val expectedType =
|
||||
if (arrayArg?.type?.sort == Type.ARRAY)
|
||||
arrayArg.type.elementType
|
||||
else
|
||||
arrayStoreType
|
||||
|
||||
saveExpectedType(sourceValueFrame.top(), expectedType)
|
||||
}
|
||||
|
||||
fun saveExpectedTypeForFieldOrMethod(insn: AbstractInsnNode, sourceValueFrame: Frame<SourceValue>) {
|
||||
when (insn.opcode) {
|
||||
Opcodes.PUTFIELD, Opcodes.PUTSTATIC ->
|
||||
saveExpectedType(sourceValueFrame.top(), Type.getType((insn as FieldInsnNode).desc))
|
||||
|
||||
Opcodes.INVOKESTATIC, Opcodes.INVOKEVIRTUAL, Opcodes.INVOKEINTERFACE, Opcodes.INVOKESPECIAL -> {
|
||||
val argumentTypes = Type.getArgumentTypes((insn as MethodInsnNode).desc)
|
||||
argumentTypes.withIndex().forEach {
|
||||
val (argIndex, type) = it
|
||||
saveExpectedType(sourceValueFrame.peek(argumentTypes.size - argIndex - 1), type)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun saveExpectedTypeForVarStore(insn: AbstractInsnNode, sourceValueFrame: Frame<SourceValue>) {
|
||||
if (insn.isIntStore()) {
|
||||
val varIndex = (insn as VarInsnNode).`var`
|
||||
// Considering next insn is important because variable initializer is emitted just before
|
||||
// the beginning of variable
|
||||
val nextInsn = InsnSequence(insn.next, insnList.last).firstOrNull(AbstractInsnNode::isMeaningful)
|
||||
|
||||
val variableNode =
|
||||
methodNode.findContainingVariableFromTable(insn, varIndex)
|
||||
?: methodNode.findContainingVariableFromTable(nextInsn ?: return, varIndex)
|
||||
?: return
|
||||
|
||||
saveExpectedType(sourceValueFrame.top(), Type.getType(variableNode.desc))
|
||||
}
|
||||
}
|
||||
|
||||
for ((insnIndex, insn) in insnList.toArray().withIndex()) {
|
||||
assert(insn.opcode != Opcodes.IRETURN) {
|
||||
"Coroutine body must not contain IRETURN instructions because 'doResume' is always void"
|
||||
}
|
||||
|
||||
val sourceValueFrame = sourceValueFrames[insnIndex] ?: continue
|
||||
|
||||
saveExpectedTypeForArrayStore(insn, sourceValueFrame)
|
||||
saveExpectedTypeForFieldOrMethod(insn, sourceValueFrame)
|
||||
saveExpectedTypeForVarStore(insn, sourceValueFrame)
|
||||
}
|
||||
|
||||
val refinedVarFrames = analyze(methodNode, object : BackwardAnalysisInterpreter<VarExpectedTypeFrame> {
|
||||
override fun newFrame(maxLocals: Int): VarExpectedTypeFrame = VarExpectedTypeFrame(maxLocals)
|
||||
|
||||
override fun def(frame: VarExpectedTypeFrame, insn: AbstractInsnNode) {
|
||||
if (insn.isIntStore()) {
|
||||
frame.expectedTypeByVarIndex[(insn as VarInsnNode).`var`] = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun use(frame: VarExpectedTypeFrame, insn: AbstractInsnNode) {
|
||||
val (expectedType, sources) = expectedTypeAndSourcesByInsnIndex[insn.index()] ?: return
|
||||
|
||||
sources.flatMap(SourceValue::insns).forEach { insnNode ->
|
||||
if (insnNode.isIntLoad()) {
|
||||
frame.updateExpectedType((insnNode as VarInsnNode).`var`, expectedType)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return Array(basicFrames.size) {
|
||||
insnIndex ->
|
||||
val current = Frame(basicFrames[insnIndex] ?: return@Array null)
|
||||
|
||||
refinedVarFrames[insnIndex].expectedTypeByVarIndex.withIndex().filter { it.value != null }.forEach {
|
||||
assert(current.getLocal(it.index)?.type?.sort in ALL_INT_SORTS) {
|
||||
"int type expected, but ${current.getLocal(it.index)?.type} was found in basic frames"
|
||||
}
|
||||
|
||||
current.setLocal(it.index, StrictBasicValue(it.value))
|
||||
}
|
||||
|
||||
current
|
||||
}
|
||||
}
|
||||
|
||||
private fun AbstractInsnNode.isIntLoad() = opcode == Opcodes.ILOAD
|
||||
private fun AbstractInsnNode.isIntStore() = opcode == Opcodes.ISTORE
|
||||
|
||||
private fun checkUpdatedExpectedType(was: Type?, new: Type) {
|
||||
assert(was == null || was == new) {
|
||||
"Conflicting expected types: $was/$new"
|
||||
}
|
||||
}
|
||||
|
||||
private class MySourceInterpreter : SourceInterpreter(Opcodes.API_VERSION) {
|
||||
override fun copyOperation(insn: AbstractInsnNode, value: SourceValue) =
|
||||
when {
|
||||
insn.isStoreOperation() || insn.isLoadOperation() -> SourceValue(value.size, insn)
|
||||
// For DUP* instructions return the same value (effectively ignore DUP's)
|
||||
else -> value
|
||||
}
|
||||
}
|
||||
|
||||
private val REFINED_INT_SORTS = setOf(Type.BOOLEAN, Type.CHAR, Type.BYTE, Type.SHORT)
|
||||
private val ALL_INT_SORTS = REFINED_INT_SORTS + Type.INT
|
||||
|
||||
private fun MethodNode.findContainingVariableFromTable(insn: AbstractInsnNode, varIndex: Int): LocalVariableNode? {
|
||||
val insnIndex = instructions.indexOf(insn)
|
||||
return localVariables.firstOrNull {
|
||||
it.index == varIndex && it.rangeContainsInsn(insnIndex, instructions)
|
||||
}
|
||||
}
|
||||
|
||||
private fun LocalVariableNode.rangeContainsInsn(insnIndex: Int, insnList: InsnList) =
|
||||
insnList.indexOf(start) < insnIndex && insnIndex < insnList.indexOf(end)
|
||||
|
||||
private class VarExpectedTypeFrame(maxLocals: Int) : VarFrame<VarExpectedTypeFrame> {
|
||||
val expectedTypeByVarIndex = arrayOfNulls<Type>(maxLocals)
|
||||
|
||||
override fun mergeFrom(other: VarExpectedTypeFrame) {
|
||||
assert(expectedTypeByVarIndex.size == other.expectedTypeByVarIndex.size) {
|
||||
"Other VarExpectedTypeFrame has different size: ${expectedTypeByVarIndex.size} / ${other.expectedTypeByVarIndex.size}"
|
||||
}
|
||||
|
||||
for ((varIndex, type) in other.expectedTypeByVarIndex.withIndex()) {
|
||||
updateExpectedType(varIndex, type ?: continue)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateExpectedType(varIndex: Int, new: Type) {
|
||||
val was = expectedTypeByVarIndex[varIndex]
|
||||
// Widening to int is always allowed
|
||||
if (new == Type.INT_TYPE) return
|
||||
|
||||
checkUpdatedExpectedType(was, new)
|
||||
|
||||
expectedTypeByVarIndex[varIndex] = new
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || other::class.java != this::class.java) return false
|
||||
|
||||
other as VarExpectedTypeFrame
|
||||
|
||||
if (!Arrays.equals(expectedTypeByVarIndex, other.expectedTypeByVarIndex)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return Arrays.hashCode(expectedTypeByVarIndex)
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.linkWithLabel
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
@@ -15,6 +16,7 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||
import org.jetbrains.org.objectweb.asm.Label
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
import org.jetbrains.org.objectweb.asm.tree.LabelNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
|
||||
class InlineCodegenForDefaultBody(
|
||||
@@ -27,7 +29,7 @@ class InlineCodegenForDefaultBody(
|
||||
) : CallGenerator {
|
||||
private val sourceMapper: SourceMapper = codegen.parentCodegen.orCreateSourceMapper
|
||||
|
||||
private val methodStartLabel = Label()
|
||||
private val methodStartLabel = linkedLabel()
|
||||
|
||||
init {
|
||||
assert(InlineUtil.isInline(function)) {
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.linkedLabel;
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.*;
|
||||
import static org.jetbrains.kotlin.codegen.inline.MethodInlinerUtilKt.getNextMeaningful;
|
||||
|
||||
@@ -198,7 +199,7 @@ public class InternalFinallyBlockInliner extends CoveringTryCatchNodeProcessor {
|
||||
//Creating temp node for finally block copy with some additional instruction
|
||||
MethodNode finallyBlockCopy = createEmptyMethodNode();
|
||||
Label newFinallyStart = new Label();
|
||||
Label insertedBlockEnd = new Label();
|
||||
Label insertedBlockEnd = linkedLabel();
|
||||
|
||||
boolean generateAloadAstore = nonLocalReturnType != Type.VOID_TYPE && !finallyInfo.isEmpty();
|
||||
if (generateAloadAstore) {
|
||||
|
||||
@@ -102,7 +102,7 @@ class MethodInliner(
|
||||
}
|
||||
|
||||
//substitute returns with "goto end" instruction to keep non local returns in lambdas
|
||||
val end = Label()
|
||||
val end = linkedLabel()
|
||||
val isTransformingAnonymousObject = nodeRemapper is RegeneratedLambdaFieldRemapper
|
||||
transformedNode = doInline(transformedNode)
|
||||
if (!isTransformingAnonymousObject) {
|
||||
|
||||
@@ -30,7 +30,7 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
|
||||
|
||||
private class TransformerForMethod(val methodNode: MethodNode) {
|
||||
val instructions = methodNode.instructions
|
||||
val newLabelNodes = SmartIdentityTable<Label, LabelNode>()
|
||||
val newLabelNodes = SmartIdentityTable<LabelNode, LabelNode>()
|
||||
|
||||
fun transform() {
|
||||
if (rewriteLabelInstructions()) {
|
||||
@@ -48,11 +48,11 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
|
||||
if (thisNode is LabelNode) {
|
||||
val prevNode = thisNode.previous
|
||||
if (prevNode is LabelNode) {
|
||||
newLabelNodes[thisNode.label] = prevNode
|
||||
newLabelNodes[thisNode] = prevNode
|
||||
removedAnyLabels = true
|
||||
thisNode = instructions.removeNodeGetNext(thisNode)
|
||||
} else {
|
||||
newLabelNodes[thisNode.label] = thisNode
|
||||
newLabelNodes[thisNode] = thisNode
|
||||
thisNode = thisNode.next
|
||||
}
|
||||
} else {
|
||||
@@ -145,12 +145,12 @@ class LabelNormalizationMethodTransformer : MethodTransformer() {
|
||||
}
|
||||
|
||||
private fun getNew(oldLabelNode: LabelNode): LabelNode {
|
||||
return newLabelNodes[oldLabelNode.label]
|
||||
return newLabelNodes[oldLabelNode]
|
||||
?: throw IllegalStateException("Label wasn't found during iterating through instructions")
|
||||
}
|
||||
|
||||
private fun getNewOrOld(oldLabelNode: LabelNode): LabelNode =
|
||||
newLabelNodes[oldLabelNode.label] ?: oldLabelNode
|
||||
newLabelNodes[oldLabelNode] ?: oldLabelNode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen.optimization.nullCheck
|
||||
import org.jetbrains.kotlin.codegen.coroutines.withInstructionAdapter
|
||||
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
|
||||
import org.jetbrains.kotlin.codegen.linkWithLabel
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.StrictBasicValue
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.debugText
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.isInsn
|
||||
@@ -269,7 +270,7 @@ class RedundantNullCheckMethodTransformer(private val generationState: Generatio
|
||||
// <...> -- v is null here
|
||||
|
||||
val jumpsIfNull = insn.opcode == Opcodes.IFNULL
|
||||
val originalLabel = insn.label
|
||||
val originalLabel = insn.label.linkWithLabel()
|
||||
originalLabels[insn] = originalLabel
|
||||
insn.label = synthetic(LabelNode(Label()))
|
||||
|
||||
@@ -342,7 +343,7 @@ class RedundantNullCheckMethodTransformer(private val generationState: Generatio
|
||||
val originalLabel: LabelNode?
|
||||
val insertAfterNotNull: AbstractInsnNode
|
||||
if (jumpsIfInstance) {
|
||||
originalLabel = next.label
|
||||
originalLabel = next.label.linkWithLabel()
|
||||
originalLabels[next] = next.label
|
||||
val newLabel = synthetic(LabelNode(Label()))
|
||||
methodNode.instructions.add(newLabel)
|
||||
|
||||
@@ -77,44 +77,52 @@ object PluginCliParser {
|
||||
configuration: CompilerConfiguration,
|
||||
classLoader: URLClassLoader
|
||||
) {
|
||||
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
|
||||
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
|
||||
it.pluginId
|
||||
} ?: mapOf()
|
||||
|
||||
// TODO issue a warning on using deprecated command line processors when all official plugin migrate to the newer convention
|
||||
val commandLineProcessors = ServiceLoaderLite.loadImplementations(CommandLineProcessor::class.java, classLoader)
|
||||
|
||||
for (processor in commandLineProcessors) {
|
||||
val declaredOptions = processor.pluginOptions.associateBy { it.optionName }
|
||||
val optionsToValues = MultiMap<AbstractCliOption, CliOptionValue>()
|
||||
processCompilerPluginsOptions(configuration, pluginOptions, commandLineProcessors)
|
||||
}
|
||||
}
|
||||
|
||||
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
|
||||
val option = declaredOptions[optionValue!!.optionName]
|
||||
?: throw CliOptionProcessingException("Unsupported plugin option: $optionValue")
|
||||
optionsToValues.putValue(option, optionValue)
|
||||
fun processCompilerPluginsOptions(
|
||||
configuration: CompilerConfiguration,
|
||||
pluginOptions: Iterable<String>?,
|
||||
commandLineProcessors: List<CommandLineProcessor>
|
||||
) {
|
||||
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
|
||||
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
|
||||
it.pluginId
|
||||
} ?: mapOf()
|
||||
|
||||
for (processor in commandLineProcessors) {
|
||||
val declaredOptions = processor.pluginOptions.associateBy { it.optionName }
|
||||
val optionsToValues = MultiMap<AbstractCliOption, CliOptionValue>()
|
||||
|
||||
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
|
||||
val option = declaredOptions[optionValue!!.optionName]
|
||||
?: throw CliOptionProcessingException("Unsupported plugin option: $optionValue")
|
||||
optionsToValues.putValue(option, optionValue)
|
||||
}
|
||||
|
||||
for (option in processor.pluginOptions) {
|
||||
val values = optionsToValues[option]
|
||||
if (option.required && values.isEmpty()) {
|
||||
throw PluginCliOptionProcessingException(
|
||||
processor.pluginId,
|
||||
processor.pluginOptions,
|
||||
"Required plugin option not present: ${processor.pluginId}:${option.optionName}"
|
||||
)
|
||||
}
|
||||
if (!option.allowMultipleOccurrences && values.size > 1) {
|
||||
throw PluginCliOptionProcessingException(
|
||||
processor.pluginId,
|
||||
processor.pluginOptions,
|
||||
"Multiple values are not allowed for plugin option ${processor.pluginId}:${option.optionName}"
|
||||
)
|
||||
}
|
||||
|
||||
for (option in processor.pluginOptions) {
|
||||
val values = optionsToValues[option]
|
||||
if (option.required && values.isEmpty()) {
|
||||
throw PluginCliOptionProcessingException(
|
||||
processor.pluginId,
|
||||
processor.pluginOptions,
|
||||
"Required plugin option not present: ${processor.pluginId}:${option.optionName}"
|
||||
)
|
||||
}
|
||||
if (!option.allowMultipleOccurrences && values.size > 1) {
|
||||
throw PluginCliOptionProcessingException(
|
||||
processor.pluginId,
|
||||
processor.pluginOptions,
|
||||
"Multiple values are not allowed for plugin option ${processor.pluginId}:${option.optionName}"
|
||||
)
|
||||
}
|
||||
|
||||
for (value in values) {
|
||||
processor.processOption(option, value.value, configuration)
|
||||
}
|
||||
for (value in values) {
|
||||
processor.processOption(option, value.value, configuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.client
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
@@ -66,7 +66,7 @@ fun MessageCollector.reportFromDaemon(outputsCollector: ((File, List<File>) -> U
|
||||
else -> throw IllegalStateException("Unexpected compiler message report severity $severity")
|
||||
}
|
||||
if (message != null) {
|
||||
report(compilerSeverity, message, attachment as? CompilerMessageLocation)
|
||||
report(compilerSeverity, message, attachment as? CompilerMessageSourceLocation)
|
||||
}
|
||||
else {
|
||||
reportUnexpected(category, severity, message, attachment)
|
||||
|
||||
19
compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt
vendored
Normal file
19
compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
fun foo(x: Int) {}
|
||||
|
||||
interface A
|
||||
interface B
|
||||
interface C : A, B
|
||||
|
||||
fun bar(x: A) {}
|
||||
fun bar(x: B) {}
|
||||
|
||||
fun test(c: C) {
|
||||
// Argument mapping error
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>("")
|
||||
|
||||
// Ambiguity
|
||||
<!AMBIGUITY!>bar<!>(c)
|
||||
|
||||
// Unresolved reference
|
||||
<!UNRESOLVED_REFERENCE!>baz<!>()
|
||||
}
|
||||
18
compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.txt
vendored
Normal file
18
compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.txt
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
FILE: errorCandidates.kt
|
||||
public final fun foo(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface B : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface C : R|A|, R|B| {
|
||||
}
|
||||
public final fun bar(x: R|A|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(x: R|B|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(c: R|C|): R|kotlin/Unit| {
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(String())
|
||||
<Ambiguity: bar, [/bar, /bar]>#(R|<local>/c|)
|
||||
<Unresolved name: baz>#()
|
||||
}
|
||||
@@ -272,12 +272,12 @@ digraph flowFromInplaceLambda_kt {
|
||||
107 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_14 {
|
||||
color=blue
|
||||
126 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
128 [label="Access variable R|<local>/y|"];
|
||||
129 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
|
||||
130 [label="Access variable R|<local>/x|"];
|
||||
131 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
|
||||
127 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
124 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
126 [label="Access variable R|<local>/y|"];
|
||||
127 [label="Function call: R|<local>/y|.<Unresolved name: inc>#()"];
|
||||
128 [label="Access variable R|<local>/x|"];
|
||||
129 [label="Type operator: (R|<local>/x| as R|kotlin/Int|)"];
|
||||
125 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
108 [label="Postponed exit from lambda"];
|
||||
109 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
|
||||
@@ -287,38 +287,36 @@ digraph flowFromInplaceLambda_kt {
|
||||
113 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
132 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
134 [label="Access variable R|<local>/x|"];
|
||||
135 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
|
||||
136 [label="Access variable R|<local>/y|"];
|
||||
137 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
|
||||
138 [label="Const: Int(1)"];
|
||||
133 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
130 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
132 [label="Access variable R|<local>/x|"];
|
||||
133 [label="Function call: R|<local>/x|.<Unresolved name: inc>#()"];
|
||||
134 [label="Access variable R|<local>/y|"];
|
||||
135 [label="Function call: R|<local>/y|.R|kotlin/Int.inc|()"];
|
||||
136 [label="Const: Int(1)"];
|
||||
131 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
114 [label="Postponed exit from lambda"];
|
||||
115 [label="Function call: R|/myRun|<R|kotlin/Int|>(...)"];
|
||||
116 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
|
||||
117 [label="Variable declaration: lval a: R|kotlin/Int|"];
|
||||
118 [label="Access variable R|<local>/x|"];
|
||||
119 [label="Access variable R|<local>/x|"];
|
||||
120 [label="Access variable R|<local>/x|"];
|
||||
121 [label="Function call: <Inapplicable(INAPPLICABLE): [/takeInt]>#(...)"];
|
||||
122 [label="Access variable R|<local>/y|"];
|
||||
119 [label="Function call: <Inapplicable(INAPPLICABLE): [/takeInt]>#(...)"];
|
||||
120 [label="Access variable R|<local>/y|"];
|
||||
121 [label="Function call: R|/takeInt|(...)"];
|
||||
122 [label="Access variable R|<local>/a|"];
|
||||
123 [label="Function call: R|/takeInt|(...)"];
|
||||
124 [label="Access variable R|<local>/a|"];
|
||||
125 [label="Function call: R|/takeInt|(...)"];
|
||||
106 [label="Exit function test_4" style="filled" fillcolor=red];
|
||||
}
|
||||
105 -> {107};
|
||||
107 -> {108};
|
||||
107 -> {126} [color=red];
|
||||
107 -> {124} [color=red];
|
||||
108 -> {109};
|
||||
109 -> {110};
|
||||
110 -> {111};
|
||||
111 -> {112};
|
||||
112 -> {113};
|
||||
113 -> {114};
|
||||
113 -> {132} [color=red];
|
||||
113 -> {130} [color=red];
|
||||
114 -> {115};
|
||||
115 -> {116};
|
||||
116 -> {117};
|
||||
@@ -328,110 +326,108 @@ digraph flowFromInplaceLambda_kt {
|
||||
120 -> {121};
|
||||
121 -> {122};
|
||||
122 -> {123};
|
||||
123 -> {124};
|
||||
124 -> {125};
|
||||
125 -> {106};
|
||||
126 -> {128};
|
||||
123 -> {106};
|
||||
124 -> {126};
|
||||
126 -> {127};
|
||||
127 -> {128};
|
||||
128 -> {129};
|
||||
129 -> {130};
|
||||
130 -> {131};
|
||||
131 -> {127};
|
||||
132 -> {134};
|
||||
129 -> {125};
|
||||
130 -> {132};
|
||||
132 -> {133};
|
||||
133 -> {134};
|
||||
134 -> {135};
|
||||
135 -> {136};
|
||||
136 -> {137};
|
||||
137 -> {138};
|
||||
138 -> {133};
|
||||
136 -> {131};
|
||||
|
||||
subgraph cluster_16 {
|
||||
color=red
|
||||
139 [label="Enter function test_5" style="filled" fillcolor=red];
|
||||
141 [label="Postponed enter to lambda"];
|
||||
137 [label="Enter function test_5" style="filled" fillcolor=red];
|
||||
139 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_17 {
|
||||
color=blue
|
||||
152 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
154 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
|
||||
153 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
150 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
152 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
|
||||
151 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
142 [label="Postponed exit from lambda"];
|
||||
143 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
|
||||
144 [label="Postponed enter to lambda"];
|
||||
140 [label="Postponed exit from lambda"];
|
||||
141 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
|
||||
142 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_18 {
|
||||
color=blue
|
||||
155 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
157 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
|
||||
156 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
153 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
155 [label="Function call: R|/materialize|<R|kotlin/Int|>()"];
|
||||
154 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
145 [label="Postponed exit from lambda"];
|
||||
146 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
|
||||
148 [label="Call arguments union" style="filled" fillcolor=yellow];
|
||||
147 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
|
||||
149 [label="Variable declaration: lval x: R|kotlin/Int|"];
|
||||
150 [label="Access variable R|<local>/x|"];
|
||||
151 [label="Function call: R|/takeInt|(...)"];
|
||||
140 [label="Exit function test_5" style="filled" fillcolor=red];
|
||||
143 [label="Postponed exit from lambda"];
|
||||
144 [label="Function call: R|kotlin/run|<R|kotlin/Int|>(...)"];
|
||||
146 [label="Call arguments union" style="filled" fillcolor=yellow];
|
||||
145 [label="Function call: R|/select|<R|kotlin/Int|>(...)"];
|
||||
147 [label="Variable declaration: lval x: R|kotlin/Int|"];
|
||||
148 [label="Access variable R|<local>/x|"];
|
||||
149 [label="Function call: R|/takeInt|(...)"];
|
||||
138 [label="Exit function test_5" style="filled" fillcolor=red];
|
||||
}
|
||||
139 -> {141};
|
||||
141 -> {152};
|
||||
141 -> {142} [color=red];
|
||||
142 -> {143};
|
||||
137 -> {139};
|
||||
139 -> {150};
|
||||
139 -> {140} [color=red];
|
||||
140 -> {141};
|
||||
141 -> {142};
|
||||
142 -> {153};
|
||||
142 -> {143} [color=red];
|
||||
143 -> {144};
|
||||
144 -> {155};
|
||||
144 -> {145} [color=red];
|
||||
145 -> {146};
|
||||
146 -> {148};
|
||||
147 -> {149};
|
||||
148 -> {147};
|
||||
149 -> {150};
|
||||
150 -> {151};
|
||||
151 -> {140};
|
||||
152 -> {154};
|
||||
153 -> {142} [color=green];
|
||||
153 -> {148} [color=red];
|
||||
154 -> {153};
|
||||
155 -> {157};
|
||||
156 -> {145} [color=green];
|
||||
156 -> {148} [color=red];
|
||||
157 -> {156};
|
||||
144 -> {146};
|
||||
145 -> {147};
|
||||
146 -> {145};
|
||||
147 -> {148};
|
||||
148 -> {149};
|
||||
149 -> {138};
|
||||
150 -> {152};
|
||||
151 -> {140} [color=green];
|
||||
151 -> {146} [color=red];
|
||||
152 -> {151};
|
||||
153 -> {155};
|
||||
154 -> {143} [color=green];
|
||||
154 -> {146} [color=red];
|
||||
155 -> {154};
|
||||
|
||||
subgraph cluster_19 {
|
||||
color=red
|
||||
158 [label="Enter function test_6" style="filled" fillcolor=red];
|
||||
160 [label="Postponed enter to lambda"];
|
||||
156 [label="Enter function test_6" style="filled" fillcolor=red];
|
||||
158 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_20 {
|
||||
color=blue
|
||||
165 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
167 [label="Postponed enter to lambda"];
|
||||
163 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
165 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_21 {
|
||||
color=blue
|
||||
170 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
172 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
|
||||
171 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
168 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
170 [label="Function call: R|/materialize|<R|kotlin/String|>()"];
|
||||
169 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
168 [label="Postponed exit from lambda"];
|
||||
169 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
|
||||
166 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
166 [label="Postponed exit from lambda"];
|
||||
167 [label="Function call: R|kotlin/run|<R|kotlin/String|>(...)"];
|
||||
164 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
161 [label="Postponed exit from lambda"];
|
||||
162 [label="Function call: R|/myRun|<R|kotlin/String|>(...)"];
|
||||
163 [label="Function call: R|/id|<R|kotlin/String|>(...)"];
|
||||
164 [label="Variable declaration: lval x: R|kotlin/String|"];
|
||||
159 [label="Exit function test_6" style="filled" fillcolor=red];
|
||||
159 [label="Postponed exit from lambda"];
|
||||
160 [label="Function call: R|/myRun|<R|kotlin/String|>(...)"];
|
||||
161 [label="Function call: R|/id|<R|kotlin/String|>(...)"];
|
||||
162 [label="Variable declaration: lval x: R|kotlin/String|"];
|
||||
157 [label="Exit function test_6" style="filled" fillcolor=red];
|
||||
}
|
||||
158 -> {160};
|
||||
156 -> {158};
|
||||
158 -> {159};
|
||||
158 -> {163} [color=red];
|
||||
159 -> {160};
|
||||
160 -> {161};
|
||||
160 -> {165} [color=red];
|
||||
161 -> {162};
|
||||
162 -> {163};
|
||||
163 -> {164};
|
||||
164 -> {159};
|
||||
165 -> {167};
|
||||
167 -> {170};
|
||||
167 -> {168} [color=red];
|
||||
168 -> {169};
|
||||
169 -> {166};
|
||||
170 -> {172};
|
||||
171 -> {168} [color=green];
|
||||
172 -> {171};
|
||||
162 -> {157};
|
||||
163 -> {165};
|
||||
165 -> {168};
|
||||
165 -> {166} [color=red];
|
||||
166 -> {167};
|
||||
167 -> {164};
|
||||
168 -> {170};
|
||||
169 -> {166} [color=green];
|
||||
170 -> {169};
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ digraph localClassesWithImplicit_kt {
|
||||
}
|
||||
20 [label="Exit local class test"];
|
||||
21 [label="Exit anonymous object"];
|
||||
22 [label="Variable declaration: lval x: R|anonymous|"];
|
||||
22 [label="Variable declaration: lval x: R|<anonymous>|"];
|
||||
6 [label="Exit function test" style="filled" fillcolor=red];
|
||||
}
|
||||
5 -> {7};
|
||||
@@ -284,7 +284,7 @@ digraph localClassesWithImplicit_kt {
|
||||
99 [label="Enter block"];
|
||||
100 [label="Access variable R|<local>/b|"];
|
||||
101 [label="Access variable R|kotlin/String.length|"];
|
||||
102 [label="Function call: this@R|/anonymous|.R|/anonymous.bar|()"];
|
||||
102 [label="Function call: this@R|/<anonymous>|.R|/<anonymous>.bar|()"];
|
||||
103 [label="Exit block"];
|
||||
}
|
||||
104 [label="Exit when branch result"];
|
||||
@@ -299,7 +299,7 @@ digraph localClassesWithImplicit_kt {
|
||||
^ when () {
|
||||
(R|<local>/b| is R|kotlin/String|) -> {
|
||||
R|<local>/b|.R|kotlin/String.length|
|
||||
this@R|/anonymous|.R|/anonymous.bar|()
|
||||
this@R|/<anonymous>|.R|/<anonymous>.bar|()
|
||||
}
|
||||
else -> {
|
||||
Int(1)
|
||||
@@ -356,7 +356,7 @@ digraph localClassesWithImplicit_kt {
|
||||
122 [label="Access variable R|kotlin/String.length|"];
|
||||
123 [label="Access variable R|<local>/b|"];
|
||||
124 [label="Access variable <Unresolved name: length>#"];
|
||||
125 [label="Function call: this@R|/anonymous|.R|/anonymous.baz|()"];
|
||||
125 [label="Function call: this@R|/<anonymous>|.R|/<anonymous>.baz|()"];
|
||||
120 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
115 [label="Postponed exit from lambda"];
|
||||
@@ -364,7 +364,7 @@ digraph localClassesWithImplicit_kt {
|
||||
117 [label="Jump: ^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <kind=UNKNOWN> {
|
||||
R|<local>/a|.R|kotlin/String.length|
|
||||
R|<local>/b|.<Unresolved name: length>#
|
||||
^ this@R|/anonymous|.R|/anonymous.baz|()
|
||||
^ this@R|/<anonymous>|.R|/<anonymous>.baz|()
|
||||
}
|
||||
)"];
|
||||
118 [label="Stub" style="filled" fillcolor=gray];
|
||||
|
||||
@@ -46,8 +46,8 @@ FILE: localClassesWithImplicit.kt
|
||||
|
||||
}
|
||||
|
||||
lval x: R|anonymous| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval x: R|<anonymous>| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ FILE: localClassesWithImplicit.kt
|
||||
^ when () {
|
||||
(R|<local>/b| is R|kotlin/String|) -> {
|
||||
R|<local>/b|.R|kotlin/String.length|
|
||||
this@R|/anonymous|.R|/anonymous.bar|()
|
||||
this@R|/<anonymous>|.R|/<anonymous>.bar|()
|
||||
}
|
||||
else -> {
|
||||
Int(1)
|
||||
@@ -72,7 +72,7 @@ FILE: localClassesWithImplicit.kt
|
||||
^bar R|/myRun|<R|kotlin/Int|>(<L> = myRun@fun <anonymous>(): R|kotlin/Int| <kind=UNKNOWN> {
|
||||
R|<local>/a|.R|kotlin/String.length|
|
||||
R|<local>/b|.<Unresolved name: length>#
|
||||
^ this@R|/anonymous|.R|/anonymous.baz|()
|
||||
^ this@R|/<anonymous>|.R|/<anonymous>.baz|()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ FILE: enum.kt
|
||||
public get(): R|Some|
|
||||
|
||||
public final static enum entry FIRST: R|SomeEnum| = object : R|SomeEnum| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|SomeEnum|>(Q|O1|)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ FILE: enum.kt
|
||||
}
|
||||
|
||||
public final static enum entry SECOND: R|SomeEnum| = object : R|SomeEnum| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|SomeEnum|>(Q|O2|)
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ FILE: enum.kt
|
||||
}
|
||||
|
||||
public final static enum entry E1: R|EnumClass| = object : R|EnumClass| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|EnumClass|>()
|
||||
}
|
||||
|
||||
@@ -85,14 +85,14 @@ FILE: enum.kt
|
||||
}
|
||||
|
||||
public final static enum entry E2: R|EnumClass| = object : R|EnumClass| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|EnumClass|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry E3: R|EnumClass| = object : R|EnumClass| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|EnumClass|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ FILE: CallBasedInExpressionGenerator.kt
|
||||
private get(): R|kotlin/Boolean|
|
||||
|
||||
public final override fun generate(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
|
||||
^generate R?C|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.gen|(R|<local>/argument|).<Inapplicable(WRONG_RECEIVER): [kotlin/let]>#(<L> = let@fun <anonymous>(): R|ERROR CLASS: Can't resolve when expression| {
|
||||
^generate this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.gen|(R|<local>/argument|).<Inapplicable(WRONG_RECEIVER): [kotlin/let]>#(<L> = let@fun <anonymous>(): <ERROR TYPE REF: Can't resolve when expression> {
|
||||
^ when () {
|
||||
this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.isInverted| -> {
|
||||
<Unresolved name: Invert>#(<Unresolved name: it>#)
|
||||
@@ -30,17 +30,17 @@ FILE: CallBasedInExpressionGenerator.kt
|
||||
|
||||
private final fun gen(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
|
||||
^gen object : R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|ERROR CLASS: Symbol not found, for `BranchedValue`|>(R|<local>/argument|, Null(null), R|<local>/argument|.<Unresolved name: type>#, <Unresolved name: Opcodes>#.<Unresolved name: IFEQ>#)
|
||||
}
|
||||
|
||||
public[local] final override fun putSelector(type: R|ERROR CLASS: Symbol not found, for `Type`|, kotlinType: R|ERROR CLASS: Symbol not found, for `KotlinType?`|, v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|): R|kotlin/Unit| {
|
||||
this@R|/anonymous|.R|/anonymous.invokeFunction|(R|<local>/v|)
|
||||
this@R|/<anonymous>|.R|/<anonymous>.invokeFunction|(R|<local>/v|)
|
||||
<Unresolved name: coerceTo>#(R|<local>/type|, R|<local>/kotlinType|, R|<local>/v|)
|
||||
}
|
||||
|
||||
public[local] final override fun condJump(jumpLabel: R|ERROR CLASS: Symbol not found, for `Label`|, v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|, jumpIfFalse: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
this@R|/anonymous|.R|/anonymous.invokeFunction|(R|<local>/v|)
|
||||
this@R|/<anonymous>|.R|/<anonymous>.invokeFunction|(R|<local>/v|)
|
||||
R|<local>/v|.<Unresolved name: visitJumpInsn>#(when () {
|
||||
R|<local>/jumpIfFalse| -> {
|
||||
<Unresolved name: Opcodes>#.<Unresolved name: IFEQ>#
|
||||
|
||||
@@ -7,7 +7,7 @@ FILE: enumEntryUse.kt
|
||||
public final static enum entry FIRST: R|TestEnum|
|
||||
public final static enum entry SECOND: R|TestEnum|
|
||||
public final static enum entry THIRD: R|TestEnum| = object : R|TestEnum| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|TestEnum|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@ FILE: typeParameters2.kt
|
||||
^foo R|<local>/t|
|
||||
}
|
||||
public final fun main(fooImpl: R|FooImpl|, fooBarImpl: R|FooBarImpl|): R|kotlin/Unit| {
|
||||
lval a: <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/foo]> = <Inapplicable(INAPPLICABLE): [/foo]>#<R|FooImpl|>(R|<local>/fooBarImpl|)
|
||||
lval a: <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/foo]> = <Inapplicable(INAPPLICABLE): [/foo]>#(R|<local>/fooBarImpl|)
|
||||
lval b: R|Foo| = R|/foo|<R|Foo|>(R|<local>/fooImpl|)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
FILE: localImplicitBodies.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lval x: R|anonymous| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval x: R|<anonymous>| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public[local] final fun sss(): R|kotlin/Int| {
|
||||
^sss this@R|/anonymous|.R|/anonymous.abc|()
|
||||
^sss this@R|/<anonymous>|.R|/<anonymous>.abc|()
|
||||
}
|
||||
|
||||
public[local] final fun abc(): R|kotlin/Int| {
|
||||
@@ -15,5 +15,5 @@ FILE: localImplicitBodies.kt
|
||||
|
||||
}
|
||||
|
||||
lval g: R|kotlin/Int| = R|<local>/x|.R|/anonymous.sss|()
|
||||
lval g: R|kotlin/Int| = R|<local>/x|.R|/<anonymous>.sss|()
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ FILE: localInnerClass.kt
|
||||
}
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
object : R|Foo| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public[local] final fun foo(): R|Foo| {
|
||||
^foo this@R|/anonymous|.R|/<anonymous>.Derived.Derived|(Int(42))
|
||||
^foo this@R|/<anonymous>|.R|/<anonymous>.Derived.Derived|(Int(42))
|
||||
}
|
||||
|
||||
local final inner class Derived : R|Foo| {
|
||||
|
||||
@@ -20,8 +20,8 @@ FILE: localObjects.kt
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
Q|A|.R|/A.x|
|
||||
lval b: R|anonymous| = object : R|Foo| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval b: R|<anonymous>| = object : R|Foo| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Foo|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ FILE: localScopes.kt
|
||||
lval base: R|BaseLocal| = R|/BaseLocal.BaseLocal|()
|
||||
R|<local>/base|.R|/BaseLocal.baz|()
|
||||
R|<local>/base|.R|/Bar.foo|()
|
||||
lval anonymous: R|anonymous| = object : R|Bar| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval anonymous: R|<anonymous>| = object : R|Bar| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Bar|>()
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ FILE: localScopes.kt
|
||||
|
||||
}
|
||||
|
||||
R|<local>/anonymous|.R|/anonymous.baz|()
|
||||
R|<local>/anonymous|.R|/<anonymous>.baz|()
|
||||
R|<local>/anonymous|.R|/Bar.foo|()
|
||||
local final class DerivedLocal : R|BaseLocal| {
|
||||
public[local] constructor(): R|DerivedLocal| {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FILE: foo.kt
|
||||
public final fun foo(): R|kotlin/Boolean| {
|
||||
object : R|Node<kotlin/Boolean>| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ FILE: foo.kt
|
||||
private set(value: R|kotlin/Boolean|): R|kotlin/Unit|
|
||||
|
||||
public[local] final fun bar(): R|kotlin/Boolean| {
|
||||
^bar this@R|/anonymous|.R|/anonymous.result|.R|kotlin/Boolean.not|()
|
||||
^bar this@R|/<anonymous>|.R|/<anonymous>.result|.R|kotlin/Boolean.not|()
|
||||
}
|
||||
|
||||
public[local] final override fun result(): R|kotlin/Boolean| {
|
||||
^result this@R|/anonymous|.R|/anonymous.result|
|
||||
^result this@R|/<anonymous>|.R|/<anonymous>.result|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ FILE: O.kt
|
||||
|
||||
public[private] final fun test(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Int| = this@R|/O.Derived|.R|/O.Derived.bar|
|
||||
lval o: R|anonymous| = object : R|Wrapper| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval o: R|<anonymous>| = object : R|Wrapper| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Wrapper|>(this@R|/O.Derived.Some|.R|/O.Derived.Some.z|)
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ FILE: O.kt
|
||||
lval y: R|ft<kotlin/String, kotlin/String?>!| = this@R|/O.Derived|.R|/Base.foo|()
|
||||
}
|
||||
|
||||
public[local] final val oo: R|anonymous| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
public[local] final val oo: R|<anonymous>| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ FILE: O.kt
|
||||
|
||||
}
|
||||
|
||||
public get(): R|anonymous|
|
||||
public get(): R|<anonymous>|
|
||||
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ FILE: O.kt
|
||||
|
||||
public[private] final fun test(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Int| = this@R|/O.Derived|.R|/O.Derived.bar|
|
||||
lval o: R|anonymous| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval o: R|<anonymous>| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ FILE: O.kt
|
||||
|
||||
private final fun gen(): R|kotlin/Any| {
|
||||
^gen object : R|Wrapper| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Wrapper|>(Boolean(true))
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ FILE: privateObjectLiteral.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
private final val x: R|anonymous| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private final val x: R|<anonymous>| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ FILE: privateObjectLiteral.kt
|
||||
|
||||
}
|
||||
|
||||
private get(): R|anonymous|
|
||||
private get(): R|<anonymous>|
|
||||
|
||||
public final val y: R|kotlin/Int| = this@R|/C|.R|/C.x|.R|/anonymous.foo|()
|
||||
public final val y: R|kotlin/Int| = this@R|/C|.R|/C.x|.R|/<anonymous>.foo|()
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
internal final val z: R|anonymous| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
internal final val z: R|<anonymous>| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ FILE: privateObjectLiteral.kt
|
||||
|
||||
}
|
||||
|
||||
internal get(): R|anonymous|
|
||||
internal get(): R|<anonymous>|
|
||||
|
||||
public final val w: R|kotlin/Int| = this@R|/C|.R|/C.z|.R|/anonymous.foo|()
|
||||
public final val w: R|kotlin/Int| = this@R|/C|.R|/C.z|.R|/<anonymous>.foo|()
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ FILE: enums.kt
|
||||
internal get(): R|kotlin/Double|
|
||||
|
||||
public final static enum entry MERCURY: R|Planet| = object : R|Planet| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Planet|>(Double(1.0), Double(2.0))
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ FILE: enums.kt
|
||||
}
|
||||
|
||||
public final static enum entry VENERA: R|Planet| = object : R|Planet| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Planet|>(Double(3.0), Double(4.0))
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ FILE: enums.kt
|
||||
}
|
||||
|
||||
public final static enum entry EARTH: R|Planet| = object : R|Planet| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Planet|>(Double(5.0), Double(6.0))
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ FILE: lambdaArgInScopeFunction.kt
|
||||
}
|
||||
) }
|
||||
R|<local>/lambda|.R|tests/_checkType/checkType|<R|() -> KotlinClass|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function0<KotlinClass>?>|.<anonymous>(): R|kotlin/Unit| {
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Unit) -> KotlinClass?|>()
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -50,7 +50,7 @@ FILE: lambdaArgInScopeFunction.kt
|
||||
}
|
||||
)
|
||||
R|<local>/lambda|.R|tests/_checkType/checkType|<R|() -> KotlinClass|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function0<KotlinClass>>|.<anonymous>(): R|kotlin/Unit| {
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Unit) -> KotlinClass?|>()
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ FILE: KotlinClass.kt
|
||||
}
|
||||
)
|
||||
R|<local>/invalidType|.R|tests/_checkType/checkType|<R|(JavaClass) -> kotlin/Boolean|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function1<JavaClass, kotlin/Boolean>>|.<anonymous>(): R|kotlin/Unit| {
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Nothing) -> kotlin/Boolean|>()
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
|
||||
}
|
||||
)
|
||||
R|/Case1.Case1|(R|<local>/javaClass|).R|/Case1.x|.R|tests/_checkType/checkType|<R|(KotlinClass) -> kotlin/Boolean|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function1<KotlinClass, kotlin/Boolean>>|.<anonymous>(): R|kotlin/Unit| {
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Nothing) -> kotlin/Boolean|>()
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -122,11 +122,11 @@ FILE: KotlinClass.kt
|
||||
}
|
||||
)
|
||||
R|<local>/invalidType|.R|tests/_checkType/checkType|<R|(KotlinClass) -> kotlin/Boolean|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function1<KotlinClass, kotlin/Boolean>>|.<anonymous>(): R|kotlin/Unit| {
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Nothing) -> kotlin/Boolean|>()
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
|
||||
}
|
||||
)
|
||||
R|/Case2.Case2|(R|<local>/kotlinClass|).R|/Case2.x|.R|tests/_checkType/checkType|<R|(KotlinClass) -> kotlin/Boolean|>(<L> = checkType@fun R|tests/_checkType/Inv<kotlin/Function1<KotlinClass, kotlin/Boolean>>|.<anonymous>(): R|kotlin/Unit| {
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#<R|(kotlin/Nothing) -> kotlin/Boolean|>()
|
||||
^ <Inapplicable(WRONG_RECEIVER): [tests/_checkType/_]>#()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
FILE: implicitInAnonymous.kt
|
||||
private final val x: R|anonymous| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private final val x: R|<anonymous>| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public[local] final fun foo(x: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^foo this@R|/anonymous|.R|/anonymous.bar|(R|<local>/x|)
|
||||
^foo this@R|/<anonymous>|.R|/<anonymous>.bar|(R|<local>/x|)
|
||||
}
|
||||
|
||||
public[local] final fun bar(y: R|kotlin/Int|): R|kotlin/Boolean| {
|
||||
^bar CMP(>, this@R|/anonymous|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
|
||||
^bar CMP(>, this@R|/<anonymous>|.R|kotlin/Any.hashCode|().R|kotlin/Int.plus|(R|<local>/y|).R|kotlin/Int.compareTo|(Int(0)))
|
||||
}
|
||||
|
||||
public[local] final val w: R|kotlin/Boolean|
|
||||
public get(): R|kotlin/Boolean| {
|
||||
^ this@R|/anonymous|.R|/anonymous.z|
|
||||
^ this@R|/<anonymous>|.R|/<anonymous>.z|
|
||||
}
|
||||
|
||||
public[local] final val z: R|kotlin/Boolean|
|
||||
public get(): R|kotlin/Boolean| {
|
||||
^ ==(this@R|/anonymous|.R|kotlin/Any.hashCode|(), Int(0))
|
||||
^ ==(this@R|/<anonymous>|.R|kotlin/Any.hashCode|(), Int(0))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private get(): R|anonymous|
|
||||
private get(): R|<anonymous>|
|
||||
public final fun useBoolean(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/useBoolean|(R|/x|.R|/anonymous.foo|(Int(1)))
|
||||
R|/useBoolean|(R|/x|.R|/anonymous.bar|(Int(2)))
|
||||
R|/useBoolean|(R|/x|.R|/anonymous.w|)
|
||||
R|/useBoolean|(R|/x|.R|/anonymous.z|)
|
||||
R|/useBoolean|(R|/x|.R|/<anonymous>.foo|(Int(1)))
|
||||
R|/useBoolean|(R|/x|.R|/<anonymous>.bar|(Int(2)))
|
||||
R|/useBoolean|(R|/x|.R|/<anonymous>.w|)
|
||||
R|/useBoolean|(R|/x|.R|/<anonymous>.z|)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ FILE: typesFromSuperClasses.kt
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
object : R|Outer| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Outer|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ FILE: localObject.kt
|
||||
}
|
||||
public final fun tesLambda(x: R|kotlin/Int|): R|kotlin/Int| {
|
||||
^tesLambda R|/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| {
|
||||
lval obj: R|anonymous| = object : R|Foo| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval obj: R|<anonymous>| = object : R|Foo| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ FILE: localObject.kt
|
||||
public final var x: R|kotlin/Int| = Int(1)
|
||||
public get(): R|kotlin/Int|
|
||||
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
lval obj: R|anonymous| = object : R|Foo| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval obj: R|<anonymous>| = object : R|Foo| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ FILE: localObject.kt
|
||||
|
||||
public final val y: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
lval obj: R|anonymous| = object : R|Foo| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval obj: R|<anonymous>| = object : R|Foo| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ FILE: localObject.kt
|
||||
}
|
||||
|
||||
public final val z: R|kotlin/Int| = this@R|/TestProperty|.R|kotlin/run|<R|TestProperty|, R|kotlin/Int|>(<L> = run@fun R|TestProperty|.<anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
lval obj: R|anonymous| = object : R|Foo| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval obj: R|<anonymous>| = object : R|Foo| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
FILE: objectInnerClass.kt
|
||||
public final val case1: R|anonymous| = object : R|A| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
public final val case1: R|<anonymous>| = object : R|A| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final inner class Child : R|<anonymous>.Base| {
|
||||
public[local] constructor(property: R|B|): R|<anonymous>.Child| {
|
||||
this@R|/anonymous|.super<R|<anonymous>.Base|>(R|<local>/property|)
|
||||
this@R|/<anonymous>|.super<R|<anonymous>.Base|>(R|<local>/property|)
|
||||
}
|
||||
|
||||
public[local] final fun R|<anonymous>.Base|.zoo(): R|kotlin/Unit| {
|
||||
@@ -17,17 +17,17 @@ FILE: objectInnerClass.kt
|
||||
this@R|/<anonymous>.Child|.R|/<anonymous>.Base.baseFun|()
|
||||
lval x: R|B| = this@R|/<anonymous>.Child|.R|/<anonymous>.Base.property|
|
||||
(this@R|/<anonymous>.Child|, this@R|/<anonymous>.Child|).R|/<anonymous>.Child.zoo|()
|
||||
(this@R|/anonymous|, this@R|/<anonymous>.Child|).R|/anonymous.hoo|()
|
||||
(this@R|/<anonymous>|, this@R|/<anonymous>.Child|).R|/<anonymous>.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public[local] final fun R|<anonymous>.Child|.voo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/anonymous.voo|.R|/<anonymous>.Base.property|
|
||||
lval x: R|B| = this@R|/<anonymous>.voo|.R|/<anonymous>.Base.property|
|
||||
}
|
||||
|
||||
public[local] final fun R|<anonymous>.Base|.hoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/anonymous.hoo|.R|/<anonymous>.Base.property|
|
||||
lval x: R|B| = this@R|/<anonymous>.hoo|.R|/<anonymous>.Base.property|
|
||||
}
|
||||
|
||||
local open inner class Base : R|kotlin/Any| {
|
||||
@@ -44,48 +44,48 @@ FILE: objectInnerClass.kt
|
||||
}
|
||||
|
||||
public[local] final fun caseForBase(): R|kotlin/Unit| {
|
||||
lval base: R|<anonymous>.Base| = this@R|/anonymous|.R|/<anonymous>.Base.Base|(R|/B.B|())
|
||||
lval base: R|<anonymous>.Base| = this@R|/<anonymous>|.R|/<anonymous>.Base.Base|(R|/B.B|())
|
||||
R|<local>/base|.R|/<anonymous>.Base.baseFun|()
|
||||
R|<local>/base|.R|/<anonymous>.Base.property|
|
||||
(this@R|/anonymous|, R|<local>/base|).R|/anonymous.hoo|()
|
||||
(this@R|/<anonymous>|, R|<local>/base|).R|/<anonymous>.hoo|()
|
||||
}
|
||||
|
||||
public[local] final fun caseForChild(): R|kotlin/Unit| {
|
||||
lval child: R|<anonymous>.Child| = this@R|/anonymous|.R|/<anonymous>.Child.Child|(R|/B.B|())
|
||||
lval child: R|<anonymous>.Child| = this@R|/<anonymous>|.R|/<anonymous>.Child.Child|(R|/B.B|())
|
||||
R|<local>/child|.R|/<anonymous>.Base.baseFun|()
|
||||
R|<local>/child|.R|/<anonymous>.Base.property|
|
||||
R|<local>/child|.R|/<anonymous>.Child.foo|()
|
||||
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.hoo|()
|
||||
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.voo|()
|
||||
(this@R|/<anonymous>|, R|<local>/child|).R|/<anonymous>.hoo|()
|
||||
(this@R|/<anonymous>|, R|<local>/child|).R|/<anonymous>.voo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public get(): R|anonymous|
|
||||
public get(): R|<anonymous>|
|
||||
public final class Case2 : R|kotlin/Any| {
|
||||
public constructor(): R|Case2| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|anonymous| = object : R|Case2.Base| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
public final val x: R|<anonymous>| = object : R|Case2.Base| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
this@R|/Case2|.super<R|Case2.Base|>(R|/B.B|())
|
||||
}
|
||||
|
||||
public[local] final fun R|Case2.Base|.zoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/anonymous.zoo|.R|/Case2.Base.property|
|
||||
lval x: R|B| = this@R|/<anonymous>.zoo|.R|/Case2.Base.property|
|
||||
}
|
||||
|
||||
public[local] final fun foo(): R|kotlin/Unit| {
|
||||
this@R|/anonymous|.R|/Case2.Base.baseFun|()
|
||||
lval x: R|B| = this@R|/anonymous|.R|/Case2.Base.property|
|
||||
(this@R|/anonymous|, this@R|/anonymous|).R|/anonymous.zoo|()
|
||||
(this@R|/Case2|, this@R|/anonymous|).R|/Case2.hoo|()
|
||||
this@R|/<anonymous>|.R|/Case2.Base.baseFun|()
|
||||
lval x: R|B| = this@R|/<anonymous>|.R|/Case2.Base.property|
|
||||
(this@R|/<anonymous>|, this@R|/<anonymous>|).R|/<anonymous>.zoo|()
|
||||
(this@R|/Case2|, this@R|/<anonymous>|).R|/Case2.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public get(): R|anonymous|
|
||||
public get(): R|<anonymous>|
|
||||
|
||||
public final fun R|Case2.Base|.hoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/Case2.hoo|.R|/Case2.Base.property|
|
||||
@@ -112,7 +112,7 @@ FILE: objectInnerClass.kt
|
||||
}
|
||||
|
||||
public final fun caseForChild(): R|kotlin/Unit| {
|
||||
lval child: R|anonymous| = this@R|/Case2|.R|/Case2.x|
|
||||
lval child: R|<anonymous>| = this@R|/Case2|.R|/Case2.x|
|
||||
R|<local>/child|.R|/Case2.Base.baseFun|()
|
||||
R|<local>/child|.R|/Case2.Base.property|
|
||||
(this@R|/Case2|, R|<local>/child|).R|/Case2.hoo|()
|
||||
@@ -124,14 +124,14 @@ FILE: objectInnerClass.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|anonymous| = object : R|A| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
public final val x: R|<anonymous>| = object : R|A| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
local final inner class Child : R|Case3.<anonymous>.Base| {
|
||||
public[local] constructor(property: R|B|): R|Case3.<anonymous>.Child| {
|
||||
this@R|/anonymous|.super<R|Case3.<anonymous>.Base|>(R|<local>/property|)
|
||||
this@R|/<anonymous>|.super<R|Case3.<anonymous>.Base|>(R|<local>/property|)
|
||||
}
|
||||
|
||||
public[local] final fun R|Case3.<anonymous>.Base|.zoo(): R|kotlin/Unit| {
|
||||
@@ -142,17 +142,17 @@ FILE: objectInnerClass.kt
|
||||
this@R|/Case3.<anonymous>.Child|.R|/Case3.<anonymous>.Base.baseFun|()
|
||||
lval x: R|B| = this@R|/Case3.<anonymous>.Child|.R|/Case3.<anonymous>.Base.property|
|
||||
(this@R|/Case3.<anonymous>.Child|, this@R|/Case3.<anonymous>.Child|).R|/Case3.<anonymous>.Child.zoo|()
|
||||
(this@R|/anonymous|, this@R|/Case3.<anonymous>.Child|).R|/anonymous.hoo|()
|
||||
(this@R|/<anonymous>|, this@R|/Case3.<anonymous>.Child|).R|/<anonymous>.hoo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public[local] final fun R|Case3.<anonymous>.Child|.voo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/anonymous.voo|.R|/Case3.<anonymous>.Base.property|
|
||||
lval x: R|B| = this@R|/<anonymous>.voo|.R|/Case3.<anonymous>.Base.property|
|
||||
}
|
||||
|
||||
public[local] final fun R|Case3.<anonymous>.Base|.hoo(): R|kotlin/Unit| {
|
||||
lval x: R|B| = this@R|/anonymous.hoo|.R|/Case3.<anonymous>.Base.property|
|
||||
lval x: R|B| = this@R|/<anonymous>.hoo|.R|/Case3.<anonymous>.Base.property|
|
||||
}
|
||||
|
||||
local open inner class Base : R|kotlin/Any| {
|
||||
@@ -169,24 +169,24 @@ FILE: objectInnerClass.kt
|
||||
}
|
||||
|
||||
public[local] final fun caseForBase(): R|kotlin/Unit| {
|
||||
lval base: R|Case3.<anonymous>.Base| = this@R|/anonymous|.R|/Case3.<anonymous>.Base.Base|(R|/B.B|())
|
||||
lval base: R|Case3.<anonymous>.Base| = this@R|/<anonymous>|.R|/Case3.<anonymous>.Base.Base|(R|/B.B|())
|
||||
R|<local>/base|.R|/Case3.<anonymous>.Base.baseFun|()
|
||||
R|<local>/base|.R|/Case3.<anonymous>.Base.property|
|
||||
(this@R|/anonymous|, R|<local>/base|).R|/anonymous.hoo|()
|
||||
(this@R|/<anonymous>|, R|<local>/base|).R|/<anonymous>.hoo|()
|
||||
}
|
||||
|
||||
public[local] final fun caseForChild(): R|kotlin/Unit| {
|
||||
lval child: R|Case3.<anonymous>.Child| = this@R|/anonymous|.R|/Case3.<anonymous>.Child.Child|(R|/B.B|())
|
||||
lval child: R|Case3.<anonymous>.Child| = this@R|/<anonymous>|.R|/Case3.<anonymous>.Child.Child|(R|/B.B|())
|
||||
R|<local>/child|.R|/Case3.<anonymous>.Base.baseFun|()
|
||||
R|<local>/child|.R|/Case3.<anonymous>.Base.property|
|
||||
R|<local>/child|.R|/Case3.<anonymous>.Child.foo|()
|
||||
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.hoo|()
|
||||
(this@R|/anonymous|, R|<local>/child|).R|/anonymous.voo|()
|
||||
(this@R|/<anonymous>|, R|<local>/child|).R|/<anonymous>.hoo|()
|
||||
(this@R|/<anonymous>|, R|<local>/child|).R|/<anonymous>.voo|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public get(): R|anonymous|
|
||||
public get(): R|<anonymous>|
|
||||
|
||||
}
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
|
||||
@@ -13,8 +13,8 @@ FILE: objectDerivedFromInnerClass.kt
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval x: R|anonymous| = object : R|Outer.Inner| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval x: R|<anonymous>| = object : R|Outer.Inner| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|Outer.Inner|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -38,12 +38,12 @@ FILE: kotlinSam.kt
|
||||
}
|
||||
)
|
||||
R|/foo1|(R|<local>/f|)
|
||||
<Inapplicable(INAPPLICABLE): [/foo2]>#(<L> = foo2@fun <anonymous>(x: R|ERROR CLASS: No type for parameter|): R|kotlin/Boolean| {
|
||||
<Inapplicable(INAPPLICABLE): [/foo2]>#(<L> = foo2@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/x|.<Unresolved name: compareTo>#(Int(1)))
|
||||
}
|
||||
)
|
||||
<Inapplicable(INAPPLICABLE): [/foo2]>#(R|<local>/f|)
|
||||
<Inapplicable(INAPPLICABLE): [/foo3]>#(<L> = foo3@fun <anonymous>(x: R|ERROR CLASS: No type for parameter|): R|kotlin/Boolean| {
|
||||
<Inapplicable(INAPPLICABLE): [/foo3]>#(<L> = foo3@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
|
||||
^ 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|ERROR CLASS: No type for parameter|): R|kotlin/Boolean| {
|
||||
Q|JavaUsage|.<Inapplicable(INAPPLICABLE): [/JavaUsage.foo]>#(<L> = foo@fun <anonymous>(x: R|kotlin/Nothing|): R|kotlin/Boolean| {
|
||||
^ CMP(>, R|<local>/x|.<Unresolved name: compareTo>#(Int(1)))
|
||||
}
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@ FILE: sealedClass.kt
|
||||
}
|
||||
public final object Second : R|WithPrivateConstructor| {
|
||||
private constructor(): R|Second| {
|
||||
super<R|WithPrivateConstructor|>(IntegerLiteral(0))
|
||||
super<R|WithPrivateConstructor|>(Int(0))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
17
compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/boundSafeCallAndIsCheck.kt
vendored
Normal file
17
compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/boundSafeCallAndIsCheck.kt
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
interface A {
|
||||
val b: B
|
||||
}
|
||||
|
||||
interface B
|
||||
interface C : B {
|
||||
fun q(): Boolean
|
||||
}
|
||||
|
||||
fun A.foo(): String = ""
|
||||
|
||||
fun main(a: A?) {
|
||||
val lb = a?.b
|
||||
if (lb !is C) return
|
||||
|
||||
a.foo().length
|
||||
}
|
||||
25
compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/boundSafeCallAndIsCheck.txt
vendored
Normal file
25
compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/boundSafeCallAndIsCheck.txt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
FILE: boundSafeCallAndIsCheck.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
public abstract val b: R|B|
|
||||
public get(): R|B|
|
||||
|
||||
}
|
||||
public abstract interface B : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface C : R|B| {
|
||||
public abstract fun q(): R|kotlin/Boolean|
|
||||
|
||||
}
|
||||
public final fun R|A|.foo(): R|kotlin/String| {
|
||||
^foo String()
|
||||
}
|
||||
public final fun main(a: R|A?|): R|kotlin/Unit| {
|
||||
lval lb: R|B?| = R|<local>/a|?.{ $subj$.R|/A.b| }
|
||||
when () {
|
||||
(R|<local>/lb| !is R|C|) -> {
|
||||
^main Unit
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/a|.R|/foo|().R|kotlin/String.length|
|
||||
}
|
||||
14
compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.kt
vendored
Normal file
14
compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.kt
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
sealed class A<out T> {
|
||||
class B<out T1>(val x: T1) : A<T1>()
|
||||
class C<out T2>(val y: T2) : A<T2>()
|
||||
}
|
||||
|
||||
typealias TA = A<CharSequence>
|
||||
|
||||
fun bar(): TA = TODO()
|
||||
|
||||
fun foo() {
|
||||
when (val a = bar()) {
|
||||
is A.B -> a.x.length
|
||||
}
|
||||
}
|
||||
39
compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.txt
vendored
Normal file
39
compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.txt
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
FILE: bareWithSubjectTypeAlias.kt
|
||||
public sealed class A<out T> : R|kotlin/Any| {
|
||||
private constructor<out T>(): R|A<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final class B<out T1> : R|A<T1>| {
|
||||
public constructor<out T1>(x: R|T1|): R|A.B<T1>| {
|
||||
super<R|A<T1>|>()
|
||||
}
|
||||
|
||||
public final val x: R|T1| = R|<local>/x|
|
||||
public get(): R|T1|
|
||||
|
||||
}
|
||||
|
||||
public final class C<out T2> : R|A<T2>| {
|
||||
public constructor<out T2>(y: R|T2|): R|A.C<T2>| {
|
||||
super<R|A<T2>|>()
|
||||
}
|
||||
|
||||
public final val y: R|T2| = R|<local>/y|
|
||||
public get(): R|T2|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final typealias TA = R|A<kotlin/CharSequence>|
|
||||
public final fun bar(): R|TA| {
|
||||
^bar R|kotlin/TODO|()
|
||||
}
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
when (lval a: R|TA| = R|/bar|()) {
|
||||
($subj$ is R|A.B<kotlin/CharSequence>|) -> {
|
||||
R|<local>/a|.R|FakeOverride</A.B.x: R|kotlin/CharSequence|>|.R|kotlin/CharSequence.length|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,7 +51,7 @@ FILE: singletonConstructors.kt
|
||||
}
|
||||
|
||||
public final static enum entry X: R|E| = object : R|E| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|E|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -12,5 +12,5 @@ FILE: implicitTypes.kt
|
||||
^loop1 <Inapplicable(INAPPLICABLE): [/use]>#(::R|/loop2|)
|
||||
}
|
||||
public final fun loop2(): <ERROR TYPE REF: cycle> {
|
||||
^loop2 R?C|/loop1|()
|
||||
^loop2 R|/loop1|()
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ FILE: anonymousInDelegate.kt
|
||||
|
||||
}
|
||||
public final val x: R|kotlin/Int|by R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| {
|
||||
lval foo: R|anonymous| = object : R|Foo| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
lval foo: R|<anonymous>| = object : R|Foo| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ FILE: anonymousInDelegate.kt
|
||||
|
||||
}
|
||||
|
||||
^ R|<local>/foo|.R|/anonymous.bar|()
|
||||
^ R|<local>/foo|.R|/<anonymous>.bar|()
|
||||
}
|
||||
)
|
||||
public get(): R|kotlin/Int| {
|
||||
|
||||
@@ -117,7 +117,7 @@ digraph delegateWithAnonymousObject_kt {
|
||||
|
||||
subgraph cluster_11 {
|
||||
color=red
|
||||
66 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
|
||||
64 [label="Enter class IssuesListUserProfile" style="filled" fillcolor=red];
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
48 [label="Enter function setter" style="filled" fillcolor=red];
|
||||
@@ -144,36 +144,32 @@ digraph delegateWithAnonymousObject_kt {
|
||||
57 [label="Postponed exit from lambda"];
|
||||
58 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
|
||||
59 [label="Access variable this@R|/IssuesListUserProfile|"];
|
||||
60 [label="Access variable this@R|/IssuesListUserProfile|"];
|
||||
61 [label="Access variable this@R|/IssuesListUserProfile|"];
|
||||
62 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).<Unresolved name: provideDelegate>#(...)"];
|
||||
63 [label="Postponed enter to lambda"];
|
||||
60 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...).<Unresolved name: provideDelegate>#(...)"];
|
||||
61 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
21 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
23 [label="Exit anonymous object"];
|
||||
22 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
64 [label="Postponed exit from lambda"];
|
||||
65 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
|
||||
62 [label="Postponed exit from lambda"];
|
||||
63 [label="Function call: this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(...)"];
|
||||
55 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
67 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
|
||||
65 [label="Exit class IssuesListUserProfile" style="filled" fillcolor=red];
|
||||
}
|
||||
66 -> {54} [color=green];
|
||||
64 -> {54} [color=green];
|
||||
54 -> {56};
|
||||
55 -> {67} [color=green];
|
||||
55 -> {65} [color=green];
|
||||
56 -> {57};
|
||||
57 -> {58};
|
||||
58 -> {59};
|
||||
59 -> {60};
|
||||
60 -> {61};
|
||||
61 -> {62};
|
||||
61 -> {21} [color=red];
|
||||
62 -> {63};
|
||||
63 -> {64};
|
||||
63 -> {21} [color=red];
|
||||
64 -> {65};
|
||||
65 -> {55};
|
||||
63 -> {55};
|
||||
21 -> {23};
|
||||
21 -> {24 27 32} [color=red];
|
||||
23 -> {22};
|
||||
|
||||
@@ -24,7 +24,7 @@ FILE: delegateWithAnonymousObject.kt
|
||||
|
||||
public final var issueListView: R|IssueListView|by this@R|/IssuesListUserProfile|.R|/delegate|<R|IssuesListUserProfile|, R|IssuesListUserProfile|, R|IssueListView|>(<L> = delegate@fun <anonymous>(): R|kotlin/properties/ReadWriteProperty<IssuesListUserProfile, IssueListView>| {
|
||||
^ object : R|kotlin/properties/ReadWriteProperty<IssuesListUserProfile, IssueListView>| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -7,19 +7,19 @@ FILE: simpleDelegatedToMap.kt
|
||||
public final val map: R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>| = R|<local>/map|
|
||||
public get(): R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>|
|
||||
|
||||
public final var foo: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|<local>/map|
|
||||
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||
public final var foo: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|by R|<local>/map|
|
||||
public get(): R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]| {
|
||||
^ this@R|/C|.D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
|
||||
}
|
||||
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
||||
public set(<set-?>: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|): R|kotlin/Unit| {
|
||||
this@R|/C|.D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||
}
|
||||
|
||||
}
|
||||
public final var bar: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
||||
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||
public final var bar: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
||||
public get(): R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]| {
|
||||
^ D|/bar|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(Null(null), ::R|/bar|)
|
||||
}
|
||||
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
||||
public set(<set-?>: R|ERROR CLASS: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]|): R|kotlin/Unit| {
|
||||
D|/bar|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(Null(null), ::R|/bar|, R|<local>/bar|)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
FILE: problems.kt
|
||||
public final val sb: R|java/lang/StringBuilder| = R|java/lang/StringBuilder.StringBuilder|()
|
||||
public get(): R|java/lang/StringBuilder|
|
||||
public final val o: R|anonymous| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|anonymous| {
|
||||
public final val o: R|<anonymous>| = object : R|kotlin/Any| {
|
||||
private[local] constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@ FILE: problems.kt
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public[local] final fun test(): R|kotlin/Unit| {
|
||||
this@R|/anonymous|.R|/anonymous.name|
|
||||
this@R|/<anonymous>|.R|/<anonymous>.name|
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public get(): R|anonymous|
|
||||
public get(): R|<anonymous>|
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
local final class Local : R|kotlin/Any| {
|
||||
public[local] constructor(): R|Local| {
|
||||
|
||||
@@ -614,6 +614,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/debugInfoCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("errorCandidates.kt")
|
||||
public void testErrorCandidates() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionInvokeAfterSafeCall.kt")
|
||||
public void testExtensionInvokeAfterSafeCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/extensionInvokeAfterSafeCall.kt");
|
||||
@@ -2152,6 +2157,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("boundSafeCallAndIsCheck.kt")
|
||||
public void testBoundSafeCallAndIsCheck() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/boundSafeCallAndIsCheck.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("safeCallAndEqualityToBool.kt")
|
||||
public void testSafeCallAndEqualityToBool() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt");
|
||||
@@ -2241,6 +2251,24 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Types extends AbstractFirDiagnosticsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTypes() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/types"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("bareWithSubjectTypeAlias.kt")
|
||||
public void testBareWithSubjectTypeAlias() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/visibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -614,6 +614,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/debugInfoCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("errorCandidates.kt")
|
||||
public void testErrorCandidates() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/errorCandidates.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionInvokeAfterSafeCall.kt")
|
||||
public void testExtensionInvokeAfterSafeCall() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/callResolution/extensionInvokeAfterSafeCall.kt");
|
||||
@@ -2152,6 +2157,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("boundSafeCallAndIsCheck.kt")
|
||||
public void testBoundSafeCallAndIsCheck() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/boundSafeCallAndIsCheck.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("safeCallAndEqualityToBool.kt")
|
||||
public void testSafeCallAndEqualityToBool() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCallAndEqualityToBool.kt");
|
||||
@@ -2241,6 +2251,24 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/types")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Types extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTypes() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/types"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("bareWithSubjectTypeAlias.kt")
|
||||
public void testBareWithSubjectTypeAlias() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/types/bareWithSubjectTypeAlias.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/visibility")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -10286,6 +10286,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/inference/resolveWithUnknownLambdaParameterType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returningLambdaInSuspendContext.kt")
|
||||
public void testReturningLambdaInSuspendContext() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/returningLambdaInSuspendContext.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("starApproximation.kt")
|
||||
public void testStarApproximation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/starApproximation.kt");
|
||||
|
||||
@@ -11,9 +11,11 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
|
||||
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
class FirJvmBackendClassResolver(val components: Fir2IrComponents) : JvmBackendClassResolver {
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override fun resolveToClassDescriptors(type: Type): List<ClassDescriptor> {
|
||||
if (type.sort != Type.OBJECT) return emptyList()
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinErrorType
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.coneTypeUnsafe
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrField
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
@@ -96,6 +97,7 @@ class FirJvmClassCodegen(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
override fun generateKotlinMetadataAnnotation() {
|
||||
|
||||
val localDelegatedProperties = (irClass.attributeOwnerId as? IrClass)?.let(context.localDelegatedProperties::get)
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.fir.serialization.FirElementSerializer
|
||||
import org.jetbrains.kotlin.fir.serialization.FirSerializerExtension
|
||||
import org.jetbrains.kotlin.fir.serialization.nonSourceAnnotations
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.load.kotlin.NON_EXISTENT_CLASS_NAME
|
||||
@@ -75,6 +76,7 @@ class FirJvmSerializerExtension @JvmOverloads constructor(
|
||||
return classBuilderMode != ClassBuilderMode.ABI || nestedClass.effectiveVisibility != FirEffectiveVisibilityImpl.Private
|
||||
}
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
override fun serializeClass(
|
||||
klass: FirClass<*>,
|
||||
proto: ProtoBuf.Class.Builder,
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.fir.scopes.impl.FirClassSubstitutionScope
|
||||
import org.jetbrains.kotlin.fir.symbols.*
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.*
|
||||
@@ -45,6 +46,7 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
class Fir2IrDeclarationStorage(
|
||||
private val components: Fir2IrComponents,
|
||||
private val moduleDescriptor: FirModuleDescriptor,
|
||||
@@ -600,7 +602,9 @@ class Fir2IrDeclarationStorage(
|
||||
Name.special("<$prefix-${correspondingProperty.name}>"),
|
||||
propertyAccessor?.visibility ?: correspondingProperty.visibility,
|
||||
correspondingProperty.modality, accessorReturnType,
|
||||
isInline = false, isExternal = false, isTailrec = false, isSuspend = false, isExpect = false,
|
||||
isInline = propertyAccessor?.isInline == true,
|
||||
isExternal = propertyAccessor?.isExternal == true,
|
||||
isTailrec = false, isSuspend = false, isExpect = false,
|
||||
isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
isOperator = false
|
||||
).apply {
|
||||
@@ -647,7 +651,6 @@ class Fir2IrDeclarationStorage(
|
||||
name: Name,
|
||||
isFinal: Boolean,
|
||||
firInitializerExpression: FirExpression?,
|
||||
thisReceiverOwner: IrClass?,
|
||||
type: IrType? = null
|
||||
): IrField {
|
||||
val inferredType = type ?: firInitializerExpression!!.typeRef.toIrType()
|
||||
@@ -657,14 +660,11 @@ class Fir2IrDeclarationStorage(
|
||||
IrFieldImpl(
|
||||
startOffset, endOffset, origin, symbol,
|
||||
name, inferredType,
|
||||
visibility, isFinal = isFinal, isExternal = false,
|
||||
visibility, isFinal = isFinal,
|
||||
isExternal = property.isExternal,
|
||||
isStatic = property.isStatic || parent !is IrClass,
|
||||
isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE
|
||||
).also {
|
||||
it.correspondingPropertySymbol = this@createBackingField.symbol
|
||||
if (!isFakeOverride && thisReceiverOwner != null) {
|
||||
it.populateOverriddenSymbols(thisReceiverOwner)
|
||||
}
|
||||
}.apply {
|
||||
metadata = FirMetadataSource.Property(property)
|
||||
convertAnnotationsFromLibrary(property)
|
||||
@@ -710,8 +710,7 @@ class Fir2IrDeclarationStorage(
|
||||
isConst = property.isConst,
|
||||
isLateinit = property.isLateInit,
|
||||
isDelegated = property.delegate != null,
|
||||
// TODO
|
||||
isExternal = false,
|
||||
isExternal = property.isExternal,
|
||||
isExpect = property.isExpect,
|
||||
isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE
|
||||
).apply {
|
||||
@@ -734,7 +733,7 @@ class Fir2IrDeclarationStorage(
|
||||
backingField = createBackingField(
|
||||
property, IrDeclarationOrigin.PROPERTY_BACKING_FIELD, descriptor,
|
||||
property.fieldVisibility, property.name, property.isVal, initializer,
|
||||
thisReceiverOwner, type
|
||||
type
|
||||
).also { field ->
|
||||
if (initializer is FirConstExpression<*>) {
|
||||
// TODO: Normally we shouldn't have error type here
|
||||
@@ -745,8 +744,7 @@ class Fir2IrDeclarationStorage(
|
||||
} else if (delegate != null) {
|
||||
backingField = createBackingField(
|
||||
property, IrDeclarationOrigin.PROPERTY_DELEGATE, descriptor,
|
||||
property.fieldVisibility, Name.identifier("${property.name}\$delegate"), true, delegate,
|
||||
thisReceiverOwner
|
||||
property.fieldVisibility, Name.identifier("${property.name}\$delegate"), true, delegate
|
||||
)
|
||||
}
|
||||
if (irParent != null) {
|
||||
@@ -799,8 +797,7 @@ class Fir2IrDeclarationStorage(
|
||||
field.name, type, field.visibility,
|
||||
isFinal = field.modality == Modality.FINAL,
|
||||
isExternal = false,
|
||||
isStatic = field.isStatic,
|
||||
isFakeOverride = false
|
||||
isStatic = field.isStatic
|
||||
).apply {
|
||||
metadata = FirMetadataSource.Variable(field)
|
||||
descriptor.bind(this)
|
||||
@@ -1024,13 +1021,6 @@ class Fir2IrDeclarationStorage(
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrField.populateOverriddenSymbols(thisReceiverOwner: IrClass) {
|
||||
thisReceiverOwner.findMatchingOverriddenSymbolsFromSupertypes(components.irBuiltIns, this)
|
||||
.filterIsInstance<IrFieldSymbol>().singleOrNull()?.let {
|
||||
overriddenSymbols = listOf(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrMutableAnnotationContainer.convertAnnotationsFromLibrary(firAnnotationContainer: FirAnnotationContainer) {
|
||||
if ((firAnnotationContainer as? FirDeclaration)?.isFromLibrary == true) {
|
||||
annotationGenerator?.generate(this, firAnnotationContainer)
|
||||
|
||||
@@ -581,11 +581,15 @@ class Fir2IrVisitor(
|
||||
KtNodeTypes.POSTFIX_EXPRESSION -> IrStatementOrigin.EXCLEXCL
|
||||
else -> null
|
||||
}
|
||||
// If the constant true branch has empty body, it won't be converted. Thus, the entire `when` expression is effectively _not_
|
||||
// exhaustive anymore. In that case, coerce the return type of `when` expression to Unit as per the backend expectation.
|
||||
val effectivelyNotExhaustive = !whenExpression.isExhaustive ||
|
||||
whenExpression.branches.any { it.condition is FirElseIfTrueCondition && it.result.statements.isEmpty() }
|
||||
return conversionScope.withWhenSubject(subjectVariable) {
|
||||
whenExpression.convertWithOffsets { startOffset, endOffset ->
|
||||
val irWhen = IrWhenImpl(
|
||||
startOffset, endOffset,
|
||||
whenExpression.typeRef.toIrType(),
|
||||
if (effectivelyNotExhaustive) irBuiltIns.unitType else whenExpression.typeRef.toIrType(),
|
||||
origin
|
||||
).apply {
|
||||
var unconditionalBranchFound = false
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.fir.types.impl.FirImplicitNullableAnyTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirImplicitStringTypeRef
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.builders.IrGeneratorContextBase
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
@@ -50,6 +51,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
* fir own logic that traverses class hierarchies in fir elements. Also, this one creates and passes IR elements, instead of providing how
|
||||
* to declare them, to [DataClassMembersGenerator].
|
||||
*/
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
class DataClassMembersGenerator(val components: Fir2IrComponents) {
|
||||
|
||||
fun generateInlineClassMembers(klass: FirClass<*>, irClass: IrClass): List<Name> =
|
||||
|
||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.symbols
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrBindableSymbol
|
||||
@@ -36,6 +37,7 @@ abstract class Fir2IrBindableSymbol<out D : DeclarationDescriptor, B : IrSymbolO
|
||||
override val isBound: Boolean
|
||||
get() = _owner != null
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: D by lazy {
|
||||
when (val owner = owner) {
|
||||
is IrEnumEntry -> WrappedEnumEntryDescriptor().apply { bind(owner) }
|
||||
|
||||
@@ -7495,11 +7495,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/i2bResult.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("listThrowablePairInOneSlot.kt")
|
||||
public void testListThrowablePairInOneSlot() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/listThrowablePairInOneSlot.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("loadFromBooleanArray.kt")
|
||||
public void testLoadFromBooleanArray_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/intLikeVarSpilling/loadFromBooleanArray.kt", "kotlin.coroutines");
|
||||
@@ -8343,11 +8338,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt19475.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("kt38925.kt")
|
||||
public void testKt38925_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/kt38925.kt", "kotlin.coroutines");
|
||||
}
|
||||
|
||||
@TestMetadata("nullSpilling.kt")
|
||||
public void testNullSpilling_1_3() throws Exception {
|
||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/varSpilling/nullSpilling.kt", "kotlin.coroutines");
|
||||
@@ -14140,6 +14130,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/innerNested/innerGenericClassFromJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerImplicitParameter.kt")
|
||||
public void testInnerImplicitParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/innerImplicitParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerJavaClass.kt")
|
||||
public void testInnerJavaClass() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/innerNested/innerJavaClass.kt");
|
||||
@@ -26082,6 +26077,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/mapping/types"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("allSupertypes.kt")
|
||||
public void testAllSupertypes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/allSupertypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("annotationConstructorParameters.kt")
|
||||
public void testAnnotationConstructorParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/annotationConstructorParameters.kt");
|
||||
@@ -26097,6 +26097,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/constructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("createType.kt")
|
||||
public void testCreateType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/createType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericArrayElementType.kt")
|
||||
public void testGenericArrayElementType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/mapping/types/genericArrayElementType.kt");
|
||||
|
||||
@@ -1012,6 +1012,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/expressions/javaSyntheticPropertyAccess.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmFieldReferenceWithIntersectionTypes.kt")
|
||||
public void testJvmFieldReferenceWithIntersectionTypes() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/expressions/jvmFieldReferenceWithIntersectionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jvmInstanceFieldReference.kt")
|
||||
public void testJvmInstanceFieldReference() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.kt");
|
||||
|
||||
@@ -99,7 +99,7 @@ abstract class BaseFirBuilder<T>(val baseSession: FirSession, val context: Conte
|
||||
CallableId(name, pathFqName)
|
||||
}
|
||||
context.className == FqName.ROOT -> CallableId(context.packageFqName, name)
|
||||
context.className.shortName() === ANONYMOUS_OBJECT_NAME -> CallableId(ANONYMOUS_CLASS_ID, name)
|
||||
context.className.shortName() == ANONYMOUS_OBJECT_NAME -> CallableId(ANONYMOUS_CLASS_ID, name)
|
||||
else -> CallableId(context.packageFqName, context.className, name)
|
||||
}
|
||||
|
||||
|
||||
@@ -726,7 +726,7 @@ class DeclarationsConverter(
|
||||
source = anonymousInitializer.toFirSourceElement()
|
||||
session = baseSession
|
||||
origin = FirDeclarationOrigin.Source
|
||||
body = if (stubMode) buildEmptyExpressionBlock() else firBlock
|
||||
body = if (stubMode) buildEmptyExpressionBlock() else firBlock ?: buildEmptyExpressionBlock()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,16 +940,8 @@ class DeclarationsConverter(
|
||||
}
|
||||
|
||||
val propertyVisibility = modifiers.getVisibility()
|
||||
status = FirDeclarationStatusImpl(propertyVisibility, modifiers.getModality()).apply {
|
||||
isExpect = modifiers.hasExpect()
|
||||
isActual = modifiers.hasActual()
|
||||
isOverride = modifiers.hasOverride()
|
||||
isConst = modifiers.isConst()
|
||||
isLateInit = modifiers.hasLateinit()
|
||||
}
|
||||
|
||||
|
||||
val convertedAccessors = accessors.map { convertGetterOrSetter(it, returnType, propertyVisibility) }
|
||||
val convertedAccessors = accessors.map { convertGetterOrSetter(it, returnType, propertyVisibility, modifiers) }
|
||||
this.getter = convertedAccessors.find { it.isGetter }
|
||||
?: FirDefaultPropertyGetter(null, session, FirDeclarationOrigin.Source, returnType, propertyVisibility)
|
||||
this.setter =
|
||||
@@ -958,6 +950,19 @@ class DeclarationsConverter(
|
||||
?: FirDefaultPropertySetter(null, session, FirDeclarationOrigin.Source, returnType, propertyVisibility)
|
||||
} else null
|
||||
|
||||
// Upward propagation of `inline` and `external` modifiers (from accessors to property)
|
||||
// Note that, depending on `var` or `val`, checking setter's modifiers should be careful: for `val`, setter doesn't
|
||||
// exist (null); for `var`, the retrieval of the specific modifier is supposed to be `true`
|
||||
status = FirDeclarationStatusImpl(propertyVisibility, modifiers.getModality()).apply {
|
||||
isExpect = modifiers.hasExpect()
|
||||
isActual = modifiers.hasActual()
|
||||
isOverride = modifiers.hasOverride()
|
||||
isConst = modifiers.isConst()
|
||||
isLateInit = modifiers.hasLateinit()
|
||||
isInline = modifiers.hasInline() || (getter!!.isInline && setter?.isInline != false)
|
||||
isExternal = modifiers.hasExternal() || (getter!!.isExternal && setter?.isExternal != false)
|
||||
}
|
||||
|
||||
val receiver = delegateExpression?.let {
|
||||
expressionConverter.getAsFirExpression<FirExpression>(it, "Should have delegate")
|
||||
}
|
||||
@@ -1031,7 +1036,8 @@ class DeclarationsConverter(
|
||||
private fun convertGetterOrSetter(
|
||||
getterOrSetter: LighterASTNode,
|
||||
propertyTypeRef: FirTypeRef,
|
||||
propertyVisibility: Visibility
|
||||
propertyVisibility: Visibility,
|
||||
propertyModifiers: Modifier
|
||||
): FirPropertyAccessor {
|
||||
var modifiers = Modifier()
|
||||
var isGetter = true
|
||||
@@ -1060,6 +1066,12 @@ class DeclarationsConverter(
|
||||
if (accessorVisibility == Visibilities.UNKNOWN) {
|
||||
accessorVisibility = propertyVisibility
|
||||
}
|
||||
val status =
|
||||
// Downward propagation of `inline` and `external` modifiers (from property to its accessors)
|
||||
FirDeclarationStatusImpl(accessorVisibility, Modality.FINAL).apply {
|
||||
isInline = propertyModifiers.hasInline() || modifiers.hasInline()
|
||||
isExternal = propertyModifiers.hasExternal() || modifiers.hasExternal()
|
||||
}
|
||||
val sourceElement = getterOrSetter.toFirSourceElement()
|
||||
if (block == null && expression == null) {
|
||||
return FirDefaultPropertyAccessor
|
||||
@@ -1073,6 +1085,7 @@ class DeclarationsConverter(
|
||||
)
|
||||
.also {
|
||||
it.annotations += modifiers.annotations
|
||||
it.status = status
|
||||
}
|
||||
}
|
||||
val target = FirFunctionTarget(labelName = null, isLambda = false)
|
||||
@@ -1083,7 +1096,7 @@ class DeclarationsConverter(
|
||||
returnTypeRef = returnType ?: if (isGetter) propertyTypeRef else implicitUnitType
|
||||
symbol = FirPropertyAccessorSymbol()
|
||||
this.isGetter = isGetter
|
||||
status = FirDeclarationStatusImpl(accessorVisibility, Modality.FINAL)
|
||||
this.status = status
|
||||
context.firFunctionTargets += target
|
||||
annotations += modifiers.annotations
|
||||
|
||||
|
||||
@@ -261,6 +261,14 @@ class RawFirBuilder(
|
||||
): FirPropertyAccessor {
|
||||
val accessorVisibility =
|
||||
if (this?.visibility != null && this.visibility != Visibilities.UNKNOWN) this.visibility else property.visibility
|
||||
// Downward propagation of `inline` and `external` modifiers (from property to its accessors)
|
||||
val status =
|
||||
FirDeclarationStatusImpl(accessorVisibility, Modality.FINAL).apply {
|
||||
isInline = property.hasModifier(INLINE_KEYWORD) ||
|
||||
this@toFirPropertyAccessor?.hasModifier(INLINE_KEYWORD) == true
|
||||
isExternal = property.hasModifier(EXTERNAL_KEYWORD) ||
|
||||
this@toFirPropertyAccessor?.hasModifier(EXTERNAL_KEYWORD) == true
|
||||
}
|
||||
if (this == null || !hasBody()) {
|
||||
val propertySource = property.toFirSourceElement()
|
||||
return FirDefaultPropertyAccessor
|
||||
@@ -276,6 +284,7 @@ class RawFirBuilder(
|
||||
if (this != null) {
|
||||
it.extractAnnotationsFrom(this)
|
||||
}
|
||||
it.status = status
|
||||
}
|
||||
}
|
||||
val source = this.toFirSourceElement()
|
||||
@@ -290,7 +299,7 @@ class RawFirBuilder(
|
||||
returnTypeReference.toFirOrUnitType()
|
||||
}
|
||||
this.isGetter = isGetter
|
||||
status = FirDeclarationStatusImpl(accessorVisibility, Modality.FINAL)
|
||||
this.status = status
|
||||
extractAnnotationsTo(this)
|
||||
this@RawFirBuilder.context.firFunctionTargets += accessorTarget
|
||||
extractValueParametersTo(this, propertyTypeRef)
|
||||
@@ -1078,19 +1087,25 @@ class RawFirBuilder(
|
||||
expression = { delegateExpression }.toFirExpression("Should have delegate")
|
||||
}
|
||||
} else null
|
||||
|
||||
getter = this@toFirProperty.getter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = true)
|
||||
setter = if (isVar) {
|
||||
this@toFirProperty.setter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = false)
|
||||
} else null
|
||||
|
||||
// Upward propagation of `inline` and `external` modifiers (from accessors to property)
|
||||
// Note that, depending on `var` or `val`, checking setter's modifiers should be careful: for `val`, setter doesn't
|
||||
// exist (null); for `var`, the retrieval of the specific modifier is supposed to be `true`
|
||||
status = FirDeclarationStatusImpl(visibility, modality).apply {
|
||||
isExpect = hasExpectModifier()
|
||||
isActual = hasActualModifier()
|
||||
isOverride = hasModifier(OVERRIDE_KEYWORD)
|
||||
isConst = hasModifier(CONST_KEYWORD)
|
||||
isLateInit = hasModifier(LATEINIT_KEYWORD)
|
||||
isInline = hasModifier(INLINE_KEYWORD) || (getter!!.isInline && setter?.isInline != false)
|
||||
isExternal = hasModifier(EXTERNAL_KEYWORD) || (getter!!.isExternal && setter?.isExternal != false)
|
||||
}
|
||||
|
||||
getter = this@toFirProperty.getter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = true)
|
||||
setter = if (isVar) {
|
||||
this@toFirProperty.setter.toFirPropertyAccessor(this@toFirProperty, propertyType, isGetter = false)
|
||||
} else null
|
||||
|
||||
val receiver = delegateExpression?.toFirExpression("Should have delegate")
|
||||
generateAccessorsByDelegate(
|
||||
delegateBuilder,
|
||||
@@ -1350,6 +1365,7 @@ class RawFirBuilder(
|
||||
else -> null
|
||||
}
|
||||
val hasSubject = subjectExpression != null
|
||||
|
||||
@OptIn(FirContractViolation::class)
|
||||
val ref = FirExpressionRef<FirWhenExpression>()
|
||||
return buildWhenExpression {
|
||||
|
||||
@@ -30,14 +30,14 @@ FILE: annotation.kt
|
||||
}
|
||||
|
||||
public final static enum entry FIRST: R|My| = @base() object : R|My| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|My|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry SECOND: R|My| = @base() object : R|My| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|My|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@ FILE: constructorInObject.kt
|
||||
}
|
||||
|
||||
public final static enum entry X: R|B| = object : R|B| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|B|>()
|
||||
}
|
||||
|
||||
public? constructor(): R|anonymous| {
|
||||
this<R|anonymous|>()
|
||||
public? constructor(): R|<anonymous>| {
|
||||
this<R|<anonymous>|>()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ FILE: constructorInObject.kt
|
||||
|
||||
}
|
||||
public? final? val anonObject: <implicit> = object : R|kotlin/Any| {
|
||||
public? constructor(): R|anonymous| {
|
||||
public? constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FILE: constructorOfAnonymousObject.kt
|
||||
private final? fun resolveAccessorCall(suspendPropertyDescriptor: PropertyDescriptor, context: TranslationContext): ResolvedCall<PropertyDescriptor> {
|
||||
^resolveAccessorCall object : ResolvedCall<PropertyDescriptor> {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FILE: emptyAnonymousObject.kt
|
||||
public? final? fun test(): R|kotlin/Unit| {
|
||||
lval x: <implicit> = object : R|kotlin/Any| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ FILE: enums.kt
|
||||
internal get(): Double
|
||||
|
||||
public final static enum entry MERCURY: R|Planet| = object : R|Planet| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|Planet|>(Double(1.0), Double(2.0))
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ FILE: enums.kt
|
||||
}
|
||||
|
||||
public final static enum entry VENERA: R|Planet| = object : R|Planet| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|Planet|>(Double(3.0), Double(4.0))
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ FILE: enums.kt
|
||||
}
|
||||
|
||||
public final static enum entry EARTH: R|Planet| = object : R|Planet| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|Planet|>(Double(5.0), Double(6.0))
|
||||
}
|
||||
|
||||
@@ -89,49 +89,49 @@ FILE: enums.kt
|
||||
public? get(): String
|
||||
|
||||
public final static enum entry FIX_STACK_BEFORE_JUMP: R|PseudoInsn| = object : R|PseudoInsn| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|PseudoInsn|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry FAKE_ALWAYS_TRUE_IFEQ: R|PseudoInsn| = object : R|PseudoInsn| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|PseudoInsn|>(String(()I))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry FAKE_ALWAYS_FALSE_IFEQ: R|PseudoInsn| = object : R|PseudoInsn| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|PseudoInsn|>(String(()I))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry SAVE_STACK_BEFORE_TRY: R|PseudoInsn| = object : R|PseudoInsn| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|PseudoInsn|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry RESTORE_STACK_IN_TRY_CATCH: R|PseudoInsn| = object : R|PseudoInsn| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|PseudoInsn|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry STORE_NOT_NULL: R|PseudoInsn| = object : R|PseudoInsn| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|PseudoInsn|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final static enum entry AS_NOT_NULL: R|PseudoInsn| = object : R|PseudoInsn| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|PseudoInsn|>(String((Ljava/lang/Object;)Ljava/lang/Object;))
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ FILE: enums2.kt
|
||||
public? get(): Some
|
||||
|
||||
public final static enum entry FIRST: R|SomeEnum| = object : R|SomeEnum| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|SomeEnum|>(O1#)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ FILE: enums2.kt
|
||||
}
|
||||
|
||||
public final static enum entry SECOND: R|SomeEnum| = object : R|SomeEnum| {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|SomeEnum|>(O2#)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ FILE: locals.kt
|
||||
}
|
||||
|
||||
lval code: <implicit> = object : Any {
|
||||
private constructor(): R|anonymous| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<Any>()
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.fir.references.FirErrorNamedReference
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStartOffsetIn
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parents
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners
|
||||
@@ -52,7 +51,8 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
println("BASE PATH: $testDataPath")
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
if (file.path.contains("testData") || file.path.contains("resources")) continue
|
||||
val path = file.path
|
||||
if ("testData" in path || "resources" in path || "api/js" in path.replace('\\', '/')) continue
|
||||
if (file.extension != "kt") continue
|
||||
try {
|
||||
val ktFile = createKtFile(file.toRelativeString(root))
|
||||
@@ -175,7 +175,8 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
val root = File(testDataPath)
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
if (file.path.contains("testData") || file.path.contains("resources")) continue
|
||||
val path = file.path
|
||||
if ("testData" in path || "resources" in path || "api/js" in path.replace('\\', '/')) continue
|
||||
if (file.extension != "kt") continue
|
||||
val ktFile = createKtFile(file.toRelativeString(root))
|
||||
val firFile = ktFile.toFirFile(stubMode = false)
|
||||
@@ -201,7 +202,8 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
var counter = 0
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
if (file.path.contains("testData") || file.path.contains("resources")) continue
|
||||
val path = file.path
|
||||
if ("testData" in path || "resources" in path || "api/js" in path.replace('\\', '/')) continue
|
||||
if (file.extension != "kt") continue
|
||||
val ktFile = createKtFile(file.toRelativeString(root))
|
||||
val firFile: FirFile = ktFile.toFirFile(stubMode = false)
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir
|
||||
|
||||
import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.isInner
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionStub
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.buildResolvedReifiedParameterReference
|
||||
@@ -73,13 +74,14 @@ class FirCallResolver(
|
||||
val nameReference = createResolvedNamedReference(
|
||||
functionCall.calleeReference,
|
||||
name,
|
||||
result.info,
|
||||
result.candidates,
|
||||
result.applicability,
|
||||
functionCall.explicitReceiver,
|
||||
)
|
||||
|
||||
val resultExpression = functionCall.transformCalleeReference(StoreNameReference, nameReference)
|
||||
val candidate = resultExpression.candidate()
|
||||
val candidate = (nameReference as? FirNamedReferenceWithCandidate)?.candidate
|
||||
|
||||
// We need desugaring
|
||||
val resultFunctionCall = if (candidate != null && candidate.callInfo != result.info) {
|
||||
@@ -162,6 +164,7 @@ class FirCallResolver(
|
||||
val nameReference = createResolvedNamedReference(
|
||||
callee,
|
||||
callee.name,
|
||||
result.info,
|
||||
reducedCandidates,
|
||||
result.applicability,
|
||||
qualifiedAccess.explicitReceiver,
|
||||
@@ -284,11 +287,11 @@ class FirCallResolver(
|
||||
constructorClassSymbol,
|
||||
)
|
||||
|
||||
return callResolver.selectDelegatingConstructorCall(delegatedConstructorCall, name, result)
|
||||
return callResolver.selectDelegatingConstructorCall(delegatedConstructorCall, name, result, callInfo)
|
||||
}
|
||||
|
||||
private fun selectDelegatingConstructorCall(
|
||||
call: FirDelegatedConstructorCall, name: Name, result: CandidateCollector,
|
||||
call: FirDelegatedConstructorCall, name: Name, result: CandidateCollector, callInfo: CallInfo
|
||||
): FirDelegatedConstructorCall {
|
||||
val bestCandidates = result.bestCandidates()
|
||||
val reducedCandidates = if (result.currentApplicability < CandidateApplicability.SYNTHETIC_RESOLVED) {
|
||||
@@ -300,6 +303,7 @@ class FirCallResolver(
|
||||
val nameReference = createResolvedNamedReference(
|
||||
call.calleeReference,
|
||||
name,
|
||||
callInfo,
|
||||
reducedCandidates,
|
||||
result.currentApplicability,
|
||||
)
|
||||
@@ -348,29 +352,31 @@ class FirCallResolver(
|
||||
private fun createResolvedNamedReference(
|
||||
reference: FirReference,
|
||||
name: Name,
|
||||
callInfo: CallInfo,
|
||||
candidates: Collection<Candidate>,
|
||||
applicability: CandidateApplicability,
|
||||
explicitReceiver: FirExpression? = null,
|
||||
): FirNamedReference {
|
||||
val source = reference.source
|
||||
return when {
|
||||
candidates.isEmpty() -> buildErrorNamedReference {
|
||||
this.source = source
|
||||
diagnostic = ConeUnresolvedNameError(name)
|
||||
}
|
||||
candidates.isEmpty() -> buildErrorReference(
|
||||
callInfo,
|
||||
ConeUnresolvedNameError(name),
|
||||
source,
|
||||
name
|
||||
)
|
||||
applicability < CandidateApplicability.SYNTHETIC_RESOLVED -> {
|
||||
buildErrorNamedReference {
|
||||
this.source = source
|
||||
diagnostic = ConeInapplicableCandidateError(
|
||||
applicability,
|
||||
candidates.map {
|
||||
ConeInapplicableCandidateError.CandidateInfo(
|
||||
it.symbol,
|
||||
if (it.systemInitialized) it.system.diagnostics else emptyList(),
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
val diagnostic = ConeInapplicableCandidateError(
|
||||
applicability,
|
||||
candidates.map {
|
||||
ConeInapplicableCandidateError.CandidateInfo(
|
||||
it.symbol,
|
||||
if (it.systemInitialized) it.system.diagnostics else emptyList(),
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
buildErrorReference(callInfo, diagnostic, source, name)
|
||||
}
|
||||
candidates.size == 1 -> {
|
||||
val candidate = candidates.single()
|
||||
@@ -396,10 +402,23 @@ class FirCallResolver(
|
||||
}
|
||||
FirNamedReferenceWithCandidate(source, name, candidate)
|
||||
}
|
||||
else -> buildErrorNamedReference {
|
||||
this.source = source
|
||||
diagnostic = ConeAmbiguityError(name, candidates.map { it.symbol })
|
||||
}
|
||||
else -> buildErrorReference(
|
||||
callInfo,
|
||||
ConeAmbiguityError(name, candidates.map { it.symbol }),
|
||||
source,
|
||||
name
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildErrorReference(
|
||||
callInfo: CallInfo,
|
||||
diagnostic: ConeDiagnostic,
|
||||
source: FirSourceElement?,
|
||||
name: Name
|
||||
): FirErrorReferenceWithCandidate {
|
||||
val candidate = CandidateFactory(components, callInfo).createErrorCandidate(diagnostic)
|
||||
resolutionStageRunner.processCandidate(candidate, stopOnFirstError = false)
|
||||
return FirErrorReferenceWithCandidate(source, name, candidate, diagnostic)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,15 @@ package org.jetbrains.kotlin.fir.resolve
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeStubDiagnostic
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.FirResolvedReifiedParameterReferenceBuilder
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionWithSmartcast
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.buildResolvedQualifier
|
||||
import org.jetbrains.kotlin.fir.inferenceContext
|
||||
import org.jetbrains.kotlin.fir.references.FirErrorNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.FirSuperReference
|
||||
@@ -28,6 +30,7 @@ import org.jetbrains.kotlin.fir.resolve.providers.bindSymbolToLookupTag
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.getSymbolByTypeRef
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.AbstractConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.resultType
|
||||
import org.jetbrains.kotlin.fir.resolvedTypeFromPrototype
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProvider
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.withReplacedConeType
|
||||
import org.jetbrains.kotlin.fir.symbols.*
|
||||
@@ -87,6 +90,15 @@ fun ConeClassLikeType.fullyExpandedType(
|
||||
return fullyExpandedTypeNoCache(useSiteSession, expandedConeType)
|
||||
}
|
||||
|
||||
fun ConeKotlinType.fullyExpandedType(
|
||||
useSiteSession: FirSession
|
||||
): ConeKotlinType = when (this) {
|
||||
is ConeFlexibleType ->
|
||||
ConeFlexibleType(lowerBound.fullyExpandedType(useSiteSession), upperBound.fullyExpandedType(useSiteSession))
|
||||
is ConeClassLikeType -> fullyExpandedType(useSiteSession)
|
||||
else -> this
|
||||
}
|
||||
|
||||
private fun ConeClassLikeType.fullyExpandedTypeNoCache(
|
||||
useSiteSession: FirSession,
|
||||
expandedConeType: (FirTypeAlias) -> ConeClassLikeType?,
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
fun Candidate.resolveArgumentExpression(
|
||||
csBuilder: ConstraintSystemBuilder,
|
||||
argument: FirExpression,
|
||||
expectedType: ConeKotlinType,
|
||||
expectedTypeRef: FirTypeRef,
|
||||
expectedType: ConeKotlinType?,
|
||||
expectedTypeRef: FirTypeRef?,
|
||||
sink: CheckerSink,
|
||||
isReceiver: Boolean,
|
||||
isDispatch: Boolean
|
||||
@@ -73,7 +73,7 @@ fun Candidate.resolveArgumentExpression(
|
||||
checkApplicabilityForArgumentType(
|
||||
csBuilder,
|
||||
StandardClassIds.Unit.constructClassLikeType(emptyArray(), isNullable = false),
|
||||
expectedType.type,
|
||||
expectedType?.type,
|
||||
SimpleConstraintSystemConstraintPosition,
|
||||
isReceiver = false,
|
||||
isDispatch = false,
|
||||
@@ -122,8 +122,8 @@ fun Candidate.resolveArgumentExpression(
|
||||
private fun Candidate.resolveBlockArgument(
|
||||
csBuilder: ConstraintSystemBuilder,
|
||||
block: FirBlock,
|
||||
expectedType: ConeKotlinType,
|
||||
expectedTypeRef: FirTypeRef,
|
||||
expectedType: ConeKotlinType?,
|
||||
expectedTypeRef: FirTypeRef?,
|
||||
sink: CheckerSink,
|
||||
isReceiver: Boolean,
|
||||
isDispatch: Boolean
|
||||
@@ -133,7 +133,7 @@ private fun Candidate.resolveBlockArgument(
|
||||
checkApplicabilityForArgumentType(
|
||||
csBuilder,
|
||||
block.typeRef.coneTypeUnsafe(),
|
||||
expectedType.type,
|
||||
expectedType?.type,
|
||||
SimpleConstraintSystemConstraintPosition,
|
||||
isReceiver = false,
|
||||
isDispatch = false,
|
||||
@@ -157,7 +157,7 @@ private fun Candidate.resolveBlockArgument(
|
||||
fun Candidate.resolveSubCallArgument(
|
||||
csBuilder: ConstraintSystemBuilder,
|
||||
argument: FirResolvable,
|
||||
expectedType: ConeKotlinType,
|
||||
expectedType: ConeKotlinType?,
|
||||
sink: CheckerSink,
|
||||
isReceiver: Boolean,
|
||||
isDispatch: Boolean,
|
||||
@@ -210,7 +210,7 @@ private fun Candidate.checkApplicabilityForIntegerOperatorCall(sink: CheckerSink
|
||||
fun Candidate.resolvePlainArgumentType(
|
||||
csBuilder: ConstraintSystemBuilder,
|
||||
argumentType: ConeKotlinType,
|
||||
expectedType: ConeKotlinType,
|
||||
expectedType: ConeKotlinType?,
|
||||
sink: CheckerSink,
|
||||
isReceiver: Boolean,
|
||||
isDispatch: Boolean,
|
||||
@@ -257,12 +257,13 @@ private fun Candidate.captureTypeFromExpressionOrNull(argumentType: ConeKotlinTy
|
||||
private fun checkApplicabilityForArgumentType(
|
||||
csBuilder: ConstraintSystemBuilder,
|
||||
argumentType: ConeKotlinType,
|
||||
expectedType: ConeKotlinType,
|
||||
expectedType: ConeKotlinType?,
|
||||
position: SimpleConstraintSystemConstraintPosition,
|
||||
isReceiver: Boolean,
|
||||
isDispatch: Boolean,
|
||||
sink: CheckerSink
|
||||
) {
|
||||
if (expectedType == null) return
|
||||
if (isReceiver && isDispatch) {
|
||||
if (!expectedType.isNullable && argumentType.isMarkedNullable) {
|
||||
sink.reportApplicability(CandidateApplicability.WRONG_RECEIVER)
|
||||
@@ -288,7 +289,7 @@ private fun checkApplicabilityForArgumentType(
|
||||
|
||||
internal fun Candidate.resolveArgument(
|
||||
argument: FirExpression,
|
||||
parameter: FirValueParameter,
|
||||
parameter: FirValueParameter?,
|
||||
isReceiver: Boolean,
|
||||
isSafeCall: Boolean,
|
||||
sink: CheckerSink
|
||||
@@ -299,14 +300,15 @@ internal fun Candidate.resolveArgument(
|
||||
this.system.getBuilder(),
|
||||
argument,
|
||||
expectedType,
|
||||
parameter.returnTypeRef,
|
||||
parameter?.returnTypeRef,
|
||||
sink,
|
||||
isReceiver,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
private fun Candidate.prepareExpectedType(session: FirSession, argument: FirExpression, parameter: FirValueParameter): ConeKotlinType {
|
||||
private fun Candidate.prepareExpectedType(session: FirSession, argument: FirExpression, parameter: FirValueParameter?): ConeKotlinType? {
|
||||
if (parameter == null) return null
|
||||
if (parameter.returnTypeRef is FirILTTypeRefPlaceHolder) return argument.resultType.coneTypeUnsafe()
|
||||
val basicExpectedType = argument.getExpectedType(session, parameter/*, LanguageVersionSettings*/)
|
||||
val expectedType = getExpectedTypeWithSAMConversion(session, argument, basicExpectedType) ?: basicExpectedType
|
||||
|
||||
@@ -5,10 +5,19 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.resolve.calls
|
||||
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildErrorFunction
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.buildErrorProperty
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
||||
import org.jetbrains.kotlin.fir.returnExpressions
|
||||
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirErrorFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirErrorPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.resolve.calls.components.PostponedArgumentsAnalyzer
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
|
||||
@@ -55,6 +64,51 @@ class CandidateFactory private constructor(
|
||||
} ?: callInfo
|
||||
)
|
||||
}
|
||||
|
||||
fun createErrorCandidate(diagnostic: ConeDiagnostic): Candidate {
|
||||
val symbol: AbstractFirBasedSymbol<*> = when (callInfo.callKind) {
|
||||
CallKind.VariableAccess -> createErrorPropertySymbol(diagnostic)
|
||||
CallKind.Function,
|
||||
CallKind.DelegatingConstructorCall,
|
||||
CallKind.CallableReference -> createErrorFunctionSymbol(diagnostic)
|
||||
CallKind.SyntheticSelect -> throw IllegalStateException()
|
||||
CallKind.SyntheticIdForCallableReferencesResolution -> throw IllegalStateException()
|
||||
}
|
||||
return Candidate(
|
||||
symbol,
|
||||
dispatchReceiverValue = null,
|
||||
implicitExtensionReceiverValue = null,
|
||||
explicitReceiverKind = ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||
bodyResolveComponents,
|
||||
baseSystem,
|
||||
callInfo
|
||||
)
|
||||
}
|
||||
|
||||
private fun createErrorFunctionSymbol(diagnostic: ConeDiagnostic): FirErrorFunctionSymbol {
|
||||
return FirErrorFunctionSymbol().also {
|
||||
buildErrorFunction {
|
||||
session = this@CandidateFactory.bodyResolveComponents.session
|
||||
resolvePhase = FirResolvePhase.BODY_RESOLVE
|
||||
origin = FirDeclarationOrigin.Synthetic
|
||||
this.diagnostic = diagnostic
|
||||
symbol = it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createErrorPropertySymbol(diagnostic: ConeDiagnostic): FirErrorPropertySymbol {
|
||||
return FirErrorPropertySymbol(diagnostic).also {
|
||||
buildErrorProperty {
|
||||
session = this@CandidateFactory.bodyResolveComponents.session
|
||||
resolvePhase = FirResolvePhase.BODY_RESOLVE
|
||||
origin = FirDeclarationOrigin.Synthetic
|
||||
name = FirErrorPropertySymbol.NAME
|
||||
this.diagnostic = diagnostic
|
||||
symbol = it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromExpression(statement: FirStatement) {
|
||||
|
||||
@@ -32,7 +32,11 @@ suspend inline fun CheckerSink.yieldApplicability(new: CandidateApplicability) {
|
||||
yieldIfNeed()
|
||||
}
|
||||
|
||||
class CheckerSinkImpl(override val components: InferenceComponents, var continuation: Continuation<Unit>? = null) : CheckerSink() {
|
||||
class CheckerSinkImpl(
|
||||
override val components: InferenceComponents,
|
||||
var continuation: Continuation<Unit>? = null,
|
||||
val stopOnFirstError: Boolean = true
|
||||
) : CheckerSink() {
|
||||
var current = CandidateApplicability.RESOLVED
|
||||
private set
|
||||
|
||||
@@ -47,6 +51,6 @@ class CheckerSinkImpl(override val components: InferenceComponents, var continua
|
||||
}
|
||||
|
||||
override val needYielding: Boolean
|
||||
get() = current < CandidateApplicability.SYNTHETIC_RESOLVED
|
||||
get() = stopOnFirstError && current < CandidateApplicability.SYNTHETIC_RESOLVED
|
||||
|
||||
}
|
||||
|
||||
@@ -7,16 +7,28 @@ package org.jetbrains.kotlin.fir.resolve.calls
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirImplementationDetail
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
||||
import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference
|
||||
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
@OptIn(FirImplementationDetail::class)
|
||||
class FirNamedReferenceWithCandidate(
|
||||
open class FirNamedReferenceWithCandidate(
|
||||
source: FirSourceElement?,
|
||||
name: Name,
|
||||
val candidate: Candidate
|
||||
) : FirSimpleNamedReference(source, name, candidate.symbol) {
|
||||
override val candidateSymbol: AbstractFirBasedSymbol<*>
|
||||
get() = candidate.symbol
|
||||
|
||||
open val isError: Boolean get() = false
|
||||
}
|
||||
|
||||
class FirErrorReferenceWithCandidate(
|
||||
source: FirSourceElement?,
|
||||
name: Name,
|
||||
candidate: Candidate,
|
||||
val diagnostic: ConeDiagnostic
|
||||
) : FirNamedReferenceWithCandidate(source, name, candidate) {
|
||||
override val isError: Boolean get() = true
|
||||
}
|
||||
@@ -13,8 +13,8 @@ import kotlin.coroutines.intrinsics.createCoroutineUnintercepted
|
||||
import kotlin.coroutines.resume
|
||||
|
||||
class ResolutionStageRunner(val components: InferenceComponents) {
|
||||
fun processCandidate(candidate: Candidate): CandidateApplicability {
|
||||
val sink = CheckerSinkImpl(components)
|
||||
fun processCandidate(candidate: Candidate, stopOnFirstError: Boolean = true): CandidateApplicability {
|
||||
val sink = CheckerSinkImpl(components, stopOnFirstError = stopOnFirstError)
|
||||
var finished = false
|
||||
sink.continuation = suspend {
|
||||
for (stage in candidate.callInfo.callKind.resolutionSequence) {
|
||||
|
||||
@@ -186,7 +186,8 @@ internal object CheckArguments : CheckerStage() {
|
||||
override suspend fun check(candidate: Candidate, sink: CheckerSink, callInfo: CallInfo) {
|
||||
val argumentMapping =
|
||||
candidate.argumentMapping ?: throw IllegalStateException("Argument should be already mapped while checking arguments!")
|
||||
for ((argument, parameter) in argumentMapping) {
|
||||
for (argument in callInfo.arguments) {
|
||||
val parameter = argumentMapping[argument]
|
||||
candidate.resolveArgument(
|
||||
argument,
|
||||
parameter,
|
||||
|
||||
@@ -237,7 +237,8 @@ abstract class FirDataFlowAnalyzer<FLOW : Flow>(
|
||||
when (val operation = typeOperatorCall.operation) {
|
||||
FirOperation.IS, FirOperation.NOT_IS -> {
|
||||
val expressionVariable = variableStorage.createSyntheticVariable(typeOperatorCall)
|
||||
val isNotNullCheck = operation == FirOperation.IS && type.nullability == ConeNullability.NOT_NULL
|
||||
val isNotNullCheck = type.nullability == ConeNullability.NOT_NULL
|
||||
val isRegularIs = operation == FirOperation.IS
|
||||
if (operandVariable.isReal()) {
|
||||
val hasTypeInfo = operandVariable typeEq type
|
||||
val hasNotTypeInfo = operandVariable typeNotEq type
|
||||
@@ -252,13 +253,13 @@ abstract class FirDataFlowAnalyzer<FLOW : Flow>(
|
||||
flow.addTypeStatement(operandVariable typeEq any)
|
||||
}
|
||||
if (isNotNullCheck) {
|
||||
flow.addImplication((expressionVariable eq true) implies (operandVariable typeEq any))
|
||||
flow.addImplication((expressionVariable eq true) implies (operandVariable notEq null))
|
||||
flow.addImplication((expressionVariable eq isRegularIs) implies (operandVariable typeEq any))
|
||||
flow.addImplication((expressionVariable eq isRegularIs) implies (operandVariable notEq null))
|
||||
}
|
||||
|
||||
} else {
|
||||
if (isNotNullCheck) {
|
||||
flow.addImplication((expressionVariable eq true) implies (operandVariable notEq null))
|
||||
flow.addImplication((expressionVariable eq isRegularIs) implies (operandVariable notEq null))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.expressions.FirResolvable
|
||||
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
||||
import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents
|
||||
import org.jetbrains.kotlin.fir.resolve.ResolutionMode
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.candidate
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.FirCallCompletionResultsWriterTransformer
|
||||
@@ -51,24 +52,9 @@ class FirCallCompleter(
|
||||
fun <T> completeCall(call: T, expectedTypeRef: FirTypeRef?): CompletionResult<T>
|
||||
where T : FirResolvable, T : FirStatement {
|
||||
val typeRef = typeFromCallee(call)
|
||||
if (typeRef.type is ConeKotlinErrorType) {
|
||||
if (call is FirExpression) {
|
||||
call.resultType = typeRef
|
||||
}
|
||||
val errorCall = if (call is FirFunctionCall) {
|
||||
call.argumentList.transformArguments(
|
||||
transformer,
|
||||
ResolutionMode.WithExpectedType(typeRef.resolvedTypeFromPrototype(session.builtinTypes.nullableAnyType.type))
|
||||
)
|
||||
call
|
||||
} else {
|
||||
call
|
||||
}
|
||||
inferenceSession.addErrorCall(errorCall)
|
||||
return CompletionResult(errorCall, true)
|
||||
}
|
||||
|
||||
val candidate = call.candidate() ?: return CompletionResult(call, true)
|
||||
val reference = call.calleeReference as? FirNamedReferenceWithCandidate ?: return CompletionResult(call, true)
|
||||
val candidate = reference.candidate
|
||||
val initialSubstitutor = candidate.substitutor
|
||||
|
||||
val initialType = initialSubstitutor.substituteOrSelf(typeRef.type)
|
||||
|
||||
@@ -38,8 +38,8 @@ fun ConeKotlinType.isSuspendFunctionType(session: FirSession): Boolean {
|
||||
}
|
||||
}
|
||||
|
||||
fun ConeKotlinType.receiverType(expectedTypeRef: FirTypeRef, session: FirSession): ConeKotlinType? {
|
||||
if (isBuiltinFunctionalType(session) && expectedTypeRef.isExtensionFunctionType(session)) {
|
||||
fun ConeKotlinType.receiverType(expectedTypeRef: FirTypeRef?, session: FirSession): ConeKotlinType? {
|
||||
if (isBuiltinFunctionalType(session) && expectedTypeRef?.isExtensionFunctionType(session) == true) {
|
||||
return ((this as ConeClassLikeType).fullyExpandedType(session).typeArguments.first() as ConeKotlinTypeProjection).type
|
||||
}
|
||||
return null
|
||||
@@ -63,7 +63,7 @@ val FirAnonymousFunction.receiverType get() = receiverTypeRef?.coneTypeSafe<Cone
|
||||
|
||||
fun extractLambdaInfoFromFunctionalType(
|
||||
expectedType: ConeKotlinType?,
|
||||
expectedTypeRef: FirTypeRef,
|
||||
expectedTypeRef: FirTypeRef?,
|
||||
argument: FirAnonymousFunction,
|
||||
returnTypeVariable: ConeTypeVariableForLambdaReturnType?,
|
||||
components: BodyResolveComponents,
|
||||
@@ -78,7 +78,7 @@ fun extractLambdaInfoFromFunctionalType(
|
||||
|
||||
val receiverType = argument.receiverType ?: expectedType.receiverType(expectedTypeRef, session)
|
||||
val returnType = argument.returnType ?: expectedType.returnType(session) ?: return null
|
||||
val parameters = extractLambdaParameters(expectedType, argument, expectedTypeRef.isExtensionFunctionType(session), session)
|
||||
val parameters = extractLambdaParameters(expectedType, argument, expectedTypeRef?.isExtensionFunctionType(session) ?: false, session)
|
||||
|
||||
return ResolvedLambdaAtom(
|
||||
argument,
|
||||
|
||||
@@ -19,11 +19,11 @@ fun Candidate.preprocessLambdaArgument(
|
||||
csBuilder: ConstraintSystemBuilder,
|
||||
argument: FirAnonymousFunction,
|
||||
expectedType: ConeKotlinType?,
|
||||
expectedTypeRef: FirTypeRef,
|
||||
expectedTypeRef: FirTypeRef?,
|
||||
forceResolution: Boolean = false,
|
||||
returnTypeVariable: ConeTypeVariableForLambdaReturnType? = null
|
||||
): PostponedResolvedAtom {
|
||||
if (expectedType != null && !forceResolution && csBuilder.isTypeVariable(expectedType)) {
|
||||
if (expectedType != null && expectedTypeRef != null && !forceResolution && csBuilder.isTypeVariable(expectedType)) {
|
||||
return LambdaWithTypeVariableAsExpectedTypeAtom(argument, expectedType, expectedTypeRef, this)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ fun Candidate.preprocessLambdaArgument(
|
||||
|
||||
fun Candidate.preprocessCallableReference(
|
||||
argument: FirCallableReferenceAccess,
|
||||
expectedType: ConeKotlinType
|
||||
expectedType: ConeKotlinType?
|
||||
) {
|
||||
val lhs = bodyResolveComponents.doubleColonExpressionResolver.resolveDoubleColonLHS(argument)
|
||||
postponedAtoms += ResolvedCallableReferenceAtom(argument, expectedType, lhs, bodyResolveComponents.session)
|
||||
|
||||
@@ -11,10 +11,12 @@ import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.expressions.builder.buildVarargArgumentsExpression
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildErrorNamedReference
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedCallableReference
|
||||
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirErrorReferenceWithCandidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirNamedReferenceWithCandidate
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.varargElementType
|
||||
import org.jetbrains.kotlin.fir.resolve.constructFunctionalTypeRef
|
||||
@@ -36,6 +38,7 @@ import org.jetbrains.kotlin.fir.visitors.*
|
||||
import org.jetbrains.kotlin.types.AbstractTypeApproximator
|
||||
import org.jetbrains.kotlin.types.TypeApproximatorConfiguration
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
import kotlin.math.min
|
||||
|
||||
class FirCallCompletionResultsWriterTransformer(
|
||||
@@ -78,11 +81,7 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
val result = updatedQualifiedAccess
|
||||
.transformCalleeReference(
|
||||
StoreCalleeReference,
|
||||
buildResolvedNamedReference {
|
||||
source = calleeReference.source
|
||||
name = calleeReference.name
|
||||
resolvedSymbol = calleeReference.candidateSymbol
|
||||
},
|
||||
calleeReference.toResolvedReference(),
|
||||
)
|
||||
.transformDispatchReceiver(StoreReceiver, subCandidate.dispatchReceiverExpression())
|
||||
.transformExtensionReceiver(StoreReceiver, subCandidate.extensionReceiverExpression()) as T
|
||||
@@ -131,10 +130,13 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
}
|
||||
else -> {
|
||||
resultType = typeRef.substituteTypeRef(subCandidate)
|
||||
result.argumentList.transformArguments(this, subCandidate.createArgumentsMapping())
|
||||
subCandidate.handleVarargs(result.argumentList)
|
||||
subCandidate.argumentMapping?.let {
|
||||
result.replaceArgumentList(buildResolvedArgumentList(it))
|
||||
val expectedArgumentsTypeMapping = runIf(!calleeReference.isError) { subCandidate.createArgumentsMapping() }
|
||||
result.argumentList.transformArguments(this, expectedArgumentsTypeMapping)
|
||||
if (!calleeReference.isError) {
|
||||
subCandidate.handleVarargs(result.argumentList)
|
||||
subCandidate.argumentMapping?.let {
|
||||
result.replaceArgumentList(buildResolvedArgumentList(it))
|
||||
}
|
||||
}
|
||||
result.transformExplicitReceiver(integerApproximator, null)
|
||||
}
|
||||
@@ -258,11 +260,7 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
val typeArguments = computeTypeArguments(variableAssignment, calleeReference.candidate)
|
||||
return variableAssignment.transformCalleeReference(
|
||||
StoreCalleeReference,
|
||||
buildResolvedNamedReference {
|
||||
source = calleeReference.source
|
||||
name = calleeReference.name
|
||||
resolvedSymbol = calleeReference.candidateSymbol
|
||||
},
|
||||
calleeReference.toResolvedReference(),
|
||||
).transformExplicitReceiver(integerApproximator, null).apply {
|
||||
replaceTypeArguments(typeArguments)
|
||||
}.compose()
|
||||
@@ -310,18 +308,17 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
delegatedConstructorCall.calleeReference as? FirNamedReferenceWithCandidate ?: return delegatedConstructorCall.compose()
|
||||
val subCandidate = calleeReference.candidate
|
||||
|
||||
delegatedConstructorCall.argumentList.transformArguments(this, calleeReference.candidate.createArgumentsMapping())
|
||||
subCandidate.handleVarargs(delegatedConstructorCall.argumentList)
|
||||
subCandidate.argumentMapping?.let {
|
||||
delegatedConstructorCall.replaceArgumentList(buildResolvedArgumentList(it))
|
||||
val argumentsMapping = runIf(!calleeReference.isError) { calleeReference.candidate.createArgumentsMapping() }
|
||||
delegatedConstructorCall.argumentList.transformArguments(this, argumentsMapping)
|
||||
if (!calleeReference.isError) {
|
||||
subCandidate.handleVarargs(delegatedConstructorCall.argumentList)
|
||||
subCandidate.argumentMapping?.let {
|
||||
delegatedConstructorCall.replaceArgumentList(buildResolvedArgumentList(it))
|
||||
}
|
||||
}
|
||||
return delegatedConstructorCall.transformCalleeReference(
|
||||
StoreCalleeReference,
|
||||
buildResolvedNamedReference {
|
||||
source = calleeReference.source
|
||||
name = calleeReference.name
|
||||
resolvedSymbol = calleeReference.candidateSymbol
|
||||
},
|
||||
calleeReference.toResolvedReference(),
|
||||
).compose()
|
||||
}
|
||||
|
||||
@@ -433,11 +430,7 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
|
||||
return (syntheticCall.transformCalleeReference(
|
||||
StoreCalleeReference,
|
||||
buildResolvedNamedReference {
|
||||
source = calleeReference.source
|
||||
name = calleeReference.name
|
||||
resolvedSymbol = calleeReference.candidateSymbol
|
||||
},
|
||||
calleeReference.toResolvedReference(),
|
||||
) as D).compose()
|
||||
}
|
||||
|
||||
@@ -449,6 +442,20 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
val expectedType = data?.getExpectedType(constExpression)
|
||||
return constExpression.transform(integerApproximator, expectedType)
|
||||
}
|
||||
|
||||
private fun FirNamedReferenceWithCandidate.toResolvedReference() = if (this is FirErrorReferenceWithCandidate) {
|
||||
buildErrorNamedReference {
|
||||
source = this@toResolvedReference.source
|
||||
diagnostic = this@toResolvedReference.diagnostic
|
||||
}
|
||||
} else {
|
||||
buildResolvedNamedReference {
|
||||
source = this@toResolvedReference.source
|
||||
name = this@toResolvedReference.name
|
||||
resolvedSymbol = this@toResolvedReference.candidateSymbol
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sealed class ExpectedArgumentType {
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.fir.types.builder.*
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirQualifierPartImpl
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -221,12 +220,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
||||
// name.invoke() case
|
||||
callCompleter.completeCall(resultExplicitReceiver, noExpectedType)
|
||||
}
|
||||
val completionResult = callCompleter.completeCall(resultExpression, expectedTypeRef)
|
||||
|
||||
if (completionResult.result.typeRef is FirErrorTypeRef) {
|
||||
completionResult.result.argumentList.transformArguments(transformer, ResolutionMode.LambdaResolution(null))
|
||||
}
|
||||
completionResult
|
||||
callCompleter.completeCall(resultExpression, expectedTypeRef)
|
||||
} catch (e: ProcessCanceledException) {
|
||||
throw e
|
||||
} catch (e: Throwable) {
|
||||
@@ -379,7 +373,9 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
||||
}
|
||||
|
||||
private fun FirTypeRef.withTypeArgumentsForBareType(argument: FirExpression): FirTypeRef {
|
||||
val baseTypeArguments = argument.typeRef.coneTypeSafe<ConeKotlinType>()?.typeArguments
|
||||
// TODO: Everything should also work for case of checked-type itself is a type alias
|
||||
val baseTypeArguments =
|
||||
argument.typeRef.coneTypeSafe<ConeKotlinType>()?.fullyExpandedType(session)?.typeArguments
|
||||
val type = coneTypeSafe<ConeKotlinType>()
|
||||
return if (type?.typeArguments?.isEmpty() != true ||
|
||||
type is ConeTypeParameterType ||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.declarations
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
||||
import org.jetbrains.kotlin.fir.diagnostics.FirDiagnosticHolder
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirDelegateFieldSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirErrorPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
abstract class FirErrorProperty : FirVariable<FirErrorProperty>(), FirDiagnosticHolder, FirTypeParametersOwner {
|
||||
abstract override val source: FirSourceElement?
|
||||
abstract override val session: FirSession
|
||||
abstract override val resolvePhase: FirResolvePhase
|
||||
abstract override val origin: FirDeclarationOrigin
|
||||
abstract override val attributes: FirDeclarationAttributes
|
||||
abstract override val returnTypeRef: FirTypeRef
|
||||
abstract override val receiverTypeRef: FirTypeRef?
|
||||
abstract override val name: Name
|
||||
abstract override val initializer: FirExpression?
|
||||
abstract override val delegate: FirExpression?
|
||||
abstract override val delegateFieldSymbol: FirDelegateFieldSymbol<FirErrorProperty>?
|
||||
abstract override val isVar: Boolean
|
||||
abstract override val isVal: Boolean
|
||||
abstract override val getter: FirPropertyAccessor?
|
||||
abstract override val setter: FirPropertyAccessor?
|
||||
abstract override val annotations: List<FirAnnotationCall>
|
||||
abstract override val diagnostic: ConeDiagnostic
|
||||
abstract override val typeParameters: List<FirTypeParameter>
|
||||
abstract override val symbol: FirErrorPropertySymbol
|
||||
|
||||
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitErrorProperty(this, data)
|
||||
|
||||
abstract override fun replaceResolvePhase(newResolvePhase: FirResolvePhase)
|
||||
|
||||
abstract override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef)
|
||||
|
||||
abstract override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?)
|
||||
|
||||
abstract override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||
|
||||
abstract override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||
|
||||
abstract override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||
|
||||
abstract override fun <D> transformDelegate(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||
|
||||
abstract override fun <D> transformGetter(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||
|
||||
abstract override fun <D> transformSetter(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||
|
||||
abstract override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||
|
||||
abstract override fun <D> transformOtherChildren(transformer: FirTransformer<D>, data: D): FirErrorProperty
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.declarations.builder
|
||||
|
||||
import kotlin.contracts.*
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
|
||||
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.declarations.FirErrorProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
||||
import org.jetbrains.kotlin.fir.declarations.impl.FirErrorPropertyImpl
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirDelegateFieldSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirErrorPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirErrorTypeRefImpl
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
@FirBuilderDsl
|
||||
class FirErrorPropertyBuilder : FirAnnotationContainerBuilder {
|
||||
override var source: FirSourceElement? = null
|
||||
lateinit var session: FirSession
|
||||
var resolvePhase: FirResolvePhase = FirResolvePhase.RAW_FIR
|
||||
lateinit var origin: FirDeclarationOrigin
|
||||
lateinit var name: Name
|
||||
override val annotations: MutableList<FirAnnotationCall> = mutableListOf()
|
||||
lateinit var diagnostic: ConeDiagnostic
|
||||
val typeParameters: MutableList<FirTypeParameter> = mutableListOf()
|
||||
lateinit var symbol: FirErrorPropertySymbol
|
||||
|
||||
override fun build(): FirErrorProperty {
|
||||
return FirErrorPropertyImpl(
|
||||
source,
|
||||
session,
|
||||
resolvePhase,
|
||||
origin,
|
||||
name,
|
||||
annotations,
|
||||
diagnostic,
|
||||
typeParameters,
|
||||
symbol,
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
inline fun buildErrorProperty(init: FirErrorPropertyBuilder.() -> Unit): FirErrorProperty {
|
||||
contract {
|
||||
callsInPlace(init, kotlin.contracts.InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
return FirErrorPropertyBuilder().apply(init).build()
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.declarations.impl
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.FirSourceElement
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationAttributes
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.declarations.FirErrorProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.FirPropertyAccessor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||
import org.jetbrains.kotlin.fir.declarations.FirTypeParameter
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDiagnostic
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirDelegateFieldSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirErrorPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.impl.FirErrorTypeRefImpl
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.fir.visitors.*
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
internal class FirErrorPropertyImpl(
|
||||
override val source: FirSourceElement?,
|
||||
override val session: FirSession,
|
||||
override var resolvePhase: FirResolvePhase,
|
||||
override val origin: FirDeclarationOrigin,
|
||||
override val name: Name,
|
||||
override val annotations: MutableList<FirAnnotationCall>,
|
||||
override val diagnostic: ConeDiagnostic,
|
||||
override val typeParameters: MutableList<FirTypeParameter>,
|
||||
override val symbol: FirErrorPropertySymbol,
|
||||
) : FirErrorProperty() {
|
||||
override val attributes: FirDeclarationAttributes = FirDeclarationAttributes()
|
||||
override var returnTypeRef: FirTypeRef = FirErrorTypeRefImpl(null, diagnostic)
|
||||
override val receiverTypeRef: FirTypeRef? get() = null
|
||||
override val initializer: FirExpression? get() = null
|
||||
override val delegate: FirExpression? get() = null
|
||||
override val delegateFieldSymbol: FirDelegateFieldSymbol<FirErrorProperty>? get() = null
|
||||
override val isVar: Boolean get() = false
|
||||
override val isVal: Boolean get() = true
|
||||
override val getter: FirPropertyAccessor? get() = null
|
||||
override val setter: FirPropertyAccessor? get() = null
|
||||
|
||||
init {
|
||||
delegateFieldSymbol?.bind(this)
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
returnTypeRef.accept(visitor, data)
|
||||
annotations.forEach { it.accept(visitor, data) }
|
||||
typeParameters.forEach { it.accept(visitor, data) }
|
||||
}
|
||||
|
||||
override fun <D> transformChildren(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
transformReturnTypeRef(transformer, data)
|
||||
transformOtherChildren(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformReturnTypeRef(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
returnTypeRef = returnTypeRef.transformSingle(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformReceiverTypeRef(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformInitializer(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformDelegate(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformGetter(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformSetter(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformAnnotations(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
annotations.transformInplace(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun <D> transformOtherChildren(transformer: FirTransformer<D>, data: D): FirErrorPropertyImpl {
|
||||
transformAnnotations(transformer, data)
|
||||
typeParameters.transformInplace(transformer, data)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) {
|
||||
returnTypeRef = newReturnTypeRef
|
||||
}
|
||||
|
||||
override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?) {}
|
||||
}
|
||||
@@ -80,6 +80,7 @@ import org.jetbrains.kotlin.fir.expressions.FirAugmentedArraySetCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirErrorExpression
|
||||
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
||||
import org.jetbrains.kotlin.fir.declarations.FirErrorProperty
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall
|
||||
@@ -433,6 +434,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
||||
return transformElement(errorFunction, data)
|
||||
}
|
||||
|
||||
open fun transformErrorProperty(errorProperty: FirErrorProperty, data: D): CompositeTransformResult<FirStatement> {
|
||||
return transformElement(errorProperty, data)
|
||||
}
|
||||
|
||||
open fun transformQualifiedAccessExpression(qualifiedAccessExpression: FirQualifiedAccessExpression, data: D): CompositeTransformResult<FirStatement> {
|
||||
return transformElement(qualifiedAccessExpression, data)
|
||||
}
|
||||
@@ -917,6 +922,10 @@ abstract class FirTransformer<in D> : FirVisitor<CompositeTransformResult<FirEle
|
||||
return transformErrorFunction(errorFunction, data)
|
||||
}
|
||||
|
||||
final override fun visitErrorProperty(errorProperty: FirErrorProperty, data: D): CompositeTransformResult<FirStatement> {
|
||||
return transformErrorProperty(errorProperty, data)
|
||||
}
|
||||
|
||||
final override fun visitQualifiedAccessExpression(qualifiedAccessExpression: FirQualifiedAccessExpression, data: D): CompositeTransformResult<FirStatement> {
|
||||
return transformQualifiedAccessExpression(qualifiedAccessExpression, data)
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ import org.jetbrains.kotlin.fir.expressions.FirAugmentedArraySetCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirClassReferenceExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirErrorExpression
|
||||
import org.jetbrains.kotlin.fir.declarations.FirErrorFunction
|
||||
import org.jetbrains.kotlin.fir.declarations.FirErrorProperty
|
||||
import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirFunctionCall
|
||||
import org.jetbrains.kotlin.fir.expressions.FirDelegatedConstructorCall
|
||||
@@ -283,6 +284,8 @@ abstract class FirVisitor<out R, in D> {
|
||||
|
||||
open fun visitErrorFunction(errorFunction: FirErrorFunction, data: D): R = visitElement(errorFunction, data)
|
||||
|
||||
open fun visitErrorProperty(errorProperty: FirErrorProperty, data: D): R = visitElement(errorProperty, data)
|
||||
|
||||
open fun visitQualifiedAccessExpression(qualifiedAccessExpression: FirQualifiedAccessExpression, data: D): R = visitElement(qualifiedAccessExpression, data)
|
||||
|
||||
open fun visitFunctionCall(functionCall: FirFunctionCall, data: D): R = visitElement(functionCall, data)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user