 # 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

    # console.log "attaching", t1.name, t2
    # console.log "attached", (printType t2)
    newSubstitution()
  else if t1.QuantifiedVar and t2.QuantifiedVar # used when checking declared type
    if t1.name isnt t2.name
      unifyFail t1, t2
  else if t1.TypeConstr and t2.TypeConstr and t1.name is t2.name
    emptySubstitution()
  else if t1.TypeApp and t2.TypeApp
