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)
|
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.
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user