check that main() returns Unit

#KT-12760 Fixed
This commit is contained in:
Dmitry Jemerov
2016-07-06 19:22:26 +02:00
parent 30d721c458
commit 972ebd5fec
@@ -101,6 +101,9 @@ class MainFunctionDetector {
return false
}
val returnType = descriptor.returnType
if (returnType == null || !KotlinBuiltIns.isUnit(returnType)) return false
if (DescriptorUtils.isTopLevelDeclaration(descriptor)) return true
val containingDeclaration = descriptor.containingDeclaration