File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -1366,9 +1366,11 @@ ParamDecl *PatternBindingInitializer::getImplicitSelfDecl() {
1366
1366
}
1367
1367
1368
1368
VarDecl *PatternBindingInitializer::getInitializedLazyVar () const {
1369
- if (auto var = getBinding ()->getSingleVar ()) {
1370
- if (var->getAttrs ().hasAttribute <LazyAttr>())
1371
- return var;
1369
+ if (auto binding = getBinding ()) {
1370
+ if (auto var = binding->getSingleVar ()) {
1371
+ if (var->getAttrs ().hasAttribute <LazyAttr>())
1372
+ return var;
1373
+ }
1372
1374
}
1373
1375
return nullptr ;
1374
1376
}
Original file line number Diff line number Diff line change @@ -598,18 +598,17 @@ void UnqualifiedLookupFactory::lookupInModuleScopeContext(
598
598
599
599
void UnqualifiedLookupFactory::lookupNamesIntroducedByPatternBindingInitializer (
600
600
PatternBindingInitializer *PBI, Optional<bool > isCascadingUse) {
601
- assert (PBI->getBinding ());
602
601
// Lazy variable initializer contexts have a 'self' parameter for
603
602
// instance member lookup.
604
603
if (auto *selfParam = PBI->getImplicitSelfDecl ())
605
604
lookupNamesIntroducedByLazyVariableInitializer (PBI, selfParam,
606
605
isCascadingUse);
607
- else if (PBI->getBinding ()-> getDeclContext ()->isTypeContext ())
606
+ else if (PBI->getParent ()->isTypeContext ())
608
607
lookupNamesIntroducedByInitializerOfStoredPropertyOfAType (PBI,
609
608
isCascadingUse);
610
609
else
611
610
lookupNamesIntroducedByInitializerOfGlobalOrLocal (PBI, isCascadingUse);
612
- }
611
+ }
613
612
614
613
void UnqualifiedLookupFactory::lookupNamesIntroducedByLazyVariableInitializer (
615
614
PatternBindingInitializer *PBI, ParamDecl *selfParam,
Original file line number Diff line number Diff line change 1
1
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AFTER_PAREN | %FileCheck %s -check-prefix=AFTER_PAREN
2
2
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG_MyEnum_NODOT | %FileCheck %s -check-prefix=ARG_MyEnum_NODOT
3
3
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG_MyEnum_DOT | %FileCheck %s -check-prefix=ARG_MyEnum_DOT
4
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARG_MyEnum_NOBINDING | %FileCheck %s -check-prefix=ARG_MyEnum_NOBINDING
4
5
5
6
enum MyEnum {
6
7
case east, west
@@ -38,4 +39,9 @@ struct TestStruct {
38
39
// ARG_MyEnum_DOT-DAG: Decl[EnumElement]/ExprSpecific: west[#MyEnum#]; name=west
39
40
// ARG_MyEnum_DOT: End completions
40
41
42
+ @MyStruct ( arg1: MyEnum. #^ARG_MyEnum_NOBINDING^#)
43
+ // ARG_MyEnum_NOBINDING: Begin completions
44
+ // ARG_MyEnum_NOBINDING-DAG: Decl[EnumElement]/CurrNominal: east[#MyEnum#];
45
+ // ARG_MyEnum_NOBINDING-DAG: Decl[EnumElement]/CurrNominal: west[#MyEnum#];
46
+ // ARG_MyEnum_NOBINDING: End completions
41
47
}
You can’t perform that action at this time.
0 commit comments