[CSSimplify] Teach disjunction filtering that some enum cases have curried self

Cases with arguments form `(Self.Type) -> (Arg...) -> Self`
function types, so `areConservativelyCompatibleArgumentLabels`
should remove curried self before trying to match argument/parameter
labels.

Resolves: rdar://problem/49159472
This commit is contained in:
Pavel Yaskevich
2019-03-25 19:30:29 -07:00
parent 15f2b00c9a
commit fe7ea486a1
2 changed files with 36 additions and 2 deletions

View File

@@ -132,8 +132,11 @@ bool constraints::areConservativelyCompatibleArgumentLabels(
hasCurriedSelf = false;
} else if (baseType->is<AnyMetatypeType>() && decl->isInstanceMember()) {
hasCurriedSelf = false;
} else if (isa<EnumElementDecl>(decl)) {
hasCurriedSelf = false;
} else if (auto *EED = dyn_cast<EnumElementDecl>(decl)) {
// enum elements have either `(Self.Type) -> (Arg...) -> Self`, or
// `(Self.Type) -> Self`, in the former case self type has to be
// stripped off.
hasCurriedSelf = bool(EED->getParameterList());
} else {
hasCurriedSelf = true;
}