[Tests] NFC: Update some of the changed/improved tests

This commit is contained in:
Pavel Yaskevich
2024-08-30 09:32:38 -07:00
parent 427e7bc196
commit dab01bc1fe
3 changed files with 5 additions and 2 deletions

View File

@@ -647,6 +647,7 @@ func r23560128() {
var a : (Int,Int)?
a.0 = 42 // expected-error{{value of optional type '(Int, Int)?' must be unwrapped to refer to member '0' of wrapped base type '(Int, Int)'}}
// expected-note@-1{{chain the optional }}
// expected-note@-2 {{force-unwrap using '!' }}
}
// <rdar://problem/21890157> QoI: wrong error message when accessing properties on optional structs without unwrapping
@@ -656,6 +657,7 @@ struct ExampleStruct21890157 {
var example21890157: ExampleStruct21890157?
example21890157.property = "confusing" // expected-error {{value of optional type 'ExampleStruct21890157?' must be unwrapped to refer to member 'property' of wrapped base type 'ExampleStruct21890157'}}
// expected-note@-1{{chain the optional }}
// expected-note@-2 {{force-unwrap using '!' }}
struct UnaryOp {}

View File

@@ -46,7 +46,8 @@ scopedFunction = 42
// FIXME: Should be an error -- a type name and a function cannot overload.
var _ : Int = TypeNameWins(42)
TypeNameWins = 42 // expected-error {{cannot assign to immutable expression of type 'Int'}}
// FIXME: This should be an ambiguity where both candidates are mentioned as notes.
TypeNameWins = 42 // expected-error {{cannot assign to immutable expression of type '(Int) -> Int'}}
var _ : TypeNameWins // no-warning
// rdar://problem/21739333

View File

@@ -14,7 +14,7 @@ extension EnvironmentValues {
var myHorizontalAlignment: AlignmentID? {
get { fatalError() }
set { self[\.MyHorizontalAlignmentEnvironmentKey.self] = newValue }
// expected-error@-1 {{generic parameter 'K' could not be inferred}}
// expected-error@-1 {{subscript 'subscript(_:)' requires that 'any AlignmentID' be a class type}}
// expected-error@-2 {{cannot infer key path type from context; consider explicitly specifying a root type}}
}
}