Skip to content

ASTDumper: Do not escape Unicode chars in quoted fields #78044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/AST/ASTDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "swift/Basic/Defer.h"
#include "swift/Basic/QuotedString.h"
#include "swift/Basic/STLExtras.h"
#include "swift/Basic/StringExtras.h"
#include "clang/AST/Type.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/SmallString.h"
Expand Down Expand Up @@ -180,7 +181,7 @@ class escaping_ostream : public raw_ostream {

private:
virtual void write_impl(const char *Ptr, size_t Size) override {
base_os.write_escaped(StringRef(Ptr, Size), /*UseHexEscapes=*/true);
writeEscaped(StringRef(Ptr, Size), base_os);
}

virtual uint64_t current_pos() const override {
Expand Down
6 changes: 3 additions & 3 deletions test/Generics/minimal_conformances_compare_concrete.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ struct G<X> {}
// CHECK-NEXT: Generic signature: <X where X == Derived>
extension G where X : Base, X : P, X == Derived {}

// RULE: + (requirement "\xCF\x84_0_0" subclass_of "Base")
// RULE: + (requirement "\xCF\x84_0_0" conforms_to "P")
// RULE: + (requirement "\xCF\x84_0_0" same_type "Derived")
// RULE: + (requirement "τ_0_0" subclass_of "Base")
// RULE: + (requirement "τ_0_0" conforms_to "P")
// RULE: + (requirement "τ_0_0" same_type "Derived")

// RULE: Rewrite system: {
// RULE-NEXT: - [Copyable].[Copyable] => [Copyable] [permanent]
Expand Down
2 changes: 1 addition & 1 deletion test/Parse/raw_string.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ _ = ##"""
/// passes again.
/// See https://github.com/apple/swift/issues/51192.
_ = #"​"​"#
// CHECK: "\xE2\x80\x8B\"\xE2\x80\x8B"
// CHECK: "​\"​"

_ = #""""#
// CHECK: "\"\""
Expand Down
2 changes: 1 addition & 1 deletion unittests/AST/ASTDumperTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ TEST(ASTDumper, ArchetypeType) {
}

EXPECT_EQ(str,
" name=\"\\xCF\\x84_0_0\"\n"
" name=\"τ_0_0\"\n"
" (interface_type=generic_type_param_type depth=0 index=0 param_kind=type))\n");
}