Sema: Simplify behavior of NameLookupFlags::PerformConformanceCheck flag

I'd like to remove this eventually, but for now I want
to remove this special case check.
This commit is contained in:
Slava Pestov
2017-07-27 23:21:06 -07:00
parent 1b18b82323
commit f51a9d022c
3 changed files with 3 additions and 10 deletions

View File

@@ -3092,11 +3092,6 @@ performMemberLookup(ConstraintKind constraintKind, DeclName memberName,
if (includeInaccessibleMembers) if (includeInaccessibleMembers)
lookupOptions |= NameLookupFlags::IgnoreAccessibility; lookupOptions |= NameLookupFlags::IgnoreAccessibility;
// If a constructor is only visible as a witness for a protocol
// requirement, it must be an invalid override. Also, protocol
// extensions cannot yet define designated initializers.
lookupOptions -= NameLookupFlags::PerformConformanceCheck;
LookupResult ctors = TC.lookupConstructors(DC, instanceTy, lookupOptions); LookupResult ctors = TC.lookupConstructors(DC, instanceTy, lookupOptions);
if (!ctors) if (!ctors)
return result; // No result. return result; // No result.

View File

@@ -146,9 +146,7 @@ namespace {
// If we found something within the protocol itself, and our // If we found something within the protocol itself, and our
// search began somewhere that is not in a protocol or extension // search began somewhere that is not in a protocol or extension
// thereof, remap this declaration to the witness. // thereof, remap this declaration to the witness.
if (foundInType->is<ArchetypeType>() || if (Options.contains(NameLookupFlags::PerformConformanceCheck)) {
foundInType->isExistentialType() ||
Options.contains(NameLookupFlags::PerformConformanceCheck)) {
// Dig out the protocol conformance. // Dig out the protocol conformance.
auto conformance = TC.conformsToProtocol(conformingType, foundProto, DC, auto conformance = TC.conformsToProtocol(conformingType, foundProto, DC,
conformanceOptions); conformanceOptions);

View File

@@ -8,14 +8,14 @@ class A : P { } // expected-error{{initializer requirement 'init()' can only be
// No further errors // No further errors
class B : A { class B : A {
init(x : Int) {} // expected-note {{'init(x:)' declared here}} init(x : Int) {}
} }
class C : B { } class C : B { }
class D : B { class D : B {
init() { init() {
super.init() // expected-error{{missing argument for parameter 'x' in call}} super.init()
} }
} }