- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathconsume_checking.swift
42 lines (37 loc) · 1.53 KB
/
consume_checking.swift
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
// RUN: %target-swift-frontend \
// RUN: -emit-sil -verify \
// RUN: %s \
// RUN: -sil-verify-all
////////////////////////////////////////////////////////////////////////////////
// https://github.com/apple/swift/issues/69252 {{
////////////////////////////////////////////////////////////////////////////////
publicenumLineEnding:String{
/// The default unix `\n` character
case lineFeed ="\n"
/// MacOS line ending `\r` character
case carriageReturn ="\r"
/// Windows line ending sequence `\r\n`
case carriageReturnLineFeed ="\r\n"
/// Initialize a line ending from a line string.
/// - Parameter line: The line to use
publicinit?(line:borrowingString){
guardlet lastChar = line.last,
let lineEnding =LineEnding(rawValue:String(lastChar))else{returnnil}
self= lineEnding
}
staticfunc makeLineEnding(_ line:borrowingString)->LineEnding?{
guardlet lastChar = line.last,
let lineEnding =LineEnding(rawValue:String(lastChar))else{returnnil}
_ = lineEnding
returnnil
}
func makeLineEnding(_ line:borrowingString)->LineEnding?{
guardlet lastChar = line.last,
let lineEnding =LineEnding(rawValue:String(lastChar))else{returnnil}
_ = lineEnding
returnnil
}
}
////////////////////////////////////////////////////////////////////////////////
// https://github.com/apple/swift/issues/69252 }}
////////////////////////////////////////////////////////////////////////////////