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-5734] SPM build process depends on file names #48304

Closed
swift-ci opened this issue Aug 22, 2017 · 1 comment
Closed

[SR-5734] SPM build process depends on file names #48304

swift-ci opened this issue Aug 22, 2017 · 1 comment
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

Previous ID SR-5734
Radar None
Original Reporter antondomashnev (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift Package Manager - Swift 3.1.0 (swiftpm-12084)

Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)

Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 299626cc4de69e64759d314e4fd01cd9

duplicates:

  • SR-631 Extensions in different files do not recognize each other

Issue Description:

Sample input below

// Base.swift
enum Base {}

// Child.swift
extension Base {
  enum Child {}
}

// Child+Functions.swift
extension Base.Child {
  static func name() -> String {
    return "Name"
  }
}

Fails if build with SPM with issues:

swift build

/Users/antondomashnev/Work/SPMIssueReport/Sources/Child+Functions.swift:11:16: error: 'Child' is not a member type of 'Base'
extension Base.Child {
          ~~~~ ^
/Users/antondomashnev/Work/SPMIssueReport/Sources/Child+Functions.swift:11:16: error: 'Child' is not a member type of 'Base'
extension Base.Child {
          ~~~~ ^
/Users/antondomashnev/Work/SPMIssueReport/Sources/Child+Functions.swift:11:16: error: 'Child' is not a member type of 'Base'
extension Base.Child {
          ~~~~ ^
<unknown>:0: error: build had 1 command failures

 

If rename file

Child.swift -> Child+Base.swift

it compiles without errors. So I've made an assumption that it sorts file names probably alphabetically and `Child+Functions.swift` goes before `Child.swift`, but after `Child+Base.swift`. To check if the assumption makes sense I've tried to rename `Child+Base.swift` into `Child+Something.swift` so alphabetically it should go after `Child+Functions.swift` and the build failed.

I've created a sample project so you can check the code: https://github.com/Antondomashnev/SPMIssue

@ankitspd
Copy link
Member

This is a compiler bug. I verified that this reproduces and works if I change the order of files in swiftc command line invocation.

@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

2 participants