title: Cast to Swift.Int from a Swift.Int as a generic fails surprisingly
body: <p>I have a complicated function that tries to cast arbitrary incoming parameters to known types. I get this error. </p>
  
  <pre><code>Could not cast value of type 'Swift.Int' (0x100a73aa8) to 'Swift.Int' (0x1002b7fb8).
  </code></pre>
  
  <p>Here's a rough outline of the function:</p>
  
  <pre><code>public func convert &lt;A, T&gt;(a:A, _ t:T.Type) -&gt; T? {
  
  print(t)  // Int
  print(T.self)  // Int
  print(T.self == Int.self)  // False. But why?
  
  ...
  
  // Well I got a little hacky since the rest of the checks failed...
  if "\(T.self)" == "Int" {
          let ret = Int(a as! NSNumber)
          print(ret) // 6, reports as an Int
          return ret as! T
  }
  </code></pre>
  
  <p>Im passing an NSNumber. It works when the code is in the same project.</p>
  
  <p>Its worth noting the types are being passed in from application code and this is in framework code. When I run it locally it works no problem. Could it be that the framework code is referring to a different type in memory than the application code? </p>
  
  <p>Also worth mentioning: this is a project with iOS and OSX targets. I only see the error below when running the OSX target.</p>
  
  <p><code>
  objc[24993]: Class _TtC6AppKit15REPLApplication is implemented in both /Users/Damouse/Library/Developer/Xcode/DerivedData/FabAgainstBackend-ajqzosbfxnphgjaabtlaawsjsywj/Build/Products/Debug/Riffle.framework/Versions/A/Frameworks/libswiftAppKit.dylib and /Users/Damouse/Library/Developer/Xcode/DerivedData/FabAgainstBackend-ajqzosbfxnphgjaabtlaawsjsywj/Build/Products/Debug/FabAgainstBackend. One of the two will be used. Which one is undefined.
  </code></p>