static newNext(id, allPrevSegments) {
    return new CodePathSegment(
      id,
      CodePathSegment.flattenUnusedSegments(allPrevSegments),
      allPrevSegments.some(isReachable),
    );
  }
Creates a segment that follows given segments.
@param {string} id An identifier.
@param {CodePathSegment[]} allPrevSegments An array of the previous segments.
@returns {CodePathSegment} The created segment.