Type-directed name resolution

During typechecking, if Unison encounters a free term variable that is not a term name in the environment, Unison attemptstype-directed name resolution,which:

  1. Finds term definitions in the environment whoseunqualifiedname is the same as the free variable.
  2. If exactly one of those terms has a type that conforms to the expected type of the variable (the type system has always inferred this type already at this point), perform that substitution and resume typechecking.

If name resolution is unable to find the definition of a name, or is unable to disambiguate an ambiguous name, Unison reports an error.