mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CSSimplify] Fix handling of holes by OptionalObject constraint
When "optional type" is a hole the simplification logic has to simplify "object type" and mark all of its unresolved components are potential holes, otherwise hole propagation won't work since sometimes there is no other contextual information for such types but "optional type". Resolves: rdar://117871338
This commit is contained in:
@@ -150,3 +150,25 @@ func fallthrough_not_last(i: Int) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// rdar://117871338 - incorrect diagnostic - type of expression is ambiguous when member is missing.
|
||||
func test_invalid_optional_chaining() {
|
||||
func test(_: (E) -> Void) {
|
||||
}
|
||||
|
||||
enum E {
|
||||
case a
|
||||
case b
|
||||
}
|
||||
|
||||
struct S {
|
||||
var prop: E
|
||||
}
|
||||
|
||||
test {
|
||||
switch $0.prop? { // expected-error {{value of type 'E' has no member 'prop'}}
|
||||
case .a: break
|
||||
case .b: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user