forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfixits-apply.swift.result
69 lines (54 loc) · 1.14 KB
/
fixits-apply.swift.result
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
// RUN: not %swift -parse -target %target-triple %s -emit-fixits-path %t.remap
// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %s.result
class Base {}
class Derived : Base {}
var b : Base
b as! Derived
b as! Derived
b
var opti : Int?
// Don't add bang.
var i : Int = opti
// But remove unnecessary bang.
var i2 : Int = i
struct MyMask : OptionSet {
init(_ rawValue: UInt) {}
init(rawValue: UInt) {}
init(nilLiteral: ()) {}
var rawValue: UInt { return 0 }
static var allZeros: MyMask { return MyMask(0) }
static var Bingo: MyMask { return MyMask(1) }
}
func supported() -> MyMask {
return MyMask.Bingo
}
func goo(e : ErrorProtocol) {
var e = e
}
func goo2(e: ErrorProtocol) { var e = e }
func goo3(e: Int) { var e = e; e = 3 }
protocol A {
func bar(s: Int)
}
extension A {
func bar(s: Int) {
var s = s
s += 5
}
}
func baz(x: Int) {
var x = x
x += 10
}
func foo(y: String, x: inout Int) {
}
struct Test1 : OptionSet {
init(rawValue: Int) {}
var rawValue: Int { return 0 }
}
print("", false)
func ftest1() {
// Don't replace the variable name with '_'
let myvar = 0
}
func ftest2(x: Int) {}