Open
Description
Description
No response
Reproduction
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/include)
// RUN: split-file %s %t
//
// RUN: %target-swift-frontend -emit-module -module-name a -emit-module-path %t/include/a.swiftmodule %t/a.swift -cxx-interoperability-mode=default -I %t/include
// RUN: %target-swift-frontend -typecheck -primary-file %t/b2.swift %t/b1.swift -cxx-interoperability-mode=default -I %t/include
//--- include/module.modulemap
module cxx {
header "header.h"
export *
}
//--- include/header.h
namespace swift {
struct SourceLoc {};
struct Decl {};
}
//--- a.swift
import cxx
public struct SourceLocWrapper {}
extension Optional<SourceLocWrapper> {
public var bridgedP: swift.SourceLoc { .init() }
}
//--- b1.swift
import cxx
public struct DeclWrapper {}
extension Optional<DeclWrapper> {
public var bridgedP: swift.Decl { .init() }
}
//--- b2.swift
import a
import cxx
public func test(loc: SourceLocWrapper?) {
let _ = loc.bridgedP // error
}
/Users/alatsis/Desktop/swiftlang/build/swift/debug/swift-macosx-arm64/test-macosx-arm64/Interop/Cxx/Output/bug.swift.tmp/b2.swift:5:15: error: property 'bridgedP' requires the types 'SourceLocWrapper' and 'DeclWrapper' be equivalent
3 |
4 | public func test(loc: SourceLocWrapper?) {
5 | let _ = loc.bridgedP // error
| `- error: property 'bridgedP' requires the types 'SourceLocWrapper' and 'DeclWrapper' be equivalent
6 | }
7 |
/Users/alatsis/Desktop/swiftlang/build/swift/debug/swift-macosx-arm64/test-macosx-arm64/Interop/Cxx/Output/bug.swift.tmp/b1.swift:3:1: note: where 'Wrapped' = 'SourceLocWrapper'
1 | import cxx
2 | public struct DeclWrapper {}
3 | extension Optional<DeclWrapper> {
| `- note: where 'Wrapped' = 'SourceLocWrapper'
4 | public var bridgedP: swift.Decl { .init() }
5 | }
Expected behavior
Success.
Environment
Swift version 6.2-dev (LLVM 017432c08540af8, Swift 9488df1)
Additional information
Could be related to #82318.