Bugfix/issue 849 mixed function returns

#### Summary:

Generalizes function returns to promote to return type if necessary, fixing issue #849

#### Intended Effect:

Use new promotion template function to promote return type to declared return type for function, basically making function returns covariant in the same way assignment is.  

Adds a new class to promote results `math/functions/promote_scalar` and a helper traits metaprogram `math/functions/promote_scalar_type`.  There are also versions in `math/functions/matrix` for Eigen matrices.

#### How to Verify:

The program that failed before, as reported in issue #849, is now checked in as `test/test-models/syntax-only/functions-promote-return.stan`.  There are extensive unit tests for all permutations of the new scalar promotion functions, including tests applied to `stan::agrad::var`

#### Side Effects:

None.

#### Documentation:

The behavior now matches the existing doc, so no documentation changes.

#### Reviewer Suggestions:

Anyone.