Commit graph

8 commits

Author SHA1 Message Date
Cyrus Najmabadi d3fbebf3fb Never use the entire span of a function declaration or function expression when reporting a checker error. 2015-03-04 18:15:55 -08:00
Sheetal Nandi 9d31631fd7 Test cases of function infering return type of functions
if f is a contextually typed function expression (section 4.9.3), the inferred return type is the union type (section 3.3.4) of the types of the return statement expressions in the function body, ignoring return statements with no expressions.
Otherwise, the inferred return type is the first of the types of the return statement expressions in the function body that is a supertype (section 3.8.3) of each of the others, ignoring return statements with no expressions. A compile-time error occurs if no return statement expression has a type that is a supertype of each of the others.
2014-11-04 16:40:56 -08:00
Daniel Rosenwasser 9f7782d392 Added error 'prologue' to each error baseline. 2014-09-12 13:35:07 -07:00
Daniel Rosenwasser ee86f8b711 Harness now prints category and code when running tests. 2014-09-11 16:11:08 -07:00
Anders Hejlsberg 8199b0b236 Pull model for contextual types.
New baselines reflect a couple of unrelated bug fixes.
2014-07-29 18:21:16 -07:00
Daniel Rosenwasser 0f4e887155 Changed error message for annotated functions lacking return statements. 2014-07-21 16:42:48 -07:00
Daniel Rosenwasser d33127ad34 Complain when a non-void/any function lacks a return expresson.
In effect this fixes #62.

Also
    - Changes the error message for get accessors lacking return expressions.
    - Actually checks for return expressions instead of return statements for get-accessors.
    - Removes fancy quotes.
    - Corrects errors in the compiler caught by the new check.
    - Simplified `checkAndAggregateReturnTypes` by extracting it out to `visitReturnStatements`.
2014-07-21 16:42:41 -07:00
Mohamed Hegazy 214df64e28 Add snapshot of compiler sources 2014-07-12 17:30:19 -07:00