mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
40 lines
1.2 KiB
Swift
40 lines
1.2 KiB
Swift
// RUN: %target-parse-verify-swift %clang-importer-sdk
|
|
|
|
// REQUIRES: OS=macosx
|
|
|
|
import AppKit
|
|
|
|
class MyDocument : NSDocument {
|
|
override func read(from URL: NSURL, ofType type: String) throws {
|
|
try super.read(from: URL, ofType: type)
|
|
}
|
|
|
|
override func write(to URL: NSURL, ofType type: String) throws {
|
|
try super.write(to: URL, ofType: type)
|
|
}
|
|
}
|
|
|
|
func test(URL: NSURL, controller: NSDocumentController) {
|
|
try! NSDocument(contentsOf: URL, ofType: "") // expected-warning{{unused}}
|
|
try! MyDocument(contentsOf: URL, ofType: "")
|
|
|
|
try! controller.makeDocument(withContentsOf: URL, ofType: "")
|
|
}
|
|
|
|
extension NSBox {
|
|
func foo() {
|
|
print("abc") // expected-warning {{use of 'print' treated as a reference to instance method in class 'NSView'}}
|
|
// expected-note@-1 {{use 'self.' to silence this warning}} {{5-5=self.}}
|
|
// expected-note@-2 {{use 'Swift.' to reference the global function}} {{5-5=Swift.}}
|
|
}
|
|
}
|
|
|
|
class MyView : NSView {
|
|
func foo() {
|
|
print("abc") // expected-warning {{use of 'print' treated as a reference to instance method in class 'NSView'}}
|
|
// expected-note@-1 {{use 'self.' to silence this warning}} {{5-5=self.}}
|
|
// expected-note@-2 {{use 'Swift.' to reference the global function}} {{5-5=Swift.}}
|
|
}
|
|
}
|
|
|