Skip to content

Commit ff2c849

Browse files
committed
---
yaml --- r: 348157 b: refs/heads/master c: b60a919 h: refs/heads/master i: 348155: b9a008e
1 parent 8256bd1 commit ff2c849

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b05eb4aa9326f47fc498b9da807a490cc8452a2c
2+
refs/heads/master: b60a9197f42fd259685a4eff0147f7cd923574c1
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/Sema/CSGen.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3791,7 +3791,8 @@ bool swift::isExtensionApplied(const DeclContext *DC, Type BaseTy,
37913791
const ExtensionDecl *ED) {
37923792
// We can't do anything if the base type has unbound generic parameters.
37933793
// We can't leak type variables into another constraint system.
3794-
if (BaseTy->hasTypeVariable() || BaseTy->hasUnboundGenericType())
3794+
if (BaseTy->hasTypeVariable() || BaseTy->hasUnboundGenericType() ||
3795+
BaseTy->hasUnresolvedType() || BaseTy->hasError())
37953796
return true;
37963797

37973798
if (!ED->isConstrainedExtension())
@@ -3811,7 +3812,8 @@ bool swift::isMemberDeclApplied(const DeclContext *DC, Type BaseTy,
38113812
const ValueDecl *VD) {
38123813
// We can't leak type variables into another constraint system.
38133814
// We can't do anything if the base type has unbound generic parameters.
3814-
if (BaseTy->hasTypeVariable() || BaseTy->hasUnboundGenericType())
3815+
if (BaseTy->hasTypeVariable() || BaseTy->hasUnboundGenericType()||
3816+
BaseTy->hasUnresolvedType() || BaseTy->hasError())
38153817
return true;
38163818

38173819
const GenericContext *genericDecl = VD->getAsGenericContext();

trunk/test/IDE/complete_constructor.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPENDENT_IN_CLOSURE_1 | %FileCheck %s -check-prefix=DEPENDENT_IN_CLOSURE_1
5454
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEPENDENT_IN_CLOSURE_2 | %FileCheck %s -check-prefix=DEPENDENT_IN_CLOSURE_2
55+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=INIT_WITH_UNRESOLVEDTYPE_1 | %FileCheck %s -check-prefix=INIT_WITH_UNRESOLVEDTYPE_1
5556

5657
func freeFunc() {}
5758

@@ -396,3 +397,16 @@ func testDependentTypeInClosure() {
396397
// DEPENDENT_IN_CLOSURE_2-DAG: Decl[Constructor]/CurrNominal: init({#arg: _#}, {#fn: () -> _.Content##() -> _.Content#})[#DependentTypeInClosure<_>#]; name=init(arg: _, fn: () -> _.Content)
397398
// DEPENDENT_IN_CLOSURE_2: End completions
398399
}
400+
struct InitWithUnresolved<Data: DataType> where Data.Content: Comparable {
401+
init(arg: Data, fn: (Data.Content) -> Void) {}
402+
}
403+
extension InitWithUnresolved where Self.Data: Comparable {
404+
init(arg2: Data) {}
405+
}
406+
func testInitWithUnresolved() {
407+
let _ = InitWithUnresolved(#^INIT_WITH_UNRESOLVEDTYPE_1^#
408+
// INIT_WITH_UNRESOLVEDTYPE_1: Begin completions, 2 items
409+
// INIT_WITH_UNRESOLVEDTYPE_1-DAG: Decl[Constructor]/CurrNominal: ['(']{#arg: _#}, {#fn: (_.Content) -> Void##(_.Content) -> Void#}[')'][#InitWithUnresolved<_>#];
410+
// INIT_WITH_UNRESOLVEDTYPE_1-DAG: Decl[Constructor]/CurrNominal: ['(']{#arg2: _#}[')'][#InitWithUnresolved<_>#];
411+
// INIT_WITH_UNRESOLVEDTYPE_1: End completions
412+
}

0 commit comments

Comments
 (0)