From 7265d400217882da2068b6281d31926723e06694 Mon Sep 17 00:00:00 2001 From: Austin Henriksen Date: Tue, 29 Oct 2024 19:50:19 -0400 Subject: [PATCH] Fix bugs in how 'slice2swift' handled 'misc' comment components. --- cpp/src/slice2swift/SwiftUtil.cpp | 13 ++++++++----- swift/test/Slice/escape/Key.ice | 11 +++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/cpp/src/slice2swift/SwiftUtil.cpp b/cpp/src/slice2swift/SwiftUtil.cpp index c7e35f3a167..0f9d661c7bf 100644 --- a/cpp/src/slice2swift/SwiftUtil.cpp +++ b/cpp/src/slice2swift/SwiftUtil.cpp @@ -657,7 +657,7 @@ SwiftGenerator::writeDocSummary(IceInternal::Output& out, const ContainedPtr& p) if (!doc.misc.empty()) { - out << "///" << nl; + out << nl << "///"; writeDocLines(out, doc.misc); } @@ -789,8 +789,8 @@ SwiftGenerator::writeOpDocSummary(IceInternal::Output& out, const OperationPtr& if (!doc.misc.empty()) { - out << nl; - writeDocLines(out, doc.misc, false); + out << nl << "///"; + writeDocLines(out, doc.misc); } } @@ -838,7 +838,8 @@ SwiftGenerator::writeProxyDocSummary(IceInternal::Output& out, const InterfaceDe if (!doc.misc.empty()) { - writeDocLines(out, doc.misc, false); + out << nl << "///"; + writeDocLines(out, doc.misc); } } @@ -878,7 +879,8 @@ SwiftGenerator::writeServantDocSummary(IceInternal::Output& out, const Interface if (!doc.misc.empty()) { - writeDocLines(out, doc.misc, false); + out << nl << "///"; + writeDocLines(out, doc.misc); } } @@ -907,6 +909,7 @@ SwiftGenerator::writeMemberDoc(IceInternal::Output& out, const DataMemberPtr& p) if (!doc.misc.empty()) { + out << nl << "///"; writeDocLines(out, doc.misc); } diff --git a/swift/test/Slice/escape/Key.ice b/swift/test/Slice/escape/Key.ice index 277a40e4273..0f6155f96bb 100644 --- a/swift/test/Slice/escape/Key.ice +++ b/swift/test/Slice/escape/Key.ice @@ -10,8 +10,12 @@ enum continue var } +/// The guard struct. +/// @see defer struct guard { + /// A default + /// @foo Test int default; } @@ -20,8 +24,15 @@ struct defer string else; } +/// The break interface. +/// @foo Test interface break { + /// The case operation. + /// @foo Test1 + /// @param catch A catch + /// @param try A try + /// @bar Test2 ["amd"] void case(int catch, out int try); }