Additional checks for type alias constructors.

This commit is contained in:
Dmitry Petrov
2016-09-15 18:20:39 +03:00
committed by Dmitry Petrov
parent 796d11c860
commit dac9d8b845
10 changed files with 258 additions and 5 deletions
@@ -210,14 +210,14 @@ class CallExpressionResolver(
return noTypeInfo(context)
}
if (functionDescriptor is ConstructorDescriptor) {
val containingDescriptor = functionDescriptor.containingDeclaration
if (DescriptorUtils.isAnnotationClass(containingDescriptor) && !canInstantiateAnnotationClass(callExpression, context.trace)) {
val constructedClass = functionDescriptor.constructedClass
if (DescriptorUtils.isAnnotationClass(constructedClass) && !canInstantiateAnnotationClass(callExpression, context.trace)) {
context.trace.report(ANNOTATION_CLASS_CONSTRUCTOR_CALL.on(callExpression))
}
if (DescriptorUtils.isEnumClass(containingDescriptor)) {
if (DescriptorUtils.isEnumClass(constructedClass)) {
context.trace.report(ENUM_CLASS_CONSTRUCTOR_CALL.on(callExpression))
}
if (DescriptorUtils.isSealedClass(containingDescriptor)) {
if (DescriptorUtils.isSealedClass(constructedClass)) {
context.trace.report(SEALED_CLASS_CONSTRUCTOR_CALL.on(callExpression))
}
}