Additional catch for ReenteringLazyValueComputationException #KT-8448 Fixed

Also #EA-76264 Fixed
This commit is contained in:
Mikhail Glukhikh
2016-01-27 18:17:02 +03:00
parent 5062ce2804
commit 7fd1f507e4
4 changed files with 23 additions and 1 deletions
@@ -194,7 +194,15 @@ public abstract class ExpressionTypingVisitorDispatcher extends KtVisitor<Kotlin
// todo save scope before analyze and fix debugger: see CodeFragmentAnalyzer.correctContextForExpression
BindingContextUtilsKt.recordScope(context.trace, context.scope, expression);
BindingContextUtilsKt.recordDataFlowInfo(context.replaceDataFlowInfo(result.getDataFlowInfo()), expression);
recordTypeInfo(expression, result);
try {
// Here we have to resolve some types, so the following exception is possible
// Example: val a = ::a, fun foo() = ::foo
recordTypeInfo(expression, result);
}
catch (ReenteringLazyValueComputationException e) {
context.trace.report(TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM.on(expression));
return TypeInfoFactoryKt.noTypeInfo(context);
}
return result;
}
catch (ProcessCanceledException e) {
@@ -0,0 +1,4 @@
// StackOverflow
val p = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>::p<!>
fun foo() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>::foo<!>
@@ -0,0 +1,4 @@
package
public val p: [ERROR : Type for ::p]
public fun foo(): [ERROR : Error function type]
@@ -13224,6 +13224,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("ea76264.kt")
public void testEa76264() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/ea76264.kt");
doTest(fileName);
}
@TestMetadata("ErrorsOnIbjectExpressionsAsParameters.kt")
public void testErrorsOnIbjectExpressionsAsParameters() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.kt");