Skip to content
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

[SR-12132] @_exported does not respect custom operators #54567

Closed
swift-ci opened this issue Feb 5, 2020 · 3 comments
Closed

[SR-12132] @_exported does not respect custom operators #54567

swift-ci opened this issue Feb 5, 2020 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Feb 5, 2020

Previous ID SR-12132
Radar rdar://problem/59198796
Original Reporter tannernelson (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
Target: x86_64-apple-darwin19.2.0

macOS 10.15.2

Xcode 11.3 (11C29)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @hamishknight
Priority Medium

md5: 152908bce7566937d084ec853cd3b3c2

is duplicated by:

  • SR-13350 @_exported import does not properly export custom operators

Issue Description:

Exporting a module using `@_exported` does not export custom operators declared in that module.

I've created a reproduction of this bug here:
https://github.com/tanner0101/swift-operator-bug

To exhibit the bug, run `swift build`.

You should see the following error when building module `C`:

/Users/tanner/dev/tanner0101/swift-operator-bug/Sources/C/main.swift:3:9: error: operator is not a known binary operator
print(1 ~~ 2)
        ^

This error can be worked around by manually importing module `A` where `~~` is defined. However, this should not be required since module `B` is imported by `C` and module `A` is `@_exported` by module `B`.

Module A:

infix operator ~~
public func ~~(lhs: Int, rhs: Int) -> Bool {
    lhs == rhs
}

Module B:

@_exported import A

Module C:

import B

print(1 ~~ 2) // Does not work
@weissi
Copy link
Member

weissi commented Feb 5, 2020

@swift-ci create

@slavapestov
Copy link
Member

Operator lookup goes via a slightly different code path than value member lookup. It should be refactored to use the same ImportSet abstraction, ensuring that re-exports are taken into consideration.

@hamishknight
Copy link
Collaborator

Fixed by #31506, please verify using the next available master development snapshot.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

4 participants