Skip to content

Commit da000dd

Browse files
authored
Merge pull request #31984 from omochi/split-line-test-expectation
[Sema][NFC]: Split test expectation to lines in `object_literals`
2 parents a4d182c + f9c8210 commit da000dd

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

test/Sema/object_literals_ios.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,24 @@ struct S: _ExpressibleByColorLiteral {
66
}
77

88
let y: S = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1)
9-
let y2 = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1) // expected-error{{could not infer type of color literal}} expected-note{{import UIKit to use 'UIColor' as the default color literal type}}
9+
let y2 = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1) // expected-error{{could not infer type of color literal}}
10+
// expected-note@-1{{import UIKit to use 'UIColor' as the default color literal type}}
1011
let y3 = #colorLiteral(red: 1, bleen: 0, grue: 0, alpha: 1) // expected-error{{incorrect argument labels in call (have 'red:bleen:grue:alpha:', expected 'red:green:blue:alpha:')}}
11-
// expected-error@-1 {{could not infer type of color literal}} expected-note@-1 {{import UIKit to use 'UIColor' as the default color literal type}}
12+
// expected-error@-1 {{could not infer type of color literal}}
13+
// expected-note@-2 {{import UIKit to use 'UIColor' as the default color literal type}}
1214

1315
struct I: _ExpressibleByImageLiteral {
1416
init(imageLiteralResourceName: String) {}
1517
}
1618

1719
let z: I = #imageLiteral(resourceName: "hello.png")
18-
let z2 = #imageLiteral(resourceName: "hello.png") // expected-error{{could not infer type of image literal}} expected-note{{import UIKit to use 'UIImage' as the default image literal type}}
20+
let z2 = #imageLiteral(resourceName: "hello.png") // expected-error{{could not infer type of image literal}}
21+
// expected-note@-1{{import UIKit to use 'UIImage' as the default image literal type}}
1922

2023
struct Path: _ExpressibleByFileReferenceLiteral {
2124
init(fileReferenceLiteralResourceName: String) {}
2225
}
2326

2427
let p1: Path = #fileLiteral(resourceName: "what.txt")
25-
let p2 = #fileLiteral(resourceName: "what.txt") // expected-error{{could not infer type of file reference literal}} expected-note{{import Foundation to use 'URL' as the default file reference literal type}}
28+
let p2 = #fileLiteral(resourceName: "what.txt") // expected-error{{could not infer type of file reference literal}}
29+
// expected-note@-1{{import Foundation to use 'URL' as the default file reference literal type}}

test/Sema/object_literals_osx.swift

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,32 @@ struct S: _ExpressibleByColorLiteral {
66
}
77

88
let y: S = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1)
9-
let y2 = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1) // expected-error{{could not infer type of color literal}} expected-note{{import AppKit to use 'NSColor' as the default color literal type}}
10-
let y3 = #colorLiteral(red: 1, bleen: 0, grue: 0, alpha: 1) // expected-error{{incorrect argument labels in call (have 'red:bleen:grue:alpha:', expected 'red:green:blue:alpha:')}} expected-error{{could not infer type of color literal}} expected-note{{import AppKit to use 'NSColor' as the default color literal type}}
9+
let y2 = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1) // expected-error{{could not infer type of color literal}}
10+
// expected-note@-1{{import AppKit to use 'NSColor' as the default color literal type}}
11+
let y3 = #colorLiteral(red: 1, bleen: 0, grue: 0, alpha: 1) // expected-error{{incorrect argument labels in call (have 'red:bleen:grue:alpha:', expected 'red:green:blue:alpha:')}}
12+
// expected-error@-1{{could not infer type of color literal}}
13+
// expected-note@-2{{import AppKit to use 'NSColor' as the default color literal type}}
1114

1215
struct I: _ExpressibleByImageLiteral {
1316
init(imageLiteralResourceName: String) {}
1417
}
1518

1619
let z: I = #imageLiteral(resourceName: "hello.png")
17-
let z2 = #imageLiteral(resourceName: "hello.png") // expected-error{{could not infer type of image literal}} expected-note{{import AppKit to use 'NSImage' as the default image literal type}}
20+
let z2 = #imageLiteral(resourceName: "hello.png") // expected-error{{could not infer type of image literal}}
21+
// expected-note@-1{{import AppKit to use 'NSImage' as the default image literal type}}
1822

1923
struct Path: _ExpressibleByFileReferenceLiteral {
2024
init(fileReferenceLiteralResourceName: String) {}
2125
}
2226

2327
let p1: Path = #fileLiteral(resourceName: "what.txt")
24-
let p2 = #fileLiteral(resourceName: "what.txt") // expected-error{{could not infer type of file reference literal}} expected-note{{import Foundation to use 'URL' as the default file reference literal type}}
28+
let p2 = #fileLiteral(resourceName: "what.txt") // expected-error{{could not infer type of file reference literal}}
29+
// expected-note@-1{{import Foundation to use 'URL' as the default file reference literal type}}
2530

26-
let text = #fileLiteral(resourceName: "TextFile.txt").relativeString! // expected-error{{could not infer type of file reference literal}} expected-note{{import Foundation to use 'URL' as the default file reference literal type}}
31+
let text = #fileLiteral(resourceName: "TextFile.txt").relativeString! // expected-error{{could not infer type of file reference literal}}
32+
// expected-note@-1{{import Foundation to use 'URL' as the default file reference literal type}}
2733

2834
// rdar://problem/49861813
29-
#fileLiteral() // expected-error{{missing argument for parameter 'resourceName' in call}} expected-error{{could not infer type of file reference literal}} expected-note{{import Foundation to use 'URL' as the default file reference literal type}}
35+
#fileLiteral() // expected-error{{missing argument for parameter 'resourceName' in call}}
36+
// expected-error@-1{{could not infer type of file reference literal}}
37+
// expected-note@-2{{import Foundation to use 'URL' as the default file reference literal type}}

0 commit comments

Comments
 (0)