Commit Graph

105 Commits

Author SHA1 Message Date
Doug Gregor
690d6c446b [AST] Record whether a closure was type-checked in its enclosing expression
Rather than using various "applied function builder" and "is single
expression body" checks to determine whether a closure was
type-checked in its enclosing expression, record in the closure
expression whether it actually *was* type-checked as part of its
enclosing expression.
2020-06-03 22:26:20 -07:00
Doug Gregor
761ee54006 [Constraint system] Use a visitor for solution application to closures.
Introduce a statement visitor that applies a particular solution to
the body of a closure. This matches the mechanism used by function
builders (and is similar to how we handle expressions in general),
simplifying the logic for handling
conversion-to-void-returning-closures and
conversion-from-Never-returning-bodies. It is a stepping stone for
type inference of multi-statement closures.
2020-05-31 00:03:56 -07:00
Doug Gregor
af048d6953 [Constraint system] Move solution application for closures to CSClosure.
Slim down CSApply.cpp by moving the logic for applying a solution to a
closure into CSClosure.cpp. Also, eliminate duplicated logic for applying
function builders to the body of a closure or function. This should
not change semantics at all.
2020-05-30 22:44:30 -07:00
Doug Gregor
b9b8f08f54 [Constraint system] Switch closure constraint generation to a visitor.
In preparation for implementing support for multiple-statement closure
inference, switch closure constraint generation over to a statement
visitor. Only the subset of statements that correspond to
single-expression closures is currently handled; there is no way to
enable this for multiple-statement closures yet.
2020-05-29 22:00:37 -07:00
Doug Gregor
451e3cc480 [Constraint system] Move closure type checking to a separate file. 2020-05-29 21:05:02 -07:00