File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed
test/SourceKit/CursorInfo Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -303,9 +303,15 @@ bool SyntacticElementTarget::contextualTypeIsOnlyAHint() const {
303303
304304void SyntacticElementTarget::markInvalid () const {
305305 class InvalidationWalker : public ASTWalker {
306+ ASTContext &Ctx;
307+
308+ public:
309+ InvalidationWalker (ASTContext &ctx) : Ctx(ctx) {}
310+
306311 PreWalkResult<Expr *> walkToExprPre (Expr *E) override {
307- // TODO: We ought to fill in ErrorTypes for expressions here; ultimately
308- // type-checking should always produce typed AST.
312+ if (!E->getType ())
313+ E->setType (ErrorType::get (Ctx));
314+
309315 return Action::Continue (E);
310316 }
311317
@@ -321,7 +327,7 @@ void SyntacticElementTarget::markInvalid() const {
321327 return Action::VisitNodeIf (isa<PatternBindingDecl>(D));
322328 }
323329 };
324- InvalidationWalker walker;
330+ InvalidationWalker walker ( getDeclContext ()-> getASTContext ()) ;
325331 walk (walker);
326332}
327333
Original file line number Diff line number Diff line change @@ -2706,7 +2706,7 @@ namespace {
27062706 PreWalkResult<Expr *> walkToExprPre (Expr *expr) override {
27072707 // Skip expressions that didn't make it to solution application
27082708 // because the constraint system diagnosed an error.
2709- if (!expr->getType ())
2709+ if (!expr->getType () || expr-> getType ()-> hasError () )
27102710 return Action::SkipNode (expr);
27112711
27122712 if (auto *openExistential = dyn_cast<OpenExistentialExpr>(expr)) {
Original file line number Diff line number Diff line change @@ -1283,7 +1283,7 @@ class ApplyClassifier {
12831283 thrownValue = removeErasureToExistentialError (thrownValue);
12841284
12851285 Type thrownType = thrownValue->getType ();
1286- if (!thrownType)
1286+ if (!thrownType || thrownType-> hasError () )
12871287 return Classification::forInvalidCode ();
12881288
12891289 // FIXME: Add a potential effect reason for a throw site.
Original file line number Diff line number Diff line change 1+ // RUN: %sourcekitd-test -req=cursor -pos=12:11 %s -- %s
2+
3+ private class MacroApplication < Context: MacroExpansionContext > : SyntaxRewriter {
4+
5+ override func visitAny( _ node: Syntax ) -> Syntax ? {
6+ if var declSyntax = node. as ( DeclSyntax . self) ,
7+ let attributedNode = node. asProtocol ( WithAttributesSyntax . self) ,
8+ !attributedNode. attributes. isEmpty
9+ {
10+ for (attribute, spec) in attributesToRemove {
11+ if let index = self . expandedAttributes. firstIndex ( where: { expandedAttribute in
12+ expandedAttribute. position == attribute. position
13+ } ) {
14+ } else {
15+ }
16+ }
17+ }
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments