diff --git a/.idea/modules.xml b/.idea/modules.xml index 322ba8cd3a0..519d3ee12ad 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -82,6 +82,7 @@ + diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt index 7ee2154ee28..c7150cbf2e1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt @@ -648,7 +648,7 @@ class QualifiedExpressionResolver { is TypeParameterDescriptor -> TypeParameterQualifier(referenceExpression, descriptor) is TypeAliasDescriptor -> { val classDescriptor = descriptor.classDescriptor ?: return null - TypeAliasQualifier(referenceExpression, classDescriptor) + TypeAliasQualifier(referenceExpression, descriptor, classDescriptor) } else -> return null } diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt index 323daa92585..0355655ba14 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ArgumentsGenerationUtils.kt @@ -19,14 +19,17 @@ package org.jetbrains.kotlin.psi2ir.generators import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor -import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.* +import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.expressions.IrExpressionWithCopy +import org.jetbrains.kotlin.ir.expressions.impl.IrGetObjectValueImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrSpreadElementImpl +import org.jetbrains.kotlin.ir.expressions.impl.IrVarargImpl import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.psi2ir.intermediate.* import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.calls.callResolverUtil.getSuperCallExpression import org.jetbrains.kotlin.resolve.calls.callUtil.isSafeCall import org.jetbrains.kotlin.resolve.calls.model.* @@ -62,7 +65,7 @@ fun StatementGenerator.generateReceiver(ktDefaultElement: KtElement, receiver: R generateExpression(receiver.expression) is ClassValueReceiver -> IrGetObjectValueImpl(receiver.expression.startOffset, receiver.expression.endOffset, receiver.type, - receiver.classQualifier.descriptor) + receiver.classQualifier.descriptor as ClassDescriptor) is ExtensionReceiver -> IrGetValueImpl(ktDefaultElement.startOffset, ktDefaultElement.startOffset, receiver.declarationDescriptor.extensionReceiverParameter!!) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt index d445c422beb..3a131a26a05 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/DumpIrTree.kt @@ -43,7 +43,10 @@ class DumpIrTreeVisitor(out: Appendable): IrElementVisitor { val elementRenderer = RenderIrElementVisitor() companion object { - val ANNOTATIONS_RENDERER = DescriptorRenderer.withOptions { verbose = true } + val ANNOTATIONS_RENDERER = DescriptorRenderer.withOptions { + verbose = true + includeAnnotationArguments = true + } } override fun visitElement(element: IrElement, data: String) { diff --git a/compiler/tests-common/org/jetbrains/kotlin/codegen/ir/AbstractIrBlackBoxCodegenTest.java b/compiler/tests-common/org/jetbrains/kotlin/codegen/ir/AbstractIrBlackBoxCodegenTest.java index e50344ef2d6..b85dd20346b 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/codegen/ir/AbstractIrBlackBoxCodegenTest.java +++ b/compiler/tests-common/org/jetbrains/kotlin/codegen/ir/AbstractIrBlackBoxCodegenTest.java @@ -16,31 +16,9 @@ package org.jetbrains.kotlin.codegen.ir; -import com.intellij.ide.highlighter.JavaFileType; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.util.Processor; -import kotlin.io.FilesKt; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTest; -import org.jetbrains.kotlin.codegen.CodegenTestCase; -import org.jetbrains.kotlin.codegen.GeneratedClassLoader; import org.jetbrains.kotlin.config.CompilerConfiguration; import org.jetbrains.kotlin.config.JVMConfigurationKeys; -import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil; -import org.jetbrains.kotlin.psi.KtDeclaration; -import org.jetbrains.kotlin.psi.KtFile; -import org.jetbrains.kotlin.psi.KtNamedFunction; -import org.jetbrains.kotlin.psi.KtProperty; -import org.jetbrains.kotlin.test.ConfigurationKind; -import org.jetbrains.kotlin.test.InTextDirectivesUtils; -import org.jetbrains.kotlin.test.TestJdkKind; -import org.jetbrains.kotlin.utils.ExceptionUtilsKt; - -import java.io.File; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; public abstract class AbstractIrBlackBoxCodegenTest extends AbstractBlackBoxCodegenTest { @Override diff --git a/compiler/tests-ir-jvm/tests-ir-jvm.iml b/compiler/tests-ir-jvm/tests-ir-jvm.iml new file mode 100644 index 00000000000..23294642a91 --- /dev/null +++ b/compiler/tests-ir-jvm/tests-ir-jvm.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java similarity index 99% rename from compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java rename to compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 2cf1048e020..02c96e174c8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -73,6 +73,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("annotationsOnTypeAliases.kt") + public void testAnnotationsOnTypeAliases() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/annotationsOnTypeAliases.kt"); + doTest(fileName); + } + @TestMetadata("defaultParameterValues.kt") public void testDefaultParameterValues() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/defaultParameterValues.kt"); @@ -3550,6 +3556,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("inSetWithSmartCast.kt") + public void testInSetWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/collections/inSetWithSmartCast.kt"); + doTest(fileName); + } + @TestMetadata("irrelevantImplCharSequence.kt") public void testIrrelevantImplCharSequence() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/collections/irrelevantImplCharSequence.kt"); @@ -11185,30 +11197,99 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } - @TestMetadata("inIntRange.kt") - public void testInIntRange() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/inIntRange.kt"); - doTest(fileName); - } - @TestMetadata("multiAssignmentIterationOverIntRange.kt") public void testMultiAssignmentIterationOverIntRange() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/multiAssignmentIterationOverIntRange.kt"); doTest(fileName); } - @TestMetadata("rangeContainsString.kt") - public void testRangeContainsString() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/rangeContainsString.kt"); - doTest(fileName); - } - @TestMetadata("safeCallRangeTo.kt") public void testSafeCallRangeTo() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/safeCallRangeTo.kt"); doTest(fileName); } + @TestMetadata("compiler/testData/codegen/box/ranges/contains") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Contains extends AbstractIrBlackBoxCodegenTest { + public void testAllFilesPresentInContains() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/contains"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("inComparableRange.kt") + public void testInComparableRange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inComparableRange.kt"); + doTest(fileName); + } + + @TestMetadata("inExtensionRange.kt") + public void testInExtensionRange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inExtensionRange.kt"); + doTest(fileName); + } + + @TestMetadata("inIntRange.kt") + public void testInIntRange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inIntRange.kt"); + doTest(fileName); + } + + @TestMetadata("inOptimizableDoubleRange.kt") + public void testInOptimizableDoubleRange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inOptimizableDoubleRange.kt"); + doTest(fileName); + } + + @TestMetadata("inOptimizableFloatRange.kt") + public void testInOptimizableFloatRange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inOptimizableFloatRange.kt"); + doTest(fileName); + } + + @TestMetadata("inOptimizableIntRange.kt") + public void testInOptimizableIntRange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inOptimizableIntRange.kt"); + doTest(fileName); + } + + @TestMetadata("inOptimizableLongRange.kt") + public void testInOptimizableLongRange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inOptimizableLongRange.kt"); + doTest(fileName); + } + + @TestMetadata("inRangeWithCustomContains.kt") + public void testInRangeWithCustomContains() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inRangeWithCustomContains.kt"); + doTest(fileName); + } + + @TestMetadata("inRangeWithImplicitReceiver.kt") + public void testInRangeWithImplicitReceiver() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inRangeWithImplicitReceiver.kt"); + doTest(fileName); + } + + @TestMetadata("inRangeWithNonmatchingArguments.kt") + public void testInRangeWithNonmatchingArguments() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inRangeWithNonmatchingArguments.kt"); + doTest(fileName); + } + + @TestMetadata("inRangeWithSmartCast.kt") + public void testInRangeWithSmartCast() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/inRangeWithSmartCast.kt"); + doTest(fileName); + } + + @TestMetadata("rangeContainsString.kt") + public void testRangeContainsString() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/contains/rangeContainsString.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/ranges/expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -15871,6 +15952,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("typeAliasConstructorInSuperCall.kt") + public void testTypeAliasConstructorInSuperCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/typealias/typeAliasConstructorInSuperCall.kt"); + doTest(fileName); + } + @TestMetadata("typeAliasObject.kt") public void testTypeAliasObject() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/typealias/typeAliasObject.kt"); diff --git a/compiler/tests/compiler-tests.iml b/compiler/tests/compiler-tests.iml index 58d10f71102..d4156d182f1 100644 --- a/compiler/tests/compiler-tests.iml +++ b/compiler/tests/compiler-tests.iml @@ -67,8 +67,6 @@ - - diff --git a/compiler/tests/org/jetbrains/kotlin/ir/ClosureAnnotatorTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/ClosureAnnotatorTestCaseGenerated.java deleted file mode 100644 index 89aafd18774..00000000000 --- a/compiler/tests/org/jetbrains/kotlin/ir/ClosureAnnotatorTestCaseGenerated.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.ir; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("compiler/testData/ir/closureAnnotator") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class ClosureAnnotatorTestCaseGenerated extends AbstractClosureAnnotatorTestCase { - public void testAllFilesPresentInClosureAnnotator() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/ir/closureAnnotator"), Pattern.compile("^(.+)\\.kt$"), true); - } - - @TestMetadata("localFunctions.kt") - public void testLocalFunctions() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/closureAnnotator/localFunctions.kt"); - doTest(fileName); - } - - @TestMetadata("multipleThisReferences.kt") - public void testMultipleThisReferences() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/closureAnnotator/multipleThisReferences.kt"); - doTest(fileName); - } - - @TestMetadata("topLevelDeclarations.kt") - public void testTopLevelDeclarations() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/closureAnnotator/topLevelDeclarations.kt"); - doTest(fileName); - } -} diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 5d1ab55933c..3b569f18292 100755 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -221,10 +221,6 @@ fun main(args: Array) { model("codegen/box", targetBackend = TargetBackend.JVM) } - testClass() { - model("codegen/box", targetBackend = TargetBackend.JVM) - } - testClass("IrOnlyBoxCodegenTestGenerated") { model("ir/box", targetBackend = TargetBackend.JVM) } @@ -257,20 +253,6 @@ fun main(args: Array) { model("ir/irCfg") } -// Uncomment the following lines to generate IR generator tests based on existing compiler tests. -// -// testClass() { -// model("codegen/box") -// } -// -// testClass() { -// model("diagnostics/tests/controlFlowAnalysis") -// } - - testClass { - model("ir/closureAnnotator") - } - testClass() { model("codegen/bytecodeListing") } @@ -397,6 +379,12 @@ fun main(args: Array) { } } + testGroup("compiler/tests-ir-jvm/tests", "compiler/testData") { + testClass() { + model("codegen/box", targetBackend = TargetBackend.JVM) + } + } + testGroup("compiler/tests-java8/tests", "compiler/testData") { testClass("BlackBoxWithJava8CodegenTestGenerated") { model("codegen/java8/box") diff --git a/idea/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.java b/idea/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.java index 5d5c4edd92e..c6f8770e326 100644 --- a/idea/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.java +++ b/idea/src/org/jetbrains/kotlin/idea/internal/KotlinBytecodeToolWindow.java @@ -37,7 +37,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.java.decompiler.IdeaLogger; import org.jetbrains.kotlin.backend.common.output.OutputFile; import org.jetbrains.kotlin.backend.common.output.OutputFileCollection; -import org.jetbrains.kotlin.backend.jvm.JvmBackendFacade; import org.jetbrains.kotlin.codegen.ClassBuilderFactories; import org.jetbrains.kotlin.codegen.CompilationErrorHandler; import org.jetbrains.kotlin.codegen.KotlinCodegenFacade;