Files
swift-mirror/test/Interop/Cxx/objc-correctness/protocol-naming-conflict.swift
Alex Langford 9babd8fa8b [cxx-interop][ClangImporter] Fix protocol renaming issue with objc++ interop enabled
When constructing SwiftLookupTable at clang module creation time, calls
to `clang::Sema::LookupName` will fail in C++ mode (including ObjC++).
The specific reason is that `clangSema.TUScope` (which we are passing in
as a Scope) is `nullptr` as we have no active Parser. The C++ path in
`clang::Sema::LookupName` is set to fail early and hard when the Scope
passed in is nullptr. In most, if not all, calls to `LookupName`, we
care about ObjC symbols and not C++ names. For example, the motivation
behind this issue is that ObjC protocols are not being renamed when
there is an ObjC class with the same name, leading to compilation
failures.
2022-04-20 11:52:08 -07:00

13 lines
551 B
Swift

// RUN: %target-swift-ide-test -print-module -module-to-print=ProtocolNamingConflict -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -enable-objc-interop | %FileCheck -check-prefix=CHECK-IDE-TEST %s
// RUN: %swift-frontend -c -enable-experimental-cxx-interop -enable-objc-interop -I %S/Inputs %s -emit-sil -o - | %FileCheck %s
// REQUIRES: objc_interop
import ProtocolNamingConflict
// CHECK: class Thing : FooProtocol
// CHECK-IDE-TEST: protocol FooProtocol
// CHECK-IDE-TEST: class Foo : FooProtocol
class Thing: FooProtocol {
}