Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sequester expressions the PlaygroundTransform adds, isolating type-ch…
…eck errors. We had a bit of back-and-forth over how to handle type-check errors in added expressions. Obviously all added expressions *should* type-check -- but we don't want the compiler (and, by extension, the XPC playground service) crashing when they don't. So the ErrorTypes from failed type-checks must not leak into existing code. In this solution, we use a convenience class (Added) that wraps an expression. It marks expressions we've constructed -- and we're only allowed to type-check Added<Expr*>s. (This isn't fully enforced -- you could still have Added<Expr*>s that refer to existing Expr*s) but adding this and plumbing it through caught most of the problems. I also added checks to various places that weren't checking whether type checking succeeded. In one case where we were emitting a source location for one element in a TupleExpr but not emitting source locations for the others (which caused dumping to assert) I eliminated that source location. Finally I added several test cases. These cases used to crash; one of them works perfectly now and I've XFAILed the other two. <rdar://problem/20444876> Swift SVN r29842
- Loading branch information