 // Test NSKeyValueObservingCustomization issue with observing from the callbacks
 //===----------------------------------------------------------------------===//
 
+// The following tests are only expected to pass when running with the
+// Swift 5.1 and later libraries.
+if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
+  print("-check-prefix=CHECK-51")
+} else {
+  print("-check-prefix=DONT-CHECK")
+  // Need at least one check, otherwise FileCheck will complain.
+  // DONT-CHECK: {{.}}
+}
+
 class Target2 : NSObject, NSKeyValueObservingCustomization {
     @objc dynamic var name: String?
 

// RUN: %target-run-simple-swift | %FileCheck %s
// REQUIRES: executable_test

// REQUIRES: objc_interop

_ = NSSortDescriptor(keyPath: \Sortable2.name, ascending: true)
print("keyPath == \\Sortable1.name:", descriptor.keyPath == \Sortable1.name)

// CHECK-51-LABEL: creating NSSortDescriptor
// CHECK-51-NEXT: keyPath == \Sortable1.name: true
