Improve script template not found diagnostics
(preliminary, see also TODO)
This commit is contained in:
@@ -146,6 +146,7 @@ public class ScriptCodegen extends MemberCodegen<KtScript> {
|
|||||||
Type classType = typeMapper.mapType(scriptDescriptor);
|
Type classType = typeMapper.mapType(scriptDescriptor);
|
||||||
|
|
||||||
ClassDescriptor superclass = DescriptorUtilsKt.getSuperClassNotAny(scriptDescriptor);
|
ClassDescriptor superclass = DescriptorUtilsKt.getSuperClassNotAny(scriptDescriptor);
|
||||||
|
// TODO: throw if class is not found)
|
||||||
|
|
||||||
if (superclass == null) {
|
if (superclass == null) {
|
||||||
iv.load(0, classType);
|
iv.load(0, classType);
|
||||||
@@ -153,7 +154,7 @@ public class ScriptCodegen extends MemberCodegen<KtScript> {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ConstructorDescriptor ctorDesc = superclass.getUnsubstitutedPrimaryConstructor();
|
ConstructorDescriptor ctorDesc = superclass.getUnsubstitutedPrimaryConstructor();
|
||||||
assert ctorDesc != null;
|
if (ctorDesc == null) throw new RuntimeException("Primary constructor not found for script template " + superclass.toString());
|
||||||
|
|
||||||
iv.load(0, classType);
|
iv.load(0, classType);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user