mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implementation of the DebugDescription macro pitched on the forums: https://forums.swift.org/t/pitch-debug-description-macro/67711. In this initial commit, the macro is named `_DebugDescription` to indicate it's internal use at this time, pending Swift Evolution. rdar://115180949
15 lines
404 B
Swift
15 lines
404 B
Swift
// REQUIRES: swift_swift_parser
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend %s -swift-version 5 -module-name main -disable-availability-checking -typecheck -verify -plugin-path %swift-plugin-dir
|
|
|
|
@_DebugDescription
|
|
struct MyStruct {
|
|
var flag: Bool
|
|
|
|
// expected-error @+1 {{body must consist of a single string literal}}
|
|
var debugDescription: String {
|
|
flag ? "yes" : "no"
|
|
}
|
|
}
|