From 20808705952890f9d4a0aa8134486cacdc02ca26 Mon Sep 17 00:00:00 2001 From: "a.teplyakov" Date: Tue, 14 Aug 2018 15:13:06 +0300 Subject: [PATCH] fix optional unwrapping for new compiler version '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)' --- Sources/EasyDi.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/EasyDi.swift b/Sources/EasyDi.swift index 1accd07..d60fef6 100644 --- a/Sources/EasyDi.swift +++ b/Sources/EasyDi.swift @@ -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 {