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)
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);
if (!ctors)
return result; // No result.

View File

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

View File

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