File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -9184,8 +9184,8 @@ ConstraintSystem::simplifyOptionalObjectConstraint(
91849184 }
91859185
91869186 if (optTy->isPlaceholder()) {
9187- if (auto *typeVar = second->getAs<TypeVariableType>())
9188- recordPotentialHole(typeVar );
9187+ // object type should be simplified because it could be already bound.
9188+ recordAnyTypeVarAsPotentialHole(simplifyType(second) );
91899189 return SolutionKind::Solved;
91909190 }
91919191
Original file line number Diff line number Diff line change @@ -150,3 +150,25 @@ func fallthrough_not_last(i: Int) {
150150 break
151151 }
152152}
153+
154+ // rdar://117871338 - incorrect diagnostic - type of expression is ambiguous when member is missing.
155+ func test_invalid_optional_chaining( ) {
156+ func test( _: ( E ) -> Void ) {
157+ }
158+
159+ enum E {
160+ case a
161+ case b
162+ }
163+
164+ struct S {
165+ var prop : E
166+ }
167+
168+ test {
169+ switch $0. prop? { // expected-error {{value of type 'E' has no member 'prop'}}
170+ case . a: break
171+ case . b: break
172+ }
173+ }
174+ }
You can’t perform that action at this time.
0 commit comments