You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: userdocs/diagnostics/embedded-restrictions.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,50 +8,50 @@ Diagnostics in the `EmbeddedRestrictions` group describe those language features
8
8
9
9
*`weak` and `unowned` references, because Embedded Swift uses a simplified reference-counting model that cannot support them. For example:
10
10
11
-
class Node {
12
-
weak var parent: Node? // error: attribute 'weak' cannot be used in Embedded Swift
13
-
}
11
+
class Node {
12
+
weak var parent: Node? // error: attribute 'weak' cannot be used in Embedded Swift
13
+
}
14
14
15
15
* Dynamic casts to a type involving a protocol are not supported, because Embedded Swift does not include runtime metadata about protocol conformances. For example:
16
16
17
-
protocol P: AnyObject { }
18
-
func casting(object: AnyObject) {
19
-
if let p = object as? P { // error: cannot perform a dynamic cast to a type involving protocol 'P' in Embedded Swift
20
-
// ...
17
+
protocol P: AnyObject { }
18
+
func casting(object: AnyObject) {
19
+
if let p = object as? P { // error: cannot perform a dynamic cast to a type involving protocol 'P' in Embedded Swift
20
+
// ...
21
+
}
21
22
}
22
-
}
23
23
24
24
* Non-final generic methods in a class, which are prohibited because they cannot be specialized for every possible call site. For example:
25
25
26
-
class MyGenericClass<T> {
27
-
func f<U>(value: U) { } // warning: generic instance method 'f(value:)' in a class must be 'final' in Embedded Swift
26
+
class MyGenericClass<T> {
27
+
func f<U>(value: U) { } // warning: generic instance method 'f(value:)' in a class must be 'final' in Embedded Swift
28
28
29
-
func g() { } // okay, not generic relative to the class itself
29
+
func g() { } // okay, not generic relative to the class itself
30
30
31
-
class func h() where T: P { } // warning: generic class method 'h()' in a class must be 'final' in Embedded Swift
32
-
}
31
+
class func h() where T: P { } // warning: generic class method 'h()' in a class must be 'final' in Embedded Swift
32
+
}
33
33
34
34
* Generic methods used on values of protocol type, which are prohibited because they cannot be specialized for every possible call site. For example:
0 commit comments