mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user