File: EmbeddedStubs.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (245 lines) | stat: -rw-r--r-- 7,679 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

import SwiftShims

/// String

@_unavailableInEmbedded
public struct String: Hashable { 
    public var utf8CString: ContiguousArray<CChar> { fatalError() }
    public init() {}
    public init(validatingCString: UnsafePointer<CChar>) { fatalError() }
}

@_unavailableInEmbedded
extension String {
  public init<Subject>(describing instance: Subject) { fatalError() }
  public init<Subject>(reflecting instance: Subject) { fatalError() }
}

@_unavailableInEmbedded
extension String {
  public static func + (lhs: String, rhs: String) -> String { fatalError() }
  public static func += (lhs: inout String, rhs: String) { fatalError() }
}

@_unavailableInEmbedded
extension String {
  public var isContiguousUTF8: Bool { fatalError() }
  public mutating func makeContiguousUTF8() { fatalError() }
  public mutating func withUTF8<R>(_ body: (UnsafeBufferPointer<UInt8>) throws -> R) rethrows -> R { fatalError() }
  public var utf8: ContiguousArray<UInt8> { fatalError() }
  public var utf16: ContiguousArray<UInt16> { fatalError() }
  public var debugDescription: String { fatalError() }
}

@_unavailableInEmbedded
public func debugPrint(_ items: Any..., separator: String = " ", terminator: String = "\n") { fatalError() }

@_unavailableInEmbedded
public func debugPrint<Target: TextOutputStream>(_ items: Any..., separator: String = " ", terminator: String = "\n", to output: inout Target) { fatalError() }

@_unavailableInEmbedded
extension String: TextOutputStream {
  public mutating func write(_ other: String) { fatalError() }
  public mutating func _writeASCII(_ buffer: UnsafeBufferPointer<UInt8>) { fatalError() }
}

@_unavailableInEmbedded
extension String: _ExpressibleByBuiltinUnicodeScalarLiteral {
  public init(_builtinUnicodeScalarLiteral value: Builtin.Int32) { fatalError() }
  public init(_ scalar: UInt32) { fatalError() }
}

@_unavailableInEmbedded
extension String: _ExpressibleByBuiltinExtendedGraphemeClusterLiteral {
  public init(_builtinExtendedGraphemeClusterLiteral start: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) { fatalError() }
}

@_unavailableInEmbedded
extension String: _ExpressibleByBuiltinStringLiteral {
  public init(_builtinStringLiteral start: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) { fatalError() }
}

@_unavailableInEmbedded
extension String: ExpressibleByStringLiteral {
  public init(stringLiteral value: String) { fatalError() }
}

@_unavailableInEmbedded
public protocol CustomStringConvertible {
 var description: String { get }
}

@_unavailableInEmbedded
public protocol CustomDebugStringConvertible {
  var debugDescription: String { get }
}

@_unavailableInEmbedded
public struct DefaultStringInterpolation: StringInterpolationProtocol, Sendable {
  public typealias StringLiteralType = String

  public init(literalCapacity: Int, interpolationCount: Int) { fatalError() }
  public mutating func appendLiteral(_ literal: StringLiteralType) { fatalError() }
  public mutating func appendInterpolation<T>(_: T) { fatalError() }

  internal __consuming func make() -> String { fatalError() }
}

@_unavailableInEmbedded
extension String {
  @inlinable
  @_effects(readonly)
  public init(stringInterpolation: DefaultStringInterpolation) { fatalError() }
}

@_unavailableInEmbedded
extension String: ExpressibleByStringInterpolation { }

@_unavailableInEmbedded
public protocol LosslessStringConvertible: CustomStringConvertible {
  init?(_ description: String)
}

@_unavailableInEmbedded
public protocol TextOutputStream {
  mutating func _lock()
  mutating func _unlock()
  mutating func write(_ string: String)
  mutating func _writeASCII(_ buffer: UnsafeBufferPointer<UInt8>)
}

@_unavailableInEmbedded
extension TextOutputStream {
  public mutating func _lock() {}
  public mutating func _unlock() {}
  public mutating func _writeASCII(_ buffer: UnsafeBufferPointer<UInt8>) {}
}

@_unavailableInEmbedded
public protocol TextOutputStreamable {
  func write<Target: TextOutputStream>(to target: inout Target)
}

@_unavailableInEmbedded
extension String {
  internal static func _fromUTF8Repairing(_ input: UnsafeBufferPointer<UInt8>) -> (result: String, repairsMade: Bool) { fatalError() }
}

@_unavailableInEmbedded
extension String {
  internal static func _fromASCII(_ input: UnsafeBufferPointer<UInt8>) -> String { fatalError() }
  internal static func _uncheckedFromUTF8( _ input: UnsafeBufferPointer<UInt8>) -> String { fatalError() }
  internal static func _uncheckedFromUTF8(_ input: UnsafeBufferPointer<UInt8>, isASCII: Bool) -> String { fatalError() }
  internal static func _uncheckedFromUTF8(_ input: UnsafeBufferPointer<UInt8>, asciiPreScanResult: Bool) -> String { fatalError() }
}

@_unavailableInEmbedded
extension String {
  public init<T: BinaryInteger>(_ value: T, radix: Int = 10, uppercase: Bool = false) { fatalError() }
}

/// Unicode

public enum Unicode {}

public typealias UTF8 = Unicode.UTF8
public typealias UTF16 = Unicode.UTF16

extension Unicode {
  public enum UTF8 {
  }
  public enum UTF16 {
  }
}

extension Unicode.UTF8 {
  public typealias CodeUnit = UInt8
}

extension Unicode.UTF16 {
  public typealias CodeUnit = UInt16
}

@_unavailableInEmbedded
extension String {
  public init(_ value: Unicode.Scalar) { fatalError() }
}

/// Codable

@_unavailableInEmbedded
public protocol Encodable {
  func encode(to encoder: any Encoder) throws
}

@_unavailableInEmbedded
public protocol Decodable {
  init(from decoder: any Decoder) throws
}

@_unavailableInEmbedded
public typealias Codable = Encodable & Decodable

@_unavailableInEmbedded
public protocol CodingKey { }

@_unavailableInEmbedded
public struct KeyedDecodingContainer<K: CodingKey> { }

@_unavailableInEmbedded
public struct KeyedEncodingContainer<K: CodingKey> { }

@_unavailableInEmbedded
public protocol UnkeyedDecodingContainer { 
  mutating func decode<T>(_ type: T.Type) throws -> T
}

@_unavailableInEmbedded
public protocol UnkeyedEncodingContainer { 
  mutating func encode<T>(_ value: T) throws
}

@_unavailableInEmbedded
public protocol SingleValueDecodingContainer { }

@_unavailableInEmbedded
public protocol SingleValueEncodingContainer { }

@_unavailableInEmbedded
public protocol Encoder {
  var codingPath: [any CodingKey] { get }
  func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key>
  func unkeyedContainer() -> any UnkeyedEncodingContainer
  func singleValueContainer() -> any SingleValueEncodingContainer
}

@_unavailableInEmbedded
public protocol Decoder {
  var codingPath: [any CodingKey] { get }
  func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key>
  func unkeyedContainer() throws -> any UnkeyedDecodingContainer
  func singleValueContainer() throws -> any SingleValueDecodingContainer
}

@_unavailableInEmbedded
public enum DecodingError: Error {
  public struct Context: Sendable {
    public init(codingPath: [any CodingKey], debugDescription: String, underlyingError: Error? = nil) { fatalError() }
  }
  case typeMismatch(Any.Type, Context)
  case valueNotFound(Any.Type, Context)
  case keyNotFound(any CodingKey, Context)
  case dataCorrupted(Context)
}