Fix for EA-53605 - UOE: PackageType.throwException
This commit is contained in:
@@ -84,4 +84,9 @@ public class PackageType implements JetType {
|
||||
throwException();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[Package-type " + name + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ public class KotlinBuiltIns {
|
||||
}
|
||||
|
||||
public boolean isFunctionType(@NotNull JetType type) {
|
||||
if (setContainsClassOf(functionClassesSet, type)) return true;
|
||||
if (!(type instanceof PackageType) && setContainsClassOf(functionClassesSet, type)) return true;
|
||||
|
||||
for (JetType superType : type.getConstructor().getSupertypes()) {
|
||||
if (isFunctionType(superType)) return true;
|
||||
@@ -737,11 +737,12 @@ public class KotlinBuiltIns {
|
||||
}
|
||||
|
||||
public boolean isExactFunctionOrExtensionFunctionType(@NotNull JetType type) {
|
||||
return setContainsClassOf(extensionFunctionClassesSet, type) || setContainsClassOf(functionClassesSet, type);
|
||||
return !(type instanceof PackageType)
|
||||
&& (setContainsClassOf(extensionFunctionClassesSet, type) || setContainsClassOf(functionClassesSet, type));
|
||||
}
|
||||
|
||||
public boolean isExtensionFunctionType(@NotNull JetType type) {
|
||||
if (setContainsClassOf(extensionFunctionClassesSet, type)) return true;
|
||||
if (!(type instanceof PackageType) && setContainsClassOf(extensionFunctionClassesSet, type)) return true;
|
||||
|
||||
for (JetType superType : type.getConstructor().getSupertypes()) {
|
||||
if (isExtensionFunctionType(superType)) return true;
|
||||
|
||||
@@ -245,6 +245,9 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
||||
}
|
||||
return "???";
|
||||
}
|
||||
if (type instanceof PackageType) {
|
||||
return type.toString();
|
||||
}
|
||||
if (type instanceof LazyType && debugMode) {
|
||||
return type.toString();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
object A {
|
||||
class B
|
||||
fun foo() = 1
|
||||
object Bar{}
|
||||
}
|
||||
|
||||
fun test<T>(a: T) {
|
||||
val c = (a as A)
|
||||
c.<error descr="[FUNCTION_EXPECTED] Expression 'B' of type '[Package-type B]' cannot be invoked as a function. The function invoke() is not found"><error>B</error></error>()
|
||||
}
|
||||
@@ -306,6 +306,11 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest {
|
||||
doTest("idea/testData/checker/regression/CoercionToUnit.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("createInnerInstance.kt")
|
||||
public void testCreateInnerInstance() throws Exception {
|
||||
doTest("idea/testData/checker/regression/createInnerInstance.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DoubleDefine.kt")
|
||||
public void testDoubleDefine() throws Exception {
|
||||
doTest("idea/testData/checker/regression/DoubleDefine.kt");
|
||||
|
||||
Reference in New Issue
Block a user