Skip to content

Commit 8102a8e

Browse files
committed
Unified: Add constructors to builtins
1 parent 909aa94 commit 8102a8e

1 file changed

Lines changed: 79 additions & 18 deletions

File tree

‎unified/tools/builtins/types.swift‎

Lines changed: 79 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,116 @@
11
// Provides built-in Swift types
22

3-
struct Bool {}
3+
struct Bool {
4+
public init() {}
5+
}
46

5-
struct Int {}
7+
struct Int {
8+
public init() {}
9+
}
610

711
struct String {
12+
public init() {}
813
public init<T>(_ value: T) where T: LosslessStringConvertible {
914
fatalError("Dummy implementation.")
1015
}
1116
}
1217

1318
struct Character {}
1419

15-
struct Substring {}
20+
struct Substring {
21+
public init() {}
22+
}
1623

17-
struct Int8 {}
24+
struct Int8 {
25+
public init() {}
26+
}
1827

19-
struct Int16 {}
28+
struct Int16 {
29+
public init() {}
30+
}
2031

21-
struct Int32 {}
32+
struct Int32 {
33+
public init() {}
34+
}
2235

23-
struct Int64 {}
36+
struct Int64 {
37+
public init() {}
38+
}
2439

25-
struct UInt {}
40+
struct UInt {
41+
public init() {}
42+
}
2643

27-
struct UInt8 {}
44+
struct UInt8 {
45+
public init() {}
46+
}
2847

29-
struct UInt16 {}
48+
struct UInt16 {
49+
public init() {}
50+
}
3051

31-
struct UInt32 {}
52+
struct UInt32 {
53+
public init() {}
54+
}
3255

33-
struct UInt64 {}
56+
struct UInt64 {
57+
public init() {}
58+
}
3459

35-
struct Float16 {}
60+
struct Float16 {
61+
public init() {}
62+
}
3663

37-
struct Float {}
64+
struct Float {
65+
public init() {}
66+
}
3867

39-
struct Double {}
68+
struct Double {
69+
public init() {}
70+
}
4071

41-
struct Float80 {}
72+
struct Float80 {
73+
public init() {}
74+
}
4275

4376
struct Array<Element> {
77+
public init() {}
78+
public init<S>(_ elements: S) where S: Sequence, Element == S.Element {}
79+
public init(
80+
repeating repeatedValue: Element,
81+
count: Int
82+
) {}
83+
public init<E>(
84+
unsafeUninitializedCapacity: Int,
85+
initializingWith initializer: (inout UnsafeMutableBufferPointer<Element>, inout Int)
86+
throws(E) -> Void
87+
) throws(E) where E: Error {}
4488
public func map<T, E>(_ transform: (Element) throws(E) -> T) throws(E) -> [T]
4589
where E: Error {
4690
fatalError("Dummy implementation.")
4791
}
4892
}
4993

50-
struct Dictionary<Key, Value> {}
94+
struct Dictionary<Key, Value> {
95+
public init() {}
96+
public init(minimumCapacity: Int) {}
97+
public init<S>(uniqueKeysWithValues keysAndValues: S)
98+
where S: Sequence, S.Element == (Key, Value) {}
99+
public init<S, E>(
100+
_ keysAndValues: S,
101+
uniquingKeysWith combine: (Value, Value) throws(E) -> Value
102+
) throws(E) where S: Sequence, E: Error, S.Element == (Key, Value) {}
103+
public init<S, E>(
104+
grouping values: S,
105+
by keyForValue: (S.Element) throws(E) -> Key
106+
) throws(E) where Value == [S.Element], S: Sequence, E: Error {}
107+
}
51108

52-
struct Set<Element> {}
109+
struct Set<Element> {
110+
public init() {}
111+
public init(minimumCapacity: Int) {}
112+
public init<Source>(_ sequence: Source) where Element == Source.Element, Source: Sequence {}
113+
}
53114

54115
enum Optional<Wrapped> {
55116
case none

0 commit comments

Comments
 (0)