File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,11 @@ bool constraints::areConservativelyCompatibleArgumentLabels(
132
132
hasCurriedSelf = false ;
133
133
} else if (baseType->is <AnyMetatypeType>() && decl->isInstanceMember ()) {
134
134
hasCurriedSelf = false ;
135
- } else if (isa<EnumElementDecl>(decl)) {
136
- hasCurriedSelf = false ;
135
+ } else if (auto *EED = dyn_cast<EnumElementDecl>(decl)) {
136
+ // enum elements have either `(Self.Type) -> (Arg...) -> Self`, or
137
+ // `(Self.Type) -> Self`, in the former case self type has to be
138
+ // stripped off.
139
+ hasCurriedSelf = bool (EED->getParameterList ());
137
140
} else {
138
141
hasCurriedSelf = true ;
139
142
}
Original file line number Diff line number Diff line change @@ -124,3 +124,34 @@ func rdar34583132() {
124
124
}
125
125
}
126
126
}
127
+
128
+ func rdar_49159472( ) {
129
+ struct A { }
130
+ struct B { }
131
+ struct C { }
132
+
133
+ enum E {
134
+ case foo( a: A , b: B ? )
135
+
136
+ var foo : C ? {
137
+ return nil
138
+ }
139
+ }
140
+
141
+ class Test {
142
+ var e : E
143
+
144
+ init ( _ e: E ) {
145
+ self . e = e
146
+ }
147
+
148
+ func bar( ) {
149
+ e = . foo( a: A ( ) , b: nil ) // Ok
150
+ e = E . foo ( a: A ( ) , b: nil ) // Ok
151
+ baz ( e: . foo( a: A ( ) , b: nil ) ) // Ok
152
+ baz ( e: E . foo ( a: A ( ) , b: nil ) ) // Ok
153
+ }
154
+
155
+ func baz( e: E ) { }
156
+ }
157
+ }
You can’t perform that action at this time.
0 commit comments