 # Assumes definition name
 preDeclareExplicitlyTyped = (ctx, type, docs) ->
   explicitType = quantifyUnbound ctx, type
+  copyOrigin explicitType.type, type
   name = ctx.definitionName()
   id = ctx.definitionId()
   if ctx.isPreTyped name

  substitutionFail
    message: "#{message} #{(safePrintType first)}, #{(safePrintType second)}"
    conflicts: [(originOf first), (originOf second)]

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

      unifiedType = explicitType# substitute ctx.substitution, explicitType
      inferredType = quantifyUnbound ctx, unifiedType
      if not typeEq inferredType, updatedDeclaredType
        declaredTypeTooGeneral ctx, inferredType, updatedDeclaredType, declaredType
      # Context reduction
      isDeclaredConstraint = (c) ->
        entailed = entail ctx, unifiedType.constraints, c
