     # TODO: support lookup of composite types, by traversing left depth-first
     if type.type.type.name is constraint.type.name
       return validIdentifier name
-  throw new Error "no instance for #{printType constraint}"
+  throw new Error "no instance for #{safePrintType constraint}"
 
 irFunction = ({name, params, body}) ->
   {ir: irFunctionTranslate, name, params, body}

  for className, dict of values ctx.classParamsForType constraint
    if chain = findSuperClassChain ctx, className, constraint.className
      return accessList dict, chain
  throw new Error "Couldn't find dict for #{printType constraint}"

findSuperClassChain = (ctx, className, targetClassName) ->
  for s in (ctx.classNamed className).supers


  # Properly bind types according to the pattern
  if pattern.tea
    # log "pattern", matched.tea, pattern.tea
    unify ctx, matched.tea.type, pattern.tea.type

  # log "pattern compiel", definedNames, pattern
