UCSD-PL/RefScript — pull request #80 by panagosg7 (2014-10-26 08:29:21+00:00)
Title: Fix crash

This restores tests: `tests/pos/misc/formerly-crashing.ts` and `tests/neg/misc/formerly-crashing.ts`

The problem was with the copying of refinements at UpCasts:

In the following upcast:
```
p :: Point UP { x: int }
```
Any refinements associated with the LHS Point would expect the base variable `v` to be of sort `Point`.
When copied over to the RHS `v` becomes of sort `Object`. `v` could just be part of a substitution, which could cause bogus predicates to appear.

The fix is to substitute the base value `v` for `x` when moving refinements from LHS to RHS.

NOTE: This only happens for the top level refinements and only for Upcasts (not downcasts). It addresses the two offending tests cases but might break down the way.

Also fixed an issue on overload resolution based on the number of args of function arguments.