001 /*
002 * Copyright 2010-2015 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.jetbrains.kotlin.resolve.calls.inference;
018
019 import org.jetbrains.annotations.NotNull;
020 import org.jetbrains.annotations.Nullable;
021 import org.jetbrains.kotlin.descriptors.CallableDescriptor;
022 import org.jetbrains.kotlin.psi.Call;
023 import org.jetbrains.kotlin.types.KotlinType;
024
025 import java.util.List;
026
027 public class InferenceErrorData {
028 @NotNull
029 public final CallableDescriptor descriptor;
030 @NotNull
031 public final ConstraintSystem constraintSystem;
032 @Nullable
033 public final KotlinType receiverArgumentType;
034 @NotNull
035 public final KotlinType expectedType;
036 @NotNull
037 public final List<KotlinType> valueArgumentsTypes;
038 @NotNull
039 public final Call call;
040
041 private InferenceErrorData(
042 @NotNull CallableDescriptor descriptor,
043 @NotNull ConstraintSystem constraintSystem,
044 @NotNull List<KotlinType> valueArgumentsTypes,
045 @Nullable KotlinType receiverArgumentType,
046 @NotNull KotlinType expectedType,
047 @NotNull Call call
048 ) {
049 this.descriptor = descriptor;
050 this.constraintSystem = constraintSystem;
051 this.receiverArgumentType = receiverArgumentType;
052 this.valueArgumentsTypes = valueArgumentsTypes;
053 this.expectedType = expectedType;
054 this.call = call;
055 }
056
057 @NotNull
058 public static InferenceErrorData create(
059 @NotNull CallableDescriptor descriptor,
060 @NotNull ConstraintSystem constraintSystem,
061 @NotNull List<KotlinType> valueArgumentsTypes,
062 @Nullable KotlinType receiverArgumentType,
063 @NotNull KotlinType expectedType,
064 @NotNull Call call
065 ) {
066 return new InferenceErrorData(descriptor, constraintSystem, valueArgumentsTypes, receiverArgumentType, expectedType, call);
067 }
068 }