Fix for EA-53605 - UOE: PackageType.throwException
This commit is contained in:
@@ -84,4 +84,9 @@ public class PackageType implements JetType {
|
|||||||
throwException();
|
throwException();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "[Package-type " + name + "]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -727,7 +727,7 @@ public class KotlinBuiltIns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFunctionType(@NotNull JetType type) {
|
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()) {
|
for (JetType superType : type.getConstructor().getSupertypes()) {
|
||||||
if (isFunctionType(superType)) return true;
|
if (isFunctionType(superType)) return true;
|
||||||
@@ -737,11 +737,12 @@ public class KotlinBuiltIns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExactFunctionOrExtensionFunctionType(@NotNull JetType type) {
|
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) {
|
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()) {
|
for (JetType superType : type.getConstructor().getSupertypes()) {
|
||||||
if (isExtensionFunctionType(superType)) return true;
|
if (isExtensionFunctionType(superType)) return true;
|
||||||
|
|||||||
@@ -245,6 +245,9 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
}
|
}
|
||||||
return "???";
|
return "???";
|
||||||
}
|
}
|
||||||
|
if (type instanceof PackageType) {
|
||||||
|
return type.toString();
|
||||||
|
}
|
||||||
if (type instanceof LazyType && debugMode) {
|
if (type instanceof LazyType && debugMode) {
|
||||||
return type.toString();
|
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");
|
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")
|
@TestMetadata("DoubleDefine.kt")
|
||||||
public void testDoubleDefine() throws Exception {
|
public void testDoubleDefine() throws Exception {
|
||||||
doTest("idea/testData/checker/regression/DoubleDefine.kt");
|
doTest("idea/testData/checker/regression/DoubleDefine.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user