mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[IDE] SourceEntityWalker should walk all explicit declarations
`SourceEntityWalker` had an unbalanced `walkToDeclPre` and `walkToDeclPost`, ie. `walkToDeclPost` could be called even though `walkToDeclPre` was not. Specifically, this would occur for both `OperatorDecl` and `PrecedenceGroupDecl` declarations. These could both be added to the `if` in `walkToDeclPost`, but this seems fairly errorprone in general - especially as new decls are added. Indeed, there's already declarations that are being skipped because they aren't explicitly tested for in `walkToDeclPre`, ie. `PatternBindingDecl`. Instead of skipping if not explcitly handled, only skip running the `SEWalker` walk methods if the declaration is implicit (and not a constructor decl, see TODO). This should probably also always visit children, with various decls changed to become implicit (eg. TopLevelCodeDecl), but we can do that later - breaks too many tests for now. This change exposed a few parameter declarations that were missing their implicit flag, as well as unbalanced walk methods in `RangeResolver`.
This commit is contained in:
@@ -181,6 +181,7 @@ static ValueDecl *deriveMathOperator(DerivedConformance &derived,
|
||||
C.getIdentifier(name), parentDC);
|
||||
param->setSpecifier(ParamDecl::Specifier::Default);
|
||||
param->setInterfaceType(type);
|
||||
param->setImplicit();
|
||||
return param;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user