Exemplo n.º 1
0
 @Override
 @NotNull
 public ConstraintSystem copy() {
   ConstraintSystemImpl newConstraintSystem = new ConstraintSystemImpl();
   for (Map.Entry<TypeParameterDescriptor, TypeConstraintsImpl> entry :
       typeParameterConstraints.entrySet()) {
     TypeParameterDescriptor typeParameter = entry.getKey();
     TypeConstraintsImpl typeConstraints = entry.getValue();
     newConstraintSystem.typeParameterConstraints.put(typeParameter, typeConstraints.copy());
   }
   newConstraintSystem.errorConstraintPositions.addAll(errorConstraintPositions);
   newConstraintSystem.hasErrorInConstrainingTypes = hasErrorInConstrainingTypes;
   return newConstraintSystem;
 }
Exemplo n.º 2
0
  @NotNull
  public ConstraintSystem replaceTypeVariables(
      @NotNull Function<TypeParameterDescriptor, TypeParameterDescriptor> typeVariablesMap) {
    ConstraintSystemImpl newConstraintSystem = new ConstraintSystemImpl();
    for (Map.Entry<TypeParameterDescriptor, TypeConstraintsImpl> entry :
        typeParameterConstraints.entrySet()) {
      TypeParameterDescriptor typeParameter = entry.getKey();
      TypeConstraintsImpl typeConstraints = entry.getValue();

      TypeParameterDescriptor newTypeParameter = typeVariablesMap.apply(typeParameter);
      assert newTypeParameter != null;
      newConstraintSystem.typeParameterConstraints.put(newTypeParameter, typeConstraints);
    }
    newConstraintSystem.errorConstraintPositions.addAll(errorConstraintPositions);
    newConstraintSystem.hasErrorInConstrainingTypes = hasErrorInConstrainingTypes;
    return newConstraintSystem;
  }