mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Update test to remove dependency on Foundation.
Using APIs from Foundation and the standard library can be a source of pain and can create fragile tests due to API changes. This reduces the test case to pure swift and eliminates the use of the standard library APIs.
This commit is contained in:
@@ -4,22 +4,17 @@
|
||||
// RUN: %target-swift-frontend -parse -primary-file %t/main.swift -emit-reference-dependencies-path - > %t.swiftdeps
|
||||
|
||||
// SR-1267, SR-1270
|
||||
import Foundation
|
||||
class TypeType<T> { }
|
||||
protocol ProtocolType {}
|
||||
|
||||
class TypeType<T where T: NSString> {
|
||||
func call(notification: NSNotification?) {
|
||||
let set = NSOrderedSet()
|
||||
if let objects = set.array as? [T] {
|
||||
let _ = (notification?.userInfo?["great_key"] as? NSSet).flatMap { updatedObjects in
|
||||
return updatedObjects.filter({ element in
|
||||
guard let element = element as? T
|
||||
where objects.index(of: element) != nil
|
||||
else {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
} ?? []
|
||||
}
|
||||
struct StructType<T> { }
|
||||
extension StructType where T : ProtocolType {
|
||||
func testCase<T>() -> TypeType<T> {
|
||||
return TypeType<T>()
|
||||
}
|
||||
}
|
||||
|
||||
class TestView : ProtocolType {}
|
||||
extension StructType where T : TestView {
|
||||
var typeType : TypeType<T> { return testCase() }
|
||||
}
|
||||
Reference in New Issue
Block a user