   @objc
   func h() -> Int { }
 }
+
+func testOptionalChaining(c1: C1?, s1: S1?) {
+  c1?.f1()         // okay
+  c1!.f1()         // okay
+  c1?.f1Optional() // okay
+  c1!.f1Optional() // okay
+  c1?.f2()         // expected-warning {{result of call to 'f2()' is unused}}
+  c1!.f2()         // expected-warning {{result of call to 'f2()' is unused}}
+  c1?.f2Optional() // expected-warning {{result of call to 'f2Optional()' is unused}}
+  c1!.f2Optional() // expected-warning {{result of call to 'f2Optional()' is unused}}
+
+  s1?.f1()         // okay
+  s1!.f1()         // okay
+  s1?.f1Optional() // okay
+  s1!.f1Optional() // okay
+  s1?.f2()         // expected-warning {{result of call to 'f2()' is unused}}
+  s1!.f2()         // expected-warning {{result of call to 'f2()' is unused}}
+  s1?.f2Optional() // expected-warning {{result of call to 'f2Optional()' is unused}}
+  s1!.f2Optional() // expected-warning {{result of call to 'f2Optional()' is unused}}
+}

  func f1() -> Int { }

  func f2() -> Int { }
}

func testFunctionsInStruct(s1 : S1) {

  func f2() -> Int { }

  @discardableResult
  func f1Optional() -> Int? { }

  func f2Optional() -> Int? { }

  @discardableResult
  func me() -> Self { return self }

  func reallyMe() -> Self { return self }
