Skip to content

Commit c0d466e

Browse files
committed
Sema: Type-check didSet body before looking for usages of 'oldValue'
Looking at the unchecked body only worked because parse-time lookup bound references to 'oldValue' to point at the right ParamDecl. By type-checking the body first, the implementation of SE-0268 can work when parse-time lookup is disabled.
1 parent 641469e commit c0d466e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ bool SimpleDidSetRequest::evaluate(Evaluator &evaluator,
11911191
// If we find a reference to the implicit 'oldValue' parameter, then it is
11921192
// not a "simple" didSet because we need to fetch it.
11931193
auto walker = OldValueFinder(param);
1194-
decl->getBody()->walk(walker);
1194+
decl->getTypecheckedBody()->walk(walker);
11951195
auto hasOldValueRef = walker.didFindOldValueRef();
11961196
if (!hasOldValueRef) {
11971197
// If the body does not refer to implicit 'oldValue', it means we can

0 commit comments

Comments
 (0)