8000 [C++ interop]: Overloaded Swift property from other module returning namespaced C++ type not found · Issue #82609 · swiftlang/swift · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[C++ interop]: Overloaded Swift property from other module returning namespaced C++ type not found #82609
Open
@AnthonyLatsis

Description

@AnthonyLatsis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++compilerThe Swift compiler itselfmultiple filesFlag: An issue whose reproduction requires multiple filesmultiple modulesFlag: An issue whose reproduction requires multiple modulesswift 6.2unexpected errorBug: Unexpected error

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0