Commits

Jordan Rose committed 5faec6e1832
Don't crash when forward-referencing a local variable. Since we type-check local variables in statement order in a function, but resolve names on a whole-scope basis, we can end up with a name that refers to a local variable before its declaration has been reached. If this happens, the variable won't have a type. Checking this correctly may require comparing the order of statements in a syntactic scope, but for now, just emit an error message if a reference ever resolves to a variable without a type. (Note that UnqualifiedLookup will have already tried to validate the decl, so if it's a global we just haven't seen yet there's not a problem.) Unfortunately, we won't get this right for top-level variables in script source files, since those are still stored at global context and can be validated on demand. They're never uninitialized, but zero-initialization may not be valid for all global kinds. <rdar://problem/15912025> Swift SVN r13003