Files
swift-mirror/test/stdlib/StringCompatibilityDiagnostics4.swift
Doug Gregor b182c96bd7 Print diagnostic group names by default
Print diagnostic groups as part of the LLVM printer in the same manner as the
Swift one does, always. Make `-print-diagnostic-groups` an inert option, since we
always print diagnostic group names with the `[#GroupName]` syntax.

As part of this, we no longer render the diagnostic group name as part
of the diagnostic *text*, instead leaving it up to the diagnostic
renderer to handle the category appropriately. Update all of the tests
that were depending on `-print-diagnostic-groups` putting it into the
text to instead use the `{{documentation-file=<file name>}}`
diagnostic verification syntax.
2025-03-29 15:40:56 -07:00

24 lines
1.2 KiB
Swift

// RUN: %target-swift-frontend -typecheck -swift-version 4 %s -verify
func testPopFirst() {
let str = "abc"
var charView: String.CharacterView // expected-warning{{'CharacterView' is deprecated: Please use String directly}}{{documentation-file=deprecated-declaration}}
charView = str.characters // expected-warning{{'characters' is deprecated: Please use String directly}}{{documentation-file=deprecated-declaration}}
dump(charView)
var substr = str[...]
_ = substr.popFirst() // ok
_ = substr.characters.popFirst() // expected-warning{{'characters' is deprecated: Please use Substring directly}}{{documentation-file=deprecated-declaration}}
_ = substr.unicodeScalars.popFirst() // ok
var charSubView: Substring.CharacterView // expected-warning{{'CharacterView' is deprecated: Please use Substring directly}}{{documentation-file=deprecated-declaration}}
charSubView = substr.characters // expected-warning{{'characters' is deprecated: Please use Substring directly}}{{documentation-file=deprecated-declaration}}
dump(charSubView)
var _ = String(str.utf8) ?? "" // expected-warning{{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}}
var _: String = String(str.utf8) // ok
}