Find a file
Tim Chevalier d7ee55bfd0 (Almost) Always unify a function tail expr with the function result type
typeck::check_fn had an exception for the case where the tail expr
was compatible with type nil -- in that case, it doesn't unify the
tail expr's type with the enclosing function's result type. This
seems wrong to me. There are several test cases in Issue #719
that illustrate why. If the tail expr has type T, for some type
variable T that isn't resolved when this check happens, then T
never gets unified with anything, which is incorrect -- T should
be unified with the result type of the enclosing function. (The
bug was occurring because an unconstrained type variable is
compatible with type nil.)

Instead, I removed the check for type nil and added a check that
the function isn't an iterator -- if it's an iterator, I don't
check the tail expr's type against the function result type,
as that wouldn't make sense.

However, this broke two test cases, and after discussion with
brson, I understood that the purpose of the check was to allow
semicolons to be omitted in some cases. The whole thing seems
rather ad hoc. But I came up with a hacky compromise solution:
instead of checking whether the tailexpr type is *compatible*
with nil, we now just check whether it *is* nil. This also
necessitates calling resolve_type_vars_if_possible before
the check happens, which worries me. But, this fixes the bug
from Issue #719 without requiring changes to any test cases.

Closes #719 but I didn't try every variation -- so reopen the bug
if one of the variations still doesn't work.
2011-08-05 02:21:58 -07:00
doc Clarify docs about claim 2011-06-28 17:50:06 -07:00
mk rt: Stub shape glue and implement shape::print and shape::size_of. 2011-08-03 20:25:44 -07:00
src (Almost) Always unify a function tail expr with the function result type 2011-08-05 02:21:58 -07:00
.gitignore More additions to .gitignore. 2011-07-13 13:51:30 -07:00
AUTHORS.txt Add Jesse Ruderman to AUTHORS.txt 2011-07-10 17:08:18 -07:00
configure Add dedicated pretty-printer tests with new pp-exact directive 2011-08-02 10:39:13 -07:00
LICENSE.txt Update copyrights for completeness. 2011-05-03 12:10:03 -07:00
Makefile.in Revert 66c1ca857b 2011-07-27 15:44:21 +02:00
README Update README to point to github, test email notification. 2010-06-23 21:11:10 -07:00

This is a compiler and suite of associated libraries and documentation for the
Rust programming language.

See LICENSE.txt for terms of copyright and redistribution.

See http://github.com/graydon/rust for current development page.