Skip to content

Commit 737155b

Browse files
committed
Merge pull request #2085 from nkcsgexi/master
[AST] Correctly set implicit for enum element patterns. rdar://24870746
2 parents 7a66c6e + 26b71a7 commit 737155b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/swift/AST/Pattern.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class EnumElementPattern : public Pattern {
566566
: Pattern(PatternKind::EnumElement),
567567
ParentType(ParentType), DotLoc(DotLoc), NameLoc(NameLoc), Name(Name),
568568
ElementDecl(Element), SubPattern(SubPattern) {
569-
if (Implicit.hasValue() ? *Implicit : !ParentType.hasLocation())
569+
if (Implicit.hasValue() && *Implicit)
570570
setImplicit();
571571
}
572572

@@ -579,6 +579,10 @@ class EnumElementPattern : public Pattern {
579579
Pattern *getSubPattern() {
580580
return SubPattern;
581581
}
582+
583+
bool isParentTypeImplicit() {
584+
return !ParentType.hasLocation();
585+
}
582586

583587
void setSubPattern(Pattern *p) { SubPattern = p; }
584588

0 commit comments

Comments
 (0)