 public struct ByteBuffer {
     typealias Slice = _ByteBufferSlice
     typealias Allocator = ByteBufferAllocator
-    typealias Index = UInt32
-    typealias Capacity = UInt32
+    // these two type aliases should be made `@usableFromInline internal` for
+    // the 2.0 release when we can drop Swift 4.0 & 4.1 support. The reason they
+    // must be public is because Swift 4.0 and 4.1 don't support attributes for
+    // typealiases and Swift 4.2 warns if those attributes aren't present and
+    // the type is internal.
+    public typealias _Index = UInt32
+    public typealias _Capacity = UInt32
 
     @_versioned private(set) var _storage: _Storage
-    @_versioned private(set) var _readerIndex: Index = 0
-    @_versioned private(set) var _writerIndex: Index = 0
+    @_versioned private(set) var _readerIndex: _Index = 0
+    @_versioned private(set) var _writerIndex: _Index = 0
     @_versioned private(set) var _slice: Slice
 
     // MARK: Internal _Storage for CoW
     @_versioned final class _Storage {
-        private(set) var capacity: Capacity
+        private(set) var capacity: _Capacity
         @_versioned private(set) var bytes: UnsafeMutableRawPointer
         private(set) var fullSlice: Slice
         private let allocator: ByteBufferAllocator
 
-        public init(bytesNoCopy: UnsafeMutableRawPointer, capacity: Capacity, allocator: ByteBufferAllocator) {
+        public init(bytesNoCopy: UnsafeMutableRawPointer, capacity: _Capacity, allocator: ByteBufferAllocator) {
             self.bytes = bytesNoCopy
             self.capacity = capacity
             self.allocator = allocator

/// fits within 24 bits, otherwise the behaviour is undefined.
@_versioned
struct _ByteBufferSlice {
    @_versioned var upperBound: ByteBuffer.Index
    @_versioned var _begin: _UInt24
    @_versioned var lowerBound: ByteBuffer.Index {
        return UInt32(self._begin)
    }
    @_inlineable @_versioned var count: Int {

    }

    @_inlineable @_versioned
    mutating func _moveWriterIndex(to newIndex: _Index) {
        assert(newIndex >= 0 && newIndex <= _toCapacity(self._slice.count))
        self._writerIndex = newIndex
    }
