     return jsNoop()
   if bare and _notEmpty reducedConstraints
     ctx.extendSubstitution substitutionFail
-      message: "Ambiguous class constraints: #{map safePrintType, reducedConstraints}"
+      message: "Ambiguous class constraints: #{map prettyPrintForError, reducedConstraints}"
     return "null";
   ctx.updateClassParams()
   # TODO: what about the class dictionaries order?

typeFail = (message, t1, t2) ->
  [first, second] = sortBasedOnOriginPosition t1, t2
  substitutionFail
    message: "#{message} #{(safePrintType first)}, #{(safePrintType second)}"
    conflicts: [first, second]
    # types: [t1, t2]

sortBasedOnOriginPosition = (t1, t2) ->
  if (originOf t1)?.start > (originOf t2)?.start

  if declaringType and isFake declaringType
    declaringType.inferredType = replaceQuantifiedByOrigin fromInferred
  else
    inferred = "inferred #{prettyPrintForError fromInferred}"
    got = "got #{highlightTypeForError declaringType}"
    ctx.extendSubstitution substitutionFail
      message: "declared type is too general, " +
        if t1 is fromInferred then "#{inferred}, #{got}" else "#{got}, #{inferred}"
