mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Xcode 10 importUniqueObjects Into<T>() issue #230
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ps-mmaierhuber on GitHub (Sep 13, 2018).
Hey there,
This works totally fine in any Xcode 9 but fails to compile in Xcode 10 (beta and GM), when trying to import:
Cannot convert value of type 'Into<T>' to expected argument type 'Into<_>'Any hints?
@JohnEstropia commented on GitHub (Sep 14, 2018):
@ps-mmaierhuber I'm more surprised this compiles in Xcode 9 at all.
Into()needs a generic type, in your case tryInto<T>()instead ofInto().@ps-mmaierhuber commented on GitHub (Sep 14, 2018):
@JohnEstropia i am using
Into<T>()- apparently github tries to apply markdown.I also tried
Into(T.self)
@JohnEstropia commented on GitHub (Sep 21, 2018):
I'm guessing your
importObjectsmethod isn't binding your generic types properly. Or that you have another compiler error somewhere that is masked by this error message. Can you show your wholefunc importObjects(...)implementation?@ps-mmaierhuber commented on GitHub (Sep 24, 2018):
Yeah the thing that i dont understand is that it works with any Xcode 9, but not with Xcode 10 ...
There is the code and how it is called, including the first type inference.
and its called from the response parser like this:
Im using Moya... but here the generic T is inferred to a concrete model, User is a subclass of BaseModel.
The ParseCompletion is a typealiased generic:
@JohnEstropia commented on GitHub (Sep 25, 2018):
@ps-mmaierhuber In your
func importObjectsimplementation, can you try if this works?@ps-mmaierhuber commented on GitHub (Sep 25, 2018):
Doesnt work. I tried:
Into<T>(into)and
Into(into)also tried specifying the returned objects type to T, also tried using BaseModel, doesnt work. It is always complaining about this argument in importUniqueObjects
These things works just fine if i add them there:
@bendalton commented on GitHub (Oct 3, 2018):
I too would like the answer 👍 Hi @ps-mmaierhuber !
@JohnEstropia commented on GitHub (Oct 4, 2018):
@ps-mmaierhuber @bendalton Can any of you isolate the models and methods in a separate project? The app doesn't need to run, just a reproduction of the compiler error would greatly help.
@puelocesar commented on GitHub (Oct 5, 2018):
@JohnEstropia Here: https://github.com/puelocesar/CoreStoreTest
Builds with Xcode 9 but not with Xcode 10
@JohnEstropia commented on GitHub (Oct 5, 2018):
@puelocesar That was really helpful, thanks!
This looks bizarre. It actually works if we use
where T: ImportableUniqueObject, S.Iterator.Element == T.ImportSourcefor the function constraint, albeit the obviously ignorable compiler warning.I'm pretty sure we hit a compiler issue here. I'll try to raise this in the Swift bug tracker within the weekend. Let me know if any of you already have a ticket/rdar so I can duplicate.
@JohnEstropia commented on GitHub (Oct 5, 2018):
To clarify, the issue isn't with
Into<T>but withSequencenot propagating it's element's associated type properly. You can try that this too will not compile:and the same workaround
where T: ImportableUniqueObject, S.Iterator.Element == T.ImportSourcewould also work@puelocesar commented on GitHub (Oct 5, 2018):
I'm getting
Redundant conformance constraint 'T': 'ImportableUniqueObject'as a Swift warning, but other then that, it works, thanks!@JohnEstropia commented on GitHub (Oct 9, 2018):
Reported in Swift bug tracker: https://bugs.swift.org/browse/SR-8945