Fixed assertion error for incomplete code.
This commit is contained in:
@@ -79,11 +79,13 @@ public class PseudocodeVariableDataCollector(
|
|||||||
if (instruction is VariableDeclarationInstruction) {
|
if (instruction is VariableDeclarationInstruction) {
|
||||||
val variableDeclarationElement = instruction.getVariableDeclarationElement()
|
val variableDeclarationElement = instruction.getVariableDeclarationElement()
|
||||||
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, variableDeclarationElement)
|
val descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, variableDeclarationElement)
|
||||||
assert(descriptor is VariableDescriptor,
|
if (descriptor != null) {
|
||||||
"Variable descriptor should correspond to the instruction for ${instruction.getElement().getText()}.\n" +
|
assert(descriptor is VariableDescriptor,
|
||||||
"Descriptor : $descriptor")
|
"Variable descriptor should correspond to the instruction for ${instruction.getElement().getText()}.\n" +
|
||||||
lexicalScopeVariableInfo.registerVariableDeclaredInScope(
|
"Descriptor : $descriptor")
|
||||||
descriptor as VariableDescriptor, instruction.getLexicalScope())
|
lexicalScopeVariableInfo.registerVariableDeclaredInScope(
|
||||||
|
descriptor as VariableDescriptor, instruction.getLexicalScope())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return lexicalScopeVariableInfo
|
return lexicalScopeVariableInfo
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
fun foo(s: String) {
|
||||||
|
s.
|
||||||
|
<!ILLEGAL_SELECTOR!>val b = 42<!>
|
||||||
|
}
|
||||||
@@ -3416,6 +3416,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest("compiler/testData/diagnostics/tests/incompleteCode/typeParameterOnLhsOfDot.kt");
|
doTest("compiler/testData/diagnostics/tests/incompleteCode/typeParameterOnLhsOfDot.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("variableDeclarationInSelector.kt")
|
||||||
|
public void testVariableDeclarationInSelector() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/incompleteCode/variableDeclarationInSelector.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError")
|
@TestMetadata("compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError")
|
||||||
public static class DiagnosticWithSyntaxError extends AbstractJetDiagnosticsTest {
|
public static class DiagnosticWithSyntaxError extends AbstractJetDiagnosticsTest {
|
||||||
public void testAllFilesPresentInDiagnosticWithSyntaxError() throws Exception {
|
public void testAllFilesPresentInDiagnosticWithSyntaxError() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user