File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
validation-test/IDE/crashers_2_fixed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -4989,6 +4989,13 @@ void TypeChecker::validateExtension(ExtensionDecl *ext) {
4989
4989
if (!isa<SourceFile>(dc))
4990
4990
return ;
4991
4991
4992
+ // If this is not bound to any decls at this point, this extension is in
4993
+ // inactive coditional compilation block. It's not safe to typecheck this
4994
+ // extension. This happens if code completion is triggered in inactive
4995
+ // conditional complation block.
4996
+ if (!ext->alreadyBoundToNominal ())
4997
+ return ;
4998
+
4992
4999
// Validate the nominal type declaration being extended.
4993
5000
validateDecl (nominal);
4994
5001
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE_1 -source-filename=%s
2
+ // RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE_2 -source-filename=%s
3
+
4
+ struct MyStruct < T> {
5
+ }
6
+
7
+ protocol MyProto {
8
+ associatedtype Assoc
9
+ func foo( x: Assoc ) -> Assoc
10
+ }
11
+
12
+ #if false
13
+ extension MyStruct {
14
+ #^COMPLETE_1 ^#
15
+ }
16
+
17
+ extension MyStruct : MyProto {
18
+ #^COMPLETE_2 ^#
19
+ }
20
+ #endif
You can’t perform that action at this time.
0 commit comments