Skip to content

Commit

Permalink
fix optional unwrapping for new compiler version
Browse files Browse the repository at this point in the history
'If value is nil and the type T is an Optional type at runtime, the return value will now be .some(nil) rather than nil. This behavior is consistent with the casting behavior when concrete types are used rather than generic types. (40916953)'
  • Loading branch information
a.teplyakov committed Aug 14, 2018
1 parent 8d862e9 commit 2080870
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/EasyDi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,11 @@ open class Assembly: AssemblyInternal {
result = singleton as! ObjectType

// And trying to return object from graph
} else if let objectFromStack = context.objectGraphStorage[key] as? ObjectType, scope != .prototype {
} else if let objectFromStack = context.objectGraphStorage[key],
scope != .prototype,
let unwrappedObject = objectFromStack as? ObjectType {

result = objectFromStack
result = unwrappedObject

} else {

Expand Down

0 comments on commit 2080870

Please sign in to comment.