Merge branch 'prototype/Swift_3_2' into prototype/Swift_4_0

This commit is contained in:
John Rommel Estropia
2017-09-17 01:10:11 +09:00

View File

@@ -401,13 +401,14 @@ internal extension Collection where Iterator.Element == SelectTerm {
return entity.attributesByName[components[0]] return entity.attributesByName[components[0]]
default: default:
guard let relationship = entity.relationshipsByName[components[0]] else { guard let relationship = entity.relationshipsByName[components[0]],
let destinationEntity = relationship.destinationEntity else {
return nil
return nil
} }
return attributeDescription( return attributeDescription(
for: components.dropFirst().joined(separator: "."), for: components.dropFirst().joined(separator: "."),
in: relationship.entity in: destinationEntity
) )
} }
} }
@@ -418,18 +419,7 @@ internal extension Collection where Iterator.Element == SelectTerm {
switch term { switch term {
case ._attribute(let keyPath): case ._attribute(let keyPath):
let entityDescription = fetchRequest.entity! propertiesToFetch.append(keyPath)
if let attributeDescription = attributeDescription(for: keyPath, in: entityDescription) {
propertiesToFetch.append(attributeDescription)
}
else {
CoreStore.log(
.warning,
message: "The key path \"\(keyPath)\" could not be resolved in entity \(cs_typeName(entityDescription.managedObjectClassName)) as an attribute and will be ignored by \(cs_typeName(owner)) query clause."
)
}
case ._aggregate(let function, let keyPath, let alias, let nativeType): case ._aggregate(let function, let keyPath, let alias, let nativeType):
let entityDescription = fetchRequest.entity! let entityDescription = fetchRequest.entity!