Checks for primitive types and arrays made static in KotlinBuiltIns
This commit is contained in:
+1
-1
@@ -51,7 +51,7 @@ public class ConstantExpressionEvaluator private (val trace: BindingTrace) : Jet
|
||||
DescriptorUtils.isClassObject(descriptor.getContainingDeclaration()) ||
|
||||
DescriptorUtils.isStaticDeclaration(descriptor)) {
|
||||
val returnType = descriptor.getType()
|
||||
return KotlinBuiltIns.getInstance().isPrimitiveType(returnType) || KotlinBuiltIns.getInstance().getStringType() == returnType
|
||||
return KotlinBuiltIns.isPrimitiveType(returnType) || KotlinBuiltIns.isString(returnType)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ public class CompileTimeConstantUtils {
|
||||
if (isEnumClass(typeDescriptor) ||
|
||||
isAnnotationClass(typeDescriptor) ||
|
||||
isJavaLangClass(typeDescriptor) ||
|
||||
builtIns.isPrimitiveArray(parameterType) ||
|
||||
builtIns.isPrimitiveType(parameterType) ||
|
||||
KotlinBuiltIns.isPrimitiveArray(parameterType) ||
|
||||
KotlinBuiltIns.isPrimitiveType(parameterType) ||
|
||||
builtIns.getStringType().equals(parameterType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (builtIns.isArray(parameterType)) {
|
||||
if (KotlinBuiltIns.isArray(parameterType)) {
|
||||
List<TypeProjection> arguments = parameterType.getArguments();
|
||||
if (arguments.size() == 1) {
|
||||
JetType arrayType = arguments.get(0).getType();
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.jetbrains.jet.lang.psi.JetDeclaration;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.lang.types.TypeProjection;
|
||||
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
|
||||
@@ -69,7 +68,7 @@ public class MainFunctionDetector {
|
||||
ValueParameterDescriptor parameter = parameters.get(0);
|
||||
JetType parameterType = parameter.getType();
|
||||
KotlinBuiltIns kotlinBuiltIns = KotlinBuiltIns.getInstance();
|
||||
if (kotlinBuiltIns.isArray(parameterType)) {
|
||||
if (KotlinBuiltIns.isArray(parameterType)) {
|
||||
List<TypeProjection> typeArguments = parameterType.getArguments();
|
||||
if (typeArguments.size() == 1) {
|
||||
JetType typeArgument = typeArguments.get(0).getType();
|
||||
|
||||
Reference in New Issue
Block a user