Files
swift-mirror/test/FixCode/fixits-apply.swift.result
Argyrios Kyrtzidis 6b8ee42248 [fixcode] Accept the fixit for adding bang to unwrap optional.
This is useful for getting fixits for the IOU handling changes.
2016-05-11 13:58:24 -07:00

70 lines
1.1 KiB
Plaintext

// 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?
// 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) -> Int) {}