Skip to content

Commit 8a84fdd

Browse files
committed
improving tests readability
1 parent 6142a44 commit 8a84fdd

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

test/Constraints/casts.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -744,13 +744,9 @@ do {
744744

745745
// https://github.com/apple/swift/issues/68825
746746
do {
747-
func x(a: Any) {
748-
_ = a is a
749-
// expected-error@-1 {{type-casting operator expects a type on its right-hand side (got: parameter 'a')}}
750-
// expected-note@-3 {{'a' declared here}}
751-
_ = a as a
752-
// expected-error@-1 {{type-casting operator expects a type on its right-hand side (got: parameter 'a')}}
753-
// expected-note@-6 {{'a' declared here}}
747+
func x(a: Any) { // expected-note 2 {{'a' declared here}}
748+
_ = a is a // expected-error {{type-casting operator expects a type on its right-hand side (got: parameter 'a')}}
749+
_ = a as a // expected-error {{type-casting operator expects a type on its right-hand side (got: parameter 'a')}}
754750
_ = a is Issue68825 // expected-error {{cannot find type 'Issue68825' in scope}}
755751
_ = a is String // OK
756752
}

test/Parse/omit_return.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,9 +1709,8 @@ class CImplicitIdentityExpr { func gimme() -> CImplicitIdentityExpr { self } }
17091709

17101710
class CImplicitDotSelfExpr { func gimme() -> CImplicitDotSelfExpr { self.self } }
17111711

1712-
func badIs<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool {
1712+
func badIs<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool { // expected-note {{'type' declared here}}
17131713
value is type // expected-error {{type-casting operator expects a type on its right-hand side (got: parameter 'type')}}
1714-
// expected-note@-2 {{'type' declared here}}
17151714
}
17161715

17171716

test/Parse/omit_return_fail.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
// RUN: %target-swift-frontend %s -typecheck -verify
22

3-
func badIs<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool {
3+
func badIs<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool { // expected-note {{'type' declared here}}
44
value is type // expected-error {{type-casting operator expects a type on its right-hand side (got: parameter 'type')}}
5-
// expected-note@-2 {{'type' declared here}}
65
}
76

87
func foo() -> Int {
98
return // expected-error {{non-void function should return a value}}
109
}
1110

12-
func badIs_ifdecl<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool {
11+
func badIs_ifdecl<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool { // expected-note {{'type' declared here}}
1312
#if true
1413
value is type // expected-error {{type-casting operator expects a type on its right-hand side (got: parameter 'type')}}
15-
// expected-note@-3 {{'type' declared here}}
1614
#endif
1715
}
1816

test/Parse/omit_return_ifdecl.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,10 +2430,9 @@ class CImplicitIdentityExpr { func gimme() -> CImplicitIdentityExpr { self } }
24302430

24312431
class CImplicitDotSelfExpr { func gimme() -> CImplicitDotSelfExpr { self.self } }
24322432

2433-
func badIs<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool {
2433+
func badIs<T>(_ value: Any, anInstanceOf type: T.Type) -> Bool { // expected-note {{'type' declared here}}
24342434
#if true
24352435
value is type // expected-error {{type-casting operator expects a type on its right-hand side (got: parameter 'type')}}
2436-
// expected-note@-3 {{'type' declared here}}
24372436
#endif
24382437
}
24392438

0 commit comments

Comments
 (0)