Skip to content

Commit f7bef8d

Browse files
authored
Merge pull request #84471 from DougGregor/embedded-restrictions-diag-group-indentation
Fix indentation for the EmbeddedRestrictions diagnostic group
2 parents 3b55b32 + f1866d8 commit f7bef8d

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

userdocs/diagnostics/embedded-restrictions.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,50 @@ Diagnostics in the `EmbeddedRestrictions` group describe those language features
88

99
* `weak` and `unowned` references, because Embedded Swift uses a simplified reference-counting model that cannot support them. For example:
1010

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+
}
1414

1515
* Dynamic casts to a type involving a protocol are not supported, because Embedded Swift does not include runtime metadata about protocol conformances. For example:
1616

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+
}
2122
}
22-
}
2323

2424
* Non-final generic methods in a class, which are prohibited because they cannot be specialized for every possible call site. For example:
2525

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
2828

29-
func g() { } // okay, not generic relative to the class itself
29+
func g() { } // okay, not generic relative to the class itself
3030

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+
}
3333

3434
* Generic methods used on values of protocol type, which are prohibited because they cannot be specialized for every possible call site. For example:
3535

36-
protocol P: AnyObject {
37-
func doNothing()
38-
func doSomething<T>(on value: T)
39-
}
36+
protocol P: AnyObject {
37+
func doNothing()
38+
func doSomething<T>(on value: T)
39+
}
4040

41-
func testGenerics<Value: P>(value: value, i: Int) {
42-
value.doNothing() // okay
43-
value.doSomething(on: i) // okay, always specialized
44-
}
41+
func testGenerics<Value: P>(value: value, i: Int) {
42+
value.doNothing() // okay
43+
value.doSomething(on: i) // okay, always specialized
44+
}
4545

46-
func testValuesOfProtocolType(value: any P, i: Int) {
47-
value.doNothing() // okay
48-
value.doSomething(on: i) // warning: cannot use generic instance method 'doSomething(on:)' on a value of type 'any P' in Embedded Swift
49-
}
46+
func testValuesOfProtocolType(value: any P, i: Int) {
47+
value.doNothing() // okay
48+
value.doSomething(on: i) // warning: cannot use generic instance method 'doSomething(on:)' on a value of type 'any P' in Embedded Swift
49+
}
5050

5151
* Use of untyped throws, which depends on `any Error` and is not available in Embedded Swift. Use typed throws instead:
5252

53-
func mayFail() throws { } // error: untyped throws is not available in Embedded Swift; add a thrown error type with '(type)'
54-
func mayFail() throws(MyError) // okay
53+
func mayFail() throws { } // error: untyped throws is not available in Embedded Swift; add a thrown error type with '(type)'
54+
func mayFail() throws(MyError) // okay
5555

5656
## See Also
5757

0 commit comments

Comments
 (0)