title: Strange error with KeyPath on optional value
body: <p>Consider the following snippet of code</p>
  <pre class="lang-swift prettyprint-override"><code>class A {
      
      var value: Int?
      
  }
  
  let a: A? = A()
  let kp = \A.value
  a?[keyPath: kp] = 10
  print(a?.value)
  </code></pre>
  <p>This works perfectly and <code>Optional(10)</code> is printed as expected. In my actual app the field I'm trying to set this way is declared as <code>Date?</code> and it causes some strange errors. The MWE of my actual app is this:</p>
  <pre class="lang-swift prettyprint-override"><code>class A {
      
      var value: Date?
      
  }
  
  let a: A! = A()
  let kp = \A.value
  a?[keyPath: kp] = Date() // Line with error
  print(a?.value)
  </code></pre>
  <p>However the compiler complains about the highlighted line and says:</p>
  <blockquote>
  <p>Value of optional type 'Date?' must be unwrapped to a value of type 'Date'</p>
  <p>Fix: Coalesce using '??' to provide a default when the optional value contains 'nil'</p>
  <p>Fix: Force-unwrap using '!' to abort execution if the optional value contains 'nil'</p>
  </blockquote>
  <p>Is this a bug of the compiler we can expect to be fixed before the final release or there's something I'm not understanding about key-paths?</p>
  <p>I'm using Xcode 11 beta 3 but I've encountered the same problem also in beta 2. If it can be useful the actual code is <a href="https://github.com/piscoTech/Workout/blob/master/Workout/Controller/FilterListTVC.swift#L216" rel="nofollow noreferrer">here</a>.</p>