forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request swiftlang#26544 from owenv/appendInterpolation_sou…
…rce_locs Assign a SourceLoc to implicit appendInterpolation calls for diagnostics
- Loading branch information
Showing
2 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// RUN: %target-swift-frontend -swift-version 5 -typecheck %s 2>&1 | %FileCheck %s | ||
|
||
extension DefaultStringInterpolation { | ||
@available(*, deprecated) func appendInterpolation(deprecated: Int) {} | ||
} | ||
|
||
// Make sure diagnostics emitted via string interpolations have a reasonable source location | ||
|
||
_ = "\(deprecated: 42)" | ||
// CHECK: [[@LINE-1]]:7: warning: 'appendInterpolation(deprecated:)' is deprecated | ||
|
||
_ = "hello, world\(deprecated: 42)!!!" | ||
// CHECK: [[@LINE-1]]:19: warning: 'appendInterpolation(deprecated:)' is deprecated | ||
|
||
_ = "\(42)\(deprecated: 42)test\(deprecated: 42)" | ||
// CHECK: [[@LINE-1]]:12: warning: 'appendInterpolation(deprecated:)' is deprecated | ||
// CHECK: [[@LINE-2]]:33: warning: 'appendInterpolation(deprecated:)' is deprecated | ||
|
||
_ = """ | ||
This is a multiline literal with a deprecated interpolation: | ||
\(deprecated: 42) | ||
""" | ||
// CHECK: [[@LINE-2]]:2: warning: 'appendInterpolation(deprecated:)' is deprecated |