   else
     to
 
-irReference = (name, type, arity) ->
-  {ir: irReferenceTranslate, name, type, arity}
-
-irReferenceTranslate = (ctx, {name, type, arity}) ->
+irReference = (name, id, type, arity) ->
+  {ir: irReferenceTranslate, name, id, type, arity}
+
+irReferenceTranslate = (ctx, {name, id, type, arity}) ->
   if ctx.isMethod name, type
     translateIr ctx, (irMethod type, name)
   else
-    finalType = addConstraintsFrom ctx, {name, type}, substitute ctx.substitution, type
+    finalType = addConstraintsFrom ctx, {id, type}, substitute ctx.substitution, type
     classParams = dictsForConstraint ctx, finalType.constraints
     if classParams.length > 0
       (irFunctionTranslate ctx,

    @scopes = [topScope]
    @savedScopes = []
    @classParams = newMap()
    @isMalformed = no

  macros: ->

      if declaration.type and declaration.type not instanceof TempType
        throw new Error "assignType: #{name} already has a type"
      declaration.type = type
      @types[declaration.id] = type
    else
      throw new Error "assignType: #{name} is not declared"

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

  currentDeclarations: ->
    cloneMap @_scope()

  declareArity: (name, arity) ->
    @declare name, arity: arity
