Store resolution context for light classes to prevent back-end fail
This commit is contained in:
@@ -366,7 +366,7 @@ public class PackageCodegen {
|
|||||||
SmartList<PackageFragmentDescriptor> fragments = new SmartList<PackageFragmentDescriptor>();
|
SmartList<PackageFragmentDescriptor> fragments = new SmartList<PackageFragmentDescriptor>();
|
||||||
for (JetFile file : files) {
|
for (JetFile file : files) {
|
||||||
PackageFragmentDescriptor fragment = state.getBindingContext().get(BindingContext.FILE_TO_PACKAGE_FRAGMENT, file);
|
PackageFragmentDescriptor fragment = state.getBindingContext().get(BindingContext.FILE_TO_PACKAGE_FRAGMENT, file);
|
||||||
assert fragment != null : "package fragment is null for " + file;
|
assert fragment != null : "package fragment is null for " + file + "\n" + file.getText();
|
||||||
|
|
||||||
assert expectedFqName.equals(fragment.getFqName()) :
|
assert expectedFqName.equals(fragment.getFqName()) :
|
||||||
"expected package fq name: " + expectedFqName + ", actual: " + fragment.getFqName();
|
"expected package fq name: " + expectedFqName + ", actual: " + fragment.getFqName();
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
|||||||
|
|
||||||
if (descriptor == null) {
|
if (descriptor == null) {
|
||||||
LOG.warn("No class descriptor in context for class: " + JetPsiUtil.getElementTextWithContext(classOrObject));
|
LOG.warn("No class descriptor in context for class: " + JetPsiUtil.getElementTextWithContext(classOrObject));
|
||||||
return new LightClassConstructionContext(BindingContext.EMPTY, session.getModuleDescriptor());
|
return new LightClassConstructionContext(bindingContext, session.getModuleDescriptor());
|
||||||
}
|
}
|
||||||
|
|
||||||
ForceResolveUtil.forceResolveAllContents(descriptor);
|
ForceResolveUtil.forceResolveAllContents(descriptor);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun main(args: Array<String>) {
|
||||||
|
String.class
|
||||||
|
<error descr="Class name expected">}</error><EOLError descr="Expecting '}"></EOLError>
|
||||||
|
|
||||||
|
// EA-56152: An attempt to build light class in checker to get diagnotics
|
||||||
@@ -375,6 +375,12 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("BadParseForClass.kt")
|
||||||
|
public void testBadParseForClass() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/regression/BadParseForClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("CoercionToUnit.kt")
|
@TestMetadata("CoercionToUnit.kt")
|
||||||
public void testCoercionToUnit() throws Exception {
|
public void testCoercionToUnit() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/regression/CoercionToUnit.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/regression/CoercionToUnit.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user