On Sep 19, 2015, at 10:54 , Michael de Haan <[email protected]> wrote:
>
> func createMOforEntityName<T, U >(entityName:String,
> context:NSManagedObjectContext, key:String, keyAttribute: U) -> (Bool, T) {
>
> guard let mo:T = self.moExistsWith(entityName, key:key, keyAttribute:
> keyAttribute) else {
It looks like Swift is incapable of resolving the specialization of U when
there is more than one generic type specifier:
> class A
> {
> func a<T,U> (p: U) -> T
> {
> b (p)
> }
> func a1<U> (p: U)
> {
> b (p)
> }
> func b<U> (q: U)
> {
> print (q)
> }
> }
>
> func z ()
> {
> A ().a ("aa”) // error: cannot invoke 'a' with an argument list of type
> '(String)’ // note: expected an argument list of type '(U)'
> A ().a1 ("aa”) // (just fine)
> }
I’ve seen other cases where multiple generic type specifiers caused Swift to
decide it’s too hard to understand what you want. They seem to get fixed over
time. Sounds like you need a bug report, and an unsatisfying temporary
workaround.
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]