Factor the constraint-favoring machinery out of the constraint generation process, and re-work it into a series of passes over an expression sub-tree.

Aside from tidying things up, doing this results in some significant benefits:
- Allows for global constraint ordering optimizations over a given expression, not just on a peephole basis.
- Eliminates a set of order-dependent bugs in the solver that have been dogging us for a while. (rdar://problem/19459079)
- Brings another set of tyvar-to-tyvar solving problems out of the realm of the exponential. (rdar://problem/19005271)
- Opens up the possibility of optimizing constraints during later solving phases - not just while generating them.

Swift SVN r24693
This commit is contained in:
Joe Pamer
2015-01-23 23:10:50 +00:00
parent cb2870c230
commit a18bedf079
4 changed files with 753 additions and 491 deletions

View File

@@ -867,7 +867,7 @@ extension UTF16 {
/// Requires: `width(x) == 2`
public static func leadSurrogate(x: UnicodeScalar) -> UTF16.CodeUnit {
_precondition(width(x) == 2)
return UTF16.CodeUnit((x.value - 0x1_0000) >> 10) + 0xD800
return UTF16.CodeUnit((x.value - 0x1_0000) >> (10 as UInt32)) + 0xD800
}
/// Return the low surrogate code unit of a `surrogate pair