         # for dep in deps
         #   ctx.addToDeferredBindings {name: dep.name, type: dep.type, reversed: name}
         if not ctx.isTyped name
-          ctx.assignType name, (new TempType type)
+          originatingScope = Math.max (originScopeIndex for {originScopeIndex} in deps)...
+          ctx.assignType name, (new TempType type, originatingScope)
       else
         # Ready for typing since there are no missing dependencies
         deferredConstraints = inferType ctx, name, type, constraints, polymorphic

  constructor: (@kinds, @type) ->
    @ForAll = yes
class TempType
  constructor: (@type) ->
    @TempType = yes

class Types

      type = mapOrigin (freshInstance ctx, contextType), atom
      nameTranslate ctx, atom, symbol, type
    # In sub-scope (function) only defer compilation for declarations in current scope
    else if (not ctx.isCurrentlyDeclared symbol) and (ctx.isDeclared symbol) or
        contextType instanceof TempType and contextType.originatingScope < ctx.currentScopeIndex()
      # Typing deferred, use an impricise type var
      type = toConstrained ctx.freshTypeVariable star
      ctx.addToDeferredNames
        name: scopedName symbol, originScopeIndex = ctx.scopeIndexOfDeclaration symbol
        id: symbol
        type: (mapOrigin type, atom)
        scopeIndex: ctx.currentScopeIndex()
        originScopeIndex: originScopeIndex
      nameTranslate ctx, atom, symbol, type
    else
      # log "deferring in rhs for #{symbol}", ctx._deferrableDefinition().name
