From aba70e047d76630a555c73c11fa985e81fa91d12 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Fri, 2 Aug 2013 14:13:00 +0400 Subject: [PATCH] resolve a!! as call --- .../BasicExpressionTypingVisitor.java | 37 +++-- .../ControlStructureTypingUtils.java | 136 +++++++++++------- .../ControlStructureTypingVisitor.java | 16 ++- .../specialConstructions/exclExclAsCall.kt | 28 ++++ .../reportTypeMismatchDeeplyOnBranches.kt | 0 .../checkers/JetDiagnosticsTestGenerated.java | 43 +++--- 6 files changed, 164 insertions(+), 96 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt rename compiler/testData/diagnostics/tests/{controlStructures/if => resolve/specialConstructions}/reportTypeMismatchDeeplyOnBranches.kt (100%) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java index 325114c9272..9c658322b0d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java @@ -17,7 +17,6 @@ package org.jetbrains.jet.lang.types.expressions; import com.google.common.collect.Multimap; -import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; @@ -69,6 +68,7 @@ import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue.NO_R import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE; import static org.jetbrains.jet.lang.types.TypeUtils.UNKNOWN_EXPECTED_TYPE; import static org.jetbrains.jet.lang.types.TypeUtils.noExpectedType; +import static org.jetbrains.jet.lang.types.expressions.ControlStructureTypingUtils.*; import static org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils.*; @SuppressWarnings("SuspiciousMethodCalls") @@ -723,8 +723,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { @Override public JetTypeInfo visitQualifiedExpression(JetQualifiedExpression expression, ExpressionTypingContext context) { CallExpressionResolver callExpressionResolver = context.expressionTypingServices.getCallExpressionResolver(); - return callExpressionResolver - .getQualifiedExpressionTypeInfo(expression, context); + return callExpressionResolver.getQualifiedExpressionTypeInfo(expression, context); } @Override @@ -827,27 +826,25 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { JetSimpleNameExpression operationSign = expression.getOperationReference(); assert operationSign.getReferencedNameElementType() == JetTokens.EXCLEXCL; - JetType expectedType; - if (!noExpectedType(context.expectedType)) { - expectedType = TypeUtils.makeNullable(context.expectedType); + Call call = createCallForSpecialConstruction(expression, Collections.singletonList(baseExpression)); + ResolvedCall resolvedCall = resolveSpecialConstructionAsCall( + call, "ExclExcl", Collections.singletonList("baseExpr"), Collections.singletonList(true), context, null); + resolvedCall.getResultingDescriptor(); + JetTypeInfo baseTypeInfo = BindingContextUtils.getRecordedTypeInfo(baseExpression, context.trace.getBindingContext()); + assert baseTypeInfo != null : "Base expression was not processed: " + expression; + JetType baseType = baseTypeInfo.getType(); + if (baseType == null) { + return baseTypeInfo; + } + DataFlowInfo dataFlowInfo = baseTypeInfo.getDataFlowInfo(); + if (isKnownToBeNotNull(baseExpression, context) && !ErrorUtils.isErrorType(baseType)) { + context.trace.report(UNNECESSARY_NOT_NULL_ASSERTION.on(operationSign, baseType)); } else { - expectedType = NO_EXPECTED_TYPE; - } - JetTypeInfo typeInfo = facade.getTypeInfo(baseExpression, context.replaceExpectedType(expectedType)); - JetType type = typeInfo.getType(); - if (type == null) { - return typeInfo; - } - DataFlowInfo dataFlowInfo = typeInfo.getDataFlowInfo(); - if (isKnownToBeNotNull(baseExpression, context) && !ErrorUtils.isErrorType(type)) { - context.trace.report(UNNECESSARY_NOT_NULL_ASSERTION.on(operationSign, type)); - } - else { - DataFlowValue value = DataFlowValueFactory.INSTANCE.createDataFlowValue(baseExpression, type, context.trace.getBindingContext()); + DataFlowValue value = DataFlowValueFactory.INSTANCE.createDataFlowValue(baseExpression, baseType, context.trace.getBindingContext()); dataFlowInfo = dataFlowInfo.disequate(value, DataFlowValue.NULL); } - return JetTypeInfo.create(TypeUtils.makeNotNullable(type), dataFlowInfo); + return JetTypeInfo.create(TypeUtils.makeNotNullable(baseType), dataFlowInfo); } private JetTypeInfo visitLabeledExpression(@NotNull JetUnaryExpression expression, @NotNull ExpressionTypingContext context, diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingUtils.java index f8241958722..6b397ef001d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingUtils.java @@ -17,6 +17,7 @@ package org.jetbrains.jet.lang.types.expressions; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; @@ -29,6 +30,7 @@ import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.BindingContextUtils; import org.jetbrains.jet.lang.resolve.BindingTrace; +import org.jetbrains.jet.lang.resolve.calls.CallResolver; import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo; import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintSystem; import org.jetbrains.jet.lang.resolve.calls.inference.InferenceErrorData; @@ -43,10 +45,12 @@ import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue; import org.jetbrains.jet.lang.types.*; +import org.jetbrains.jet.lexer.JetTokens; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Map; import static org.jetbrains.jet.lang.resolve.BindingContext.CALL; import static org.jetbrains.jet.lang.resolve.BindingContext.RESOLVED_CALL; @@ -55,52 +59,70 @@ public class ControlStructureTypingUtils { private ControlStructureTypingUtils() { } - /*package*/ static ResolvedCall resolveIfAsCall( - @NotNull Call callForIf, + /*package*/ static ResolvedCall resolveSpecialConstructionAsCall( + @NotNull Call call, + @NotNull String constructionName, + @NotNull List argumentNames, + @NotNull List isArgumentNullable, @NotNull ExpressionTypingContext context, - @NotNull DataFlowInfo thenInfo, - @NotNull DataFlowInfo elseInfo + @Nullable MutableDataFlowInfoForArguments dataFlowInfoForArguments ) { - List noAnnotations = Collections.emptyList(); - Name specialFunctionName = Name.identifierNoValidate(""); + SimpleFunctionDescriptorImpl function = createFunctionDescriptorForSpecialConstruction( + "", argumentNames, isArgumentNullable); + JetReferenceExpression reference = JetPsiFactory.createSimpleName( + context.expressionTypingServices.getProject(), "fake" + constructionName + "Call"); + TracingStrategy tracing = createTracingForSpecialConstruction(call, constructionName); + ResolutionCandidate resolutionCandidate = ResolutionCandidate.create(function, null); + CallResolver callResolver = context.expressionTypingServices.getCallResolver(); + OverloadResolutionResults results = callResolver.resolveCallWithKnownCandidate( + call, tracing, reference, context, resolutionCandidate, dataFlowInfoForArguments); + assert results.isSingleResult() : "Not single result after resolving one known candidate"; + return results.getResultingCall(); + } - SimpleFunctionDescriptorImpl ifFunction = new SimpleFunctionDescriptorImpl( + private static SimpleFunctionDescriptorImpl createFunctionDescriptorForSpecialConstruction( + @NotNull String name, + @NotNull List argumentNames, + @NotNull List isArgumentNullable + ) { + assert argumentNames.size() == isArgumentNullable.size(); + + List noAnnotations = Collections.emptyList(); + Name specialFunctionName = Name.identifierNoValidate(name); + + SimpleFunctionDescriptorImpl function = new SimpleFunctionDescriptorImpl( ErrorUtils.getErrorModule(),//todo hack to avoid returning true in 'isError(DeclarationDescriptor)' noAnnotations, specialFunctionName, CallableMemberDescriptor.Kind.DECLARATION); TypeParameterDescriptor typeParameter = TypeParameterDescriptorImpl.createWithDefaultBound( - ifFunction, noAnnotations, false, Variance.INVARIANT, Name.identifier("T"), 0); + function, noAnnotations, false, Variance.INVARIANT, Name.identifier("T"), 0); JetType type = new JetTypeImpl(typeParameter.getTypeConstructor(), JetScope.EMPTY); + JetType nullableType = new JetTypeImpl( + noAnnotations, typeParameter.getTypeConstructor(), true, Collections.emptyList(), JetScope.EMPTY); - ValueParameterDescriptorImpl thenValueParameter = new ValueParameterDescriptorImpl( - ifFunction, 0, noAnnotations, Name.identifier("thenBranch"), type, false, null); - ValueParameterDescriptorImpl elseValueParameter = new ValueParameterDescriptorImpl( - ifFunction, 1, noAnnotations, Name.identifier("elseBranch"), type, false, null); - ifFunction.initialize( + List valueParameters = Lists.newArrayList(); + for (int i = 0; i < argumentNames.size(); i++) { + JetType argumentType = isArgumentNullable.get(i) ? nullableType : type; + ValueParameterDescriptorImpl valueParameter = new ValueParameterDescriptorImpl( + function, i, noAnnotations, Name.identifier(argumentNames.get(i)), argumentType, false, null); + valueParameters.add(valueParameter); + } + function.initialize( null, ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER, Lists.newArrayList(typeParameter), - Lists.newArrayList(thenValueParameter, elseValueParameter), + valueParameters, type, Modality.FINAL, Visibilities.PUBLIC, /*isInline = */ false ); - - JetReferenceExpression ifReference = JetPsiFactory.createSimpleName(context.expressionTypingServices.getProject(), "fakeIfCall"); - TracingStrategy tracingForIf = createTracingForIf(callForIf); - MutableDataFlowInfoForArguments dataFlowInfoForArguments = createDataFlowInfoForArgumentsForCall(callForIf, thenInfo, elseInfo); - ResolutionCandidate resolutionCandidate = ResolutionCandidate.create(ifFunction, null); - OverloadResolutionResults - results = context.expressionTypingServices.getCallResolver().resolveCallWithKnownCandidate( - callForIf, tracingForIf, ifReference, context, resolutionCandidate, dataFlowInfoForArguments); - assert results.isSingleResult() : "Not single result after resolving one known candidate"; - return results.getResultingCall(); + return function; } - private static MutableDataFlowInfoForArguments createDataFlowInfoForArgumentsForCall( - final Call callForIf, final DataFlowInfo thenInfo, final DataFlowInfo elseInfo + /*package*/ static MutableDataFlowInfoForArguments createDataFlowInfoForArgumentsForCall( + final Map dataFlowInfoForArgumentsMap ) { return new MutableDataFlowInfoForArguments() { private DataFlowInfo initialDataFlowInfo; @@ -117,13 +139,7 @@ public class ControlStructureTypingUtils { @NotNull @Override public DataFlowInfo getInfo(@NotNull ValueArgument valueArgument) { - if (valueArgument == callForIf.getValueArguments().get(0)) { - return thenInfo; - } - if (valueArgument == callForIf.getValueArguments().get(1)) { - return elseInfo; - } - throw new IllegalArgumentException(); + return dataFlowInfoForArgumentsMap.get(valueArgument); } @NotNull @@ -134,19 +150,30 @@ public class ControlStructureTypingUtils { }; } - /*package*/ static Call createCallForIf( - final JetIfExpression ifExpression, - @NotNull JetExpression thenBranch, - @NotNull JetExpression elseBranch + public static MutableDataFlowInfoForArguments createDataFlowInfoForArgumentsForIfCall( + @NotNull Call callForIf, + @NotNull DataFlowInfo thenInfo, + @NotNull DataFlowInfo elseInfo ) { - final List valueArguments = Lists.newArrayList( - CallMaker.makeValueArgument(thenBranch, thenBranch), - CallMaker.makeValueArgument(elseBranch, elseBranch)); + Map dataFlowInfoForArgumentsMap = Maps.newHashMap(); + dataFlowInfoForArgumentsMap.put(callForIf.getValueArguments().get(0), thenInfo); + dataFlowInfoForArgumentsMap.put(callForIf.getValueArguments().get(1), elseInfo); + return createDataFlowInfoForArgumentsForCall(dataFlowInfoForArgumentsMap); + } + + /*package*/ static Call createCallForSpecialConstruction( + @NotNull final JetExpression expression, + @NotNull List arguments + ) { + final List valueArguments = Lists.newArrayList(); + for (JetExpression argument : arguments) { + valueArguments.add(CallMaker.makeValueArgument(argument, argument)); + } return new Call() { @Nullable @Override public ASTNode getCallOperationNode() { - return ifExpression.getNode(); + return expression.getNode(); } @NotNull @@ -164,7 +191,7 @@ public class ControlStructureTypingUtils { @Nullable @Override public JetExpression getCalleeExpression() { - return ifExpression; + return expression; } @Nullable @@ -200,7 +227,7 @@ public class ControlStructureTypingUtils { @NotNull @Override public PsiElement getCallElement() { - return ifExpression; + return expression; } @NotNull @@ -211,7 +238,10 @@ public class ControlStructureTypingUtils { }; } - /*package*/ static TracingStrategy createTracingForIf(final @NotNull Call callForIf) { + /*package*/ static TracingStrategy createTracingForSpecialConstruction( + final @NotNull Call call, + final @NotNull String constructionName + ) { class CheckTypeContext { public BindingTrace trace; public JetType expectedType; @@ -247,6 +277,16 @@ public class ControlStructureTypingUtils { return null; } + @Override + public Void visitPostfixExpression(JetPostfixExpression expression, CheckTypeContext c) { + if (expression.getOperationReference().getReferencedNameElementType() == JetTokens.EXCLEXCL) { + checkExpressionType(expression.getBaseExpression(), + new CheckTypeContext(c.trace, TypeUtils.makeNullable(c.expectedType))); + return null; + } + return super.visitPostfixExpression(expression, c); + } + @Override public Void visitExpression(JetExpression expression, CheckTypeContext c) { JetTypeInfo typeInfo = BindingContextUtils.getRecordedTypeInfo(expression, c.trace.getBindingContext()); @@ -257,7 +297,7 @@ public class ControlStructureTypingUtils { } }; - return new ThrowingOnErrorTracingStrategy("resolve 'if' as a call") { + return new ThrowingOnErrorTracingStrategy("resolve " + constructionName + " as a call") { @Override public void bindReference( @NotNull BindingTrace trace, @NotNull ResolvedCallWithTrace resolvedCall @@ -269,8 +309,8 @@ public class ControlStructureTypingUtils { public void bindResolvedCall( @NotNull BindingTrace trace, @NotNull ResolvedCallWithTrace resolvedCall ) { - trace.record(RESOLVED_CALL, callForIf.getCalleeExpression(), resolvedCall); - trace.record(CALL, callForIf.getCalleeExpression(), callForIf); + trace.record(RESOLVED_CALL, call.getCalleeExpression(), resolvedCall); + trace.record(CALL, call.getCalleeExpression(), call); } @@ -285,7 +325,7 @@ public class ControlStructureTypingUtils { return; } if (constraintSystem.hasOnlyExpectedTypeMismatch()) { - JetExpression expression = callForIf.getCalleeExpression(); + JetExpression expression = call.getCalleeExpression(); if (expression != null) { expression.accept(checkTypeVisitor, new CheckTypeContext(trace, data.expectedType)); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java index 86ff6b18ecd..5183ed44524 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java @@ -34,6 +34,7 @@ import org.jetbrains.jet.lang.resolve.BindingContextUtils; import org.jetbrains.jet.lang.resolve.DescriptorResolver; import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo; +import org.jetbrains.jet.lang.resolve.calls.model.MutableDataFlowInfoForArguments; import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall; import org.jetbrains.jet.lang.resolve.calls.results.OverloadResolutionResults; import org.jetbrains.jet.lang.resolve.name.Name; @@ -47,15 +48,13 @@ import org.jetbrains.jet.lang.types.checker.JetTypeChecker; import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns; import org.jetbrains.jet.util.slicedmap.WritableSlice; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; +import java.util.*; import static org.jetbrains.jet.lang.diagnostics.Errors.*; import static org.jetbrains.jet.lang.resolve.BindingContext.*; import static org.jetbrains.jet.lang.types.TypeUtils.UNKNOWN_EXPECTED_TYPE; import static org.jetbrains.jet.lang.types.TypeUtils.noExpectedType; +import static org.jetbrains.jet.lang.types.expressions.ControlStructureTypingUtils.*; import static org.jetbrains.jet.lang.types.expressions.ExpressionTypingUtils.*; public class ControlStructureTypingVisitor extends ExpressionTypingVisitor { @@ -119,8 +118,13 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor { JetTypeInfo elseTypeInfo; if (contextWithExpectedType.expectedType == UNKNOWN_EXPECTED_TYPE) { - Call callForIf = ControlStructureTypingUtils.createCallForIf(ifExpression, thenBranch, elseBranch); - ControlStructureTypingUtils.resolveIfAsCall(callForIf, contextWithExpectedType, thenInfo, elseInfo); + Call callForIf = createCallForSpecialConstruction(ifExpression, Lists.newArrayList(thenBranch, elseBranch)); + MutableDataFlowInfoForArguments dataFlowInfoForArguments = + createDataFlowInfoForArgumentsForIfCall(callForIf, thenInfo, elseInfo); + resolveSpecialConstructionAsCall( + callForIf, "If", Lists.newArrayList("thenBranch", "elseBranch"), + Lists.newArrayList(false, false), + contextWithExpectedType, dataFlowInfoForArguments); thenTypeInfo = BindingContextUtils.getRecordedTypeInfo(thenBranch, context.trace.getBindingContext()); elseTypeInfo = BindingContextUtils.getRecordedTypeInfo(elseBranch, context.trace.getBindingContext()); diff --git a/compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt b/compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt new file mode 100644 index 00000000000..f557df0c6e3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt @@ -0,0 +1,28 @@ +package a + +trait A + +fun id(t: T): T = t +fun doList(l: List) = l +fun doInt(i: Int) = i + +fun strangeNullableList(f: (T) -> Unit): List? = throw Exception() +fun emptyNullableListOfA(): List? = null + +//------------------------------- + +fun testExclExcl() { + doList(emptyNullableListOfA()!!) //should be an error here + val l: List = id(emptyNullableListOfA()!!) + + doList(strangeNullableList { doInt(it) }!!) //lambda should be analyzed (at completion phase) +} + +fun testDataFlowInfoAfterExclExcl(a: Int?) { + doInt(a!!) + a + 1 +} + +fun testUnnecessaryExclExcl(a: Int) { + doInt(a!!) //should be warning +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/controlStructures/if/reportTypeMismatchDeeplyOnBranches.kt b/compiler/testData/diagnostics/tests/resolve/specialConstructions/reportTypeMismatchDeeplyOnBranches.kt similarity index 100% rename from compiler/testData/diagnostics/tests/controlStructures/if/reportTypeMismatchDeeplyOnBranches.kt rename to compiler/testData/diagnostics/tests/resolve/specialConstructions/reportTypeMismatchDeeplyOnBranches.kt diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index 277a707ab2b..96b77d2ba8e 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -1258,7 +1258,6 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage } @TestMetadata("compiler/testData/diagnostics/tests/controlStructures") - @InnerTestClasses({ControlStructures.If.class}) public static class ControlStructures extends AbstractDiagnosticsTestWithEagerResolve { public void testAllFilesPresentInControlStructures() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/controlStructures"), Pattern.compile("^(.+)\\.kt$"), true); @@ -1324,25 +1323,6 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt"); } - @TestMetadata("compiler/testData/diagnostics/tests/controlStructures/if") - public static class If extends AbstractDiagnosticsTestWithEagerResolve { - public void testAllFilesPresentInIf() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/controlStructures/if"), Pattern.compile("^(.+)\\.kt$"), true); - } - - @TestMetadata("reportTypeMismatchDeeplyOnBranches.kt") - public void testReportTypeMismatchDeeplyOnBranches() throws Exception { - doTest("compiler/testData/diagnostics/tests/controlStructures/if/reportTypeMismatchDeeplyOnBranches.kt"); - } - - } - - public static Test innerSuite() { - TestSuite suite = new TestSuite("ControlStructures"); - suite.addTestSuite(ControlStructures.class); - suite.addTestSuite(If.class); - return suite; - } } @TestMetadata("compiler/testData/diagnostics/tests/dataClasses") @@ -4738,7 +4718,7 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage } @TestMetadata("compiler/testData/diagnostics/tests/resolve") - @InnerTestClasses({Resolve.Invoke.class}) + @InnerTestClasses({Resolve.Invoke.class, Resolve.SpecialConstructions.class}) public static class Resolve extends AbstractDiagnosticsTestWithEagerResolve { public void testAllFilesPresentInResolve() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/resolve"), Pattern.compile("^(.+)\\.kt$"), true); @@ -4807,10 +4787,29 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage } + @TestMetadata("compiler/testData/diagnostics/tests/resolve/specialConstructions") + public static class SpecialConstructions extends AbstractDiagnosticsTestWithEagerResolve { + public void testAllFilesPresentInSpecialConstructions() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/diagnostics/tests/resolve/specialConstructions"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("exclExclAsCall.kt") + public void testExclExclAsCall() throws Exception { + doTest("compiler/testData/diagnostics/tests/resolve/specialConstructions/exclExclAsCall.kt"); + } + + @TestMetadata("reportTypeMismatchDeeplyOnBranches.kt") + public void testReportTypeMismatchDeeplyOnBranches() throws Exception { + doTest("compiler/testData/diagnostics/tests/resolve/specialConstructions/reportTypeMismatchDeeplyOnBranches.kt"); + } + + } + public static Test innerSuite() { TestSuite suite = new TestSuite("Resolve"); suite.addTestSuite(Resolve.class); suite.addTestSuite(Invoke.class); + suite.addTestSuite(SpecialConstructions.class); return suite; } } @@ -5378,7 +5377,7 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage suite.addTestSuite(Cast.class); suite.addTestSuite(CheckArguments.class); suite.addTestSuite(ControlFlowAnalysis.class); - suite.addTest(ControlStructures.innerSuite()); + suite.addTestSuite(ControlStructures.class); suite.addTestSuite(DataClasses.class); suite.addTest(DataFlow.innerSuite()); suite.addTestSuite(DataFlowInfoTraversal.class);