Skip to content

Commit

Permalink
Sequester expressions the PlaygroundTransform adds, isolating type-ch…
Browse files Browse the repository at this point in the history
…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
scallanan committed Jul 1, 2015
1 parent 9fe5103 commit 872a1c8
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 84 deletions.
Loading

0 comments on commit 872a1c8

Please sign in to comment.