Xcode-6.3 (6D570): Static extensions on generic types arent found

Originator:segiddins
Number:rdar://20594075 Date Originated:17-Apr-2015 03:10 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-6.3 (6D570)
Classification:Serious Bug Reproducible:Always
 
Summary:
Static extensions on generic types arent found by the compiler.

Steps to Reproduce:
Attempt to compile the following swift code:
import Foundation

class OptCls: NSObject {
  dynamic var s: String?
  dynamic var nos: String = ""
  dynamic var nss: NSString?
  dynamic var ius: String!
  dynamic var i: Int = 0
  dynamic var o = NSObject()
  dynamic var oo: OptCls?
}

extension Optional {
  static func getT() -> Any.Type {
    println("\(T.self)")
    return T.self
  }
}

func getOptionalPropertyNames(object: AnyObject) -> NSDictionary {
    let reflection = reflect(object)

    var properties = [String:String]()

    // Skip the first property (super):
    // super is an implicit property on Swift objects
    for i in 1..<reflection.count {
        println("reflection: \(reflection[i])")
        // let prop = class_getProperty(object.dynamicType, reflection[i].0)
        // println(String.fromCString(property_getAttributes(prop)))
        let mirror = reflection[i].1
        let valueType = mirror.valueType
        println("value type: \(valueType)")
        if mirror.disposition == .Optional {
            let t: Any.Type = (mirror.value as Optional).getT()
            println(t)
            properties[reflection[i].0] = toString(valueType)
        }
        println()
    }

    return properties
}

let props = getOptionalPropertyNames(OptCls())
println(props)

Expected Results:
The code should compile, and getT() should be called 4 times.

Actual Results:
The following compiler error:
error: 'Optional<T>' does not have a member named 'getT'

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!