[tests] Update tests as String.CharacterView is deprecated

This commit is contained in:
Michael Ilseman
2017-08-11 12:32:39 -07:00
parent 7c705c3a75
commit a7b299b51b
9 changed files with 10 additions and 13 deletions

View File

@@ -418,7 +418,7 @@ extension Array where Element: Hashable {
}
}
func rdar29633747(characters: String.CharacterView) {
func rdar29633747(characters: String) {
let _ = Array(characters).trimmed(["("])
}

View File

@@ -396,7 +396,6 @@ func resyncParserB11() {}
// rdar://21346928
func optStr() -> String? { return nil }
let x = (optStr() ?? "autoclosure").#^TOP_LEVEL_AUTOCLOSURE_1^#
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: characters[#String.CharacterView#]
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: unicodeScalars[#String.UnicodeScalarView#]
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: utf16[#String.UTF16View#]

View File

@@ -55,7 +55,6 @@ func giveMeAString() -> Int {
return "Here's a string".#^LITERAL5^# // try .characters.count here
}
// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: characters[#String.CharacterView#]{{; name=.+$}}
// LITERAL5-DAG: Decl[InstanceVar]/CurrNominal: endIndex[#String.Index#]{{; name=.+$}}
// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: reserveCapacity({#(n): Int#})[#Void#]{{; name=.+$}}
// LITERAL5-DAG: Decl[InstanceMethod]/CurrNominal/NotRecommended/TypeRelation[Invalid]: append({#(c): Character#})[#Void#]{{; name=.+$}}

View File

@@ -1730,7 +1730,6 @@ func testThrows006() {
// rdar://21346928
// Just sample some String API to sanity check.
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: characters[#String.CharacterView#]
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: unicodeScalars[#String.UnicodeScalarView#]
// AUTOCLOSURE_STRING: Decl[InstanceVar]/CurrNominal: utf16[#String.UTF16View#]
func testWithAutoClosure1(_ x: String?) {

View File

@@ -1127,7 +1127,7 @@ func test22436880() {
// sr-184
let x: String? // expected-note 2 {{constant defined here}}
print(x?.characters.count as Any) // expected-error {{constant 'x' used before being initialized}}
print(x?.count as Any) // expected-error {{constant 'x' used before being initialized}}
print(x!) // expected-error {{constant 'x' used before being initialized}}

View File

@@ -503,7 +503,7 @@ func _String<S : Sequence>(s: S, sep: String) where S.Iterator.Element == String
_ = s.joinWithSeparator(sep) // expected-error {{'joinWithSeparator' has been renamed to 'joined(separator:)'}} {{9-26=joined}} {{27-27=separator: }} {{none}}
}
func _StringCharacterView<S, C>(x: String.CharacterView, s: S, c: C, i: String.CharacterView.Index)
func _StringCharacterView<S, C>(x: String, s: S, c: C, i: String.Index)
where S : Sequence, S.Iterator.Element == Character, C : Collection, C.Iterator.Element == Character {
var x = x
x.replaceRange(i..<i, with: c) // expected-error {{'replaceRange(_:with:)' has been renamed to 'replaceSubrange'}} {{5-17=replaceSubrange}} {{none}}

View File

@@ -82,7 +82,7 @@ func testStringCollectionTypes(s: String) {
acceptsBidirectionalCollection(s.unicodeScalars)
acceptsRandomAccessCollection(s.unicodeScalars) // expected-error{{argument type 'String.UnicodeScalarView' does not conform to expected type 'RandomAccessCollection'}}
acceptsCollection(s.characters)
acceptsBidirectionalCollection(s.characters)
acceptsRandomAccessCollection(s.characters) // expected-error{{argument type 'String.CharacterView' does not conform to expected type 'RandomAccessCollection'}}
acceptsCollection(s)
acceptsBidirectionalCollection(s)
acceptsRandomAccessCollection(s) // expected-error{{argument type 'String' does not conform to expected type 'RandomAccessCollection'}}
}

View File

@@ -19,9 +19,9 @@ func testStringCollectionTypes(s: String) {
acceptsBidirectionalCollection(s.unicodeScalars)
acceptsRandomAccessCollection(s.unicodeScalars) // expected-error{{argument type 'String.UnicodeScalarView' does not conform to expected type 'RandomAccessCollection'}}
acceptsCollection(s.characters)
acceptsBidirectionalCollection(s.characters)
acceptsRandomAccessCollection(s.characters) // expected-error{{argument type 'String.CharacterView' does not conform to expected type 'RandomAccessCollection'}}
acceptsCollection(s)
acceptsBidirectionalCollection(s)
acceptsRandomAccessCollection(s) // expected-error{{argument type 'String' does not conform to expected type 'RandomAccessCollection'}}
}
struct NotLosslessStringConvertible {}

View File

@@ -48,7 +48,7 @@ func test_UnicodeScalarView(s: String.UnicodeScalarView, i: String.UnicodeScalar
_ = s.distance(from: i, to: i) // OK
}
func test_CharacterView(s: String.CharacterView, i: String.CharacterView.Index, d: Int) {
func test_CharacterView(s: String, i: String.Index, d: Int) {
_ = s.index(after: i) // OK
_ = s.index(before: i) // OK
_ = s.index(i, offsetBy: d) // OK