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 {
303
303
304
304
void SyntacticElementTarget::markInvalid () const {
305
305
class InvalidationWalker : public ASTWalker {
306
+ ASTContext &Ctx;
307
+
308
+ public:
309
+ InvalidationWalker (ASTContext &ctx) : Ctx(ctx) {}
310
+
306
311
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
+
309
315
return Action::Continue (E);
310
316
}
311
317
@@ -321,7 +327,7 @@ void SyntacticElementTarget::markInvalid() const {
321
327
return Action::VisitNodeIf (isa<PatternBindingDecl>(D));
322
328
}
323
329
};
324
- InvalidationWalker walker;
330
+ InvalidationWalker walker ( getDeclContext ()-> getASTContext ()) ;
325
331
walk (walker);
326
332
}
327
333
Original file line number Diff line number Diff line change @@ -2706,7 +2706,7 @@ namespace {
2706
2706
PreWalkResult<Expr *> walkToExprPre (Expr *expr) override {
2707
2707
// Skip expressions that didn't make it to solution application
2708
2708
// because the constraint system diagnosed an error.
2709
- if (!expr->getType ())
2709
+ if (!expr->getType () || expr-> getType ()-> hasError () )
2710
2710
return Action::SkipNode (expr);
2711
2711
2712
2712
if (auto *openExistential = dyn_cast<OpenExistentialExpr>(expr)) {
Original file line number Diff line number Diff line change @@ -1283,7 +1283,7 @@ class ApplyClassifier {
1283
1283
thrownValue = removeErasureToExistentialError (thrownValue);
1284
1284
1285
1285
Type thrownType = thrownValue->getType ();
1286
- if (!thrownType)
1286
+ if (!thrownType || thrownType-> hasError () )
1287
1287
return Classification::forInvalidCode ();
1288
1288
1289
1289
// 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