Files
swift-mirror/test/Interop/Cxx/namespace/namespace-alias-completion.swift
Hamish Knight 916a25826f [ASTMangler] Handle clang::NamespaceAliasDecl in appendAnyGenericType
Mangle as a typealias, which matches how it's imported. This fixes
a code completion crash when attempting to mangle a USR for the decl.

rdar://170650596
2026-06-11 23:35:52 +01:00

31 lines
773 B
Swift

// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %t/main.swift -filecheck %raw-FileCheck -I %t/Inputs -cxx-interoperability-mode=default -completion-output-dir %t/out
// Make sure we don't crash when attempting to mangle a USR for the namespace
// alias here.
//--- Inputs/module.modulemap
module CxxModule {
header "cxx-module.h"
requires cplusplus
}
//--- Inputs/cxx-module.h
namespace Foo {
struct Bar {};
}
namespace FooAlias = Foo;
//--- main.swift
import CxxModule
func test() {
let _ = #^GLOBAL^#
let _ = FooAlias.#^IN_ALIAS^#
}
// GLOBAL: Decl[TypeAlias]/OtherModule[CxxModule]: FooAlias[#Foo#]; name=FooAlias
// IN_ALIAS: Decl[Struct]/CurrNominal: Bar[#Foo.Bar#]; name=Bar