Files
swift-mirror/test/Macros/DebugDescription/error_custom_interpolation.swift
Dave Lee ad585b3195 [Debug] Add _DebugDescription macro (#69626)
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
2023-12-08 15:19:16 -08:00

22 lines
713 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
extension DefaultStringInterpolation {
fileprivate func appendInterpolation(custom: Int) {}
fileprivate func appendInterpolation<A, B>(_ a: A, _ b: B) {}
}
@_DebugDescription
struct MyStruct1 {
// expected-error @+1 {{unsupported custom string interpolation expression}}
var debugDescription: String { "\(custom: 30)" }
}
@_DebugDescription
struct MyStruct2 {
// expected-error @+1 {{unsupported custom string interpolation expression}}
var debugDescription: String { "\(30, true)" }
}