                                                          _ negativeInfinity: String,
                                                          _ nan: String) -> ObjectEncoder.DoubleEncodingStrategy {
         return .custom {
-            guard let encoder = $1 as? _Encoder else {
+            guard let encoder = $1 as? ObjectEncoder.Encoder else {
                 fatalError("unreachable")
             }
             if $0 == .infinity {

    public init() {}
    public func encode<T>(_ value: T, userInfo: [CodingUserInfoKey: Any] = [:]) throws -> Any where T: Swift.Encodable {
        do {
            let encoder = _Encoder(options, userInfo)
            var container = encoder.singleValueContainer()
            try container.encode(value)
            return encoder.object

    }
}

class _ObjectReferencingEncoder: ObjectEncoder.Encoder { // swiftlint:disable:this type_name
    private enum Reference { case mapping(String), sequence(Int) }

    private let encoder: ObjectEncoder.Encoder
    private let reference: Reference

    fileprivate init(referencing encoder: ObjectEncoder.Encoder, key: CodingKey) {
        self.encoder = encoder
        reference = .mapping(key.stringValue)
        super.init(encoder.options, encoder.userInfo, encoder.codingPath + [key])
    }

    fileprivate init(referencing encoder: ObjectEncoder.Encoder, at index: Int) {
        self.encoder = encoder
        reference = .sequence(index)
        super.init(encoder.options, encoder.userInfo, encoder.codingPath + [_ObjectCodingKey(index: index)])
