Skip to content

Commit

Permalink
Log the binding that is duplicated
Browse files Browse the repository at this point in the history
  • Loading branch information
holmes committed Aug 31, 2016
1 parent a6f598b commit 7005d6c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Cleanse/Graph.swift
Expand Up @@ -109,11 +109,15 @@ class Graph : Binder {
private func addProvider(provider provider: AnyProvider) {
/// If Tag is a _VoidTag, then we want to add it as a provider without the tagged type
let key = RequirementKey(provider.dynamicType)

precondition(inOverridesMode || providers[key] == nil)

if !inOverridesMode {
if let existingKey = providers[key] {
fatalError("Already bound at \(existingKey.instanceProvidesType)")
}
}

providers[key] = provider


if let getterProvider = provider.anyGetterProvider {
providers[RequirementKey(getterProvider.dynamicType)] = getterProvider
}
Expand Down

0 comments on commit 7005d6c

Please sign in to comment.