Repository: apple/swift
File: include/swift/AST/Types.h (C/C++)

Code before:
                                                  ->getCanonicalType());
  }

  CanType getYieldValueType(SILModule &M, const SILFunctionType *fnType,
                            TypeExpansionContext context) const {
    return getArgumentType(M, fnType, context);
  }

  /// Treating this yield info as a component of the given function
  /// type, apply any substitutions from the function type to it to
  /// get a substituted version of it, as you would get from
  /// SILFunctionType::getUnsubstitutedType.
  SILYieldInfo getUnsubstituted(SILModule &M, const SILFunctionType *fnType,
                                TypeExpansionContext context) const {
    return getWithInterfaceType(getYieldValueType(M, fnType, context));
  }
};

/// SILCoroutineKind - What kind of coroutine is this SILFunction?
enum class SILCoroutineKind : uint8_t {
  /// This function is not a coroutine.  It may have arbitrary normal
  /// results and may not have yield results.
  None,

  /// This function is a yield-once coroutine (used by e.g. accessors).
  /// It must not have normal results and may have arbitrary yield results.
  YieldOnce,

  /// This function is a yield-once coroutine (used by read and modify
  /// accessors).  It has the following differences from YieldOnce:
  /// - it does not observe errors thrown by its caller (unless the feature
  /// CoroutineAccessorsUnwindOnCallerError is enabled)
  /// - it uses the callee-allocated ABI
  YieldOnce2,

  /// This function is a yield-many coroutine (used by e.g. generators).
  /// It must not have normal results and may have arbitrary yield results.
  YieldMany,
};

class SILFunctionConventions;

Type substOpaqueTypesWithUnderlyingTypes(Type type,
                                         TypeExpansionContext context);

CanType substOpaqueTypesWithUnderlyingTypes(CanType type,
                                            TypeExpansionContext context);

ProtocolConformanceRef
substOpaqueTypesWithUnderlyingTypes(ProtocolConformanceRef ref,
                                    TypeExpansionContext context);

Review comment (suggestion):
I've been editing comments throughout to try to consistently use the term "legacy" to refer to the `_read` and `_modify` accessors to help clarify the relationship between those and the SE-0474 yielding accessors.

Code after:
                                                  ->getCanonicalType());
  }

  CanType getYieldValueType(SILModule &M, const SILFunctionType *fnType,
                            TypeExpansionContext context) const {
    return getArgumentType(M, fnType, context);
  }

  /// Treating this yield info as a component of the given function
  /// type, apply any substitutions from the function type to it to
  /// get a substituted version of it, as you would get from
  /// SILFunctionType::getUnsubstitutedType.
  SILYieldInfo getUnsubstituted(SILModule &M, const SILFunctionType *fnType,
                                TypeExpansionContext context) const {
    return getWithInterfaceType(getYieldValueType(M, fnType, context));
  }
};

/// SILCoroutineKind - What kind of coroutine is this SILFunction?
enum class SILCoroutineKind : uint8_t {
  /// This function is not a coroutine.  It may have arbitrary normal
  /// results and may not have yield results.
  None,

  /// This function is a yield-once coroutine (used by legacy
  /// `_read` and `_modify` accessors).
  /// It must not have normal results and may have arbitrary
  /// yield results.
  YieldOnce,

  /// This function is a yield-once coroutine (used by `yielding borrow`
  /// and `yielding mutate` accessors).
  /// Unlike YieldOnce, the second half of the coroutine is _always_
  /// run, even if an error is thrown within the access scope.
  /// It also uses a more efficient callee-allocated ABI.
  YieldOnce2,

  /// This function is a yield-many coroutine (used by e.g. generators).
  /// It must not have normal results and may have arbitrary yield results.
  YieldMany,
};

class SILFunctionConventions;

Type substOpaqueTypesWithUnderlyingTypes(Type type,
                                         TypeExpansionContext context);

CanType substOpaqueTypesWithUnderlyingTypes(CanType type,
                                            TypeExpansionContext context);

ProtocolConformanceRef