     expression = constraintSeq
   compiledType = new Constrained constraints, typeCompile ctx, type
   if name = ctx.definitionName()
-    ctx.declare ctx.definitionName()
-    assignExplicitType ctx, compiledType
+    declareExplicitlyTyped ctx, compiledType
   call.tea = compiledType
   assignCompile ctx, call, (termCompile ctx, expression)
 

          # log "done unifying one"

        # have to promote constraints from just compiled dependencies
        depConstraints = concat (for dep in binding.deps or [] when cononicalType = ctx.actualType dep.name
          constraintsFromCanonicalType ctx, cononicalType, dep.type)
        allConstraints = (join binding.constraints or [], depConstraints)


    any (for {className} in type.constraints
      lookupInMap (@classNamed className).declarations, name)

  ## Macro declarations

  declareMacro: (name, macro) ->
    name.id = macro.id = @freshId()
    addToMap @_scope().macros, name.symbol, macro

  isMacroDeclared: (name) ->
    !!@macro name

  macro: (name) ->
    @_macroInScope @scopes.length - 1, name

  _macroInScope: (i, name) ->
    (lookupInMap @scopes[i].macros, name) or
      (not @_declarationInScope i, name) and i > 0 and (@_macroInScope i - 1, name) or
      undefined # throw "Could not find macro for #{name}"

  ## In-scope Declarations
  # For each name in a scope:
  #   type: (? Type)
  #   arity: (? [String])
  #   id: Int
  #   final: Bool

  isDeclared: (name) ->
    !!(@_declaration name)

  isCurrentlyDeclared: (name) ->
    (declaration = @_declarationInCurrentScope name) and declaration.final

  isTyped: (name) ->
    !!@type name

  isPreTyped: (name) ->
    !!(@preDeclaredType name)

  isFinallyTyped: (name) ->
    !!@finalType name

  typeForId: (id) ->
    @types[id]

  type: (name) ->
    (@_declaration name)?.type

  finalType: (name) ->
    (type = @type name) and (type not instanceof TempType) and type

  preDeclaredType: (name) ->
    (@_preDeclaration name)?.type

  currentDeclarations: ->
    cloneMap @_scope()

  assignType: (name, type) ->
    if declaration = @_declarationInCurrentScope name
      if declaration.type and declaration.type not instanceof TempType
        throw new Error "assignType: #{name} already has a type"
      declaration.type = type
