swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.54k stars 10.35k forks source link

[SR-5901] Don't depend on alphabetical order of project directories #48461

Open aciidgh opened 7 years ago

aciidgh commented 7 years ago
Previous ID SR-5901
Radar None
Original Reporter @aciidb0mb3r
Type Bug
Environment Apple Swift version 4.0 (swiftlang-900.0.65 clang-900.0.37) Target: x86_64-apple-macosx10.9
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 1 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 052111b251fc6166095d251a9b4e9549

Issue Description:

I'm currently running into an inconsistency between Xcode and Swift when trying to build a library.

My project's layout looks something like this:

.
└── Sources
    └── CNKit
        ├── Extensions
        │   └── Color.swift
        └── Models
            └── Floor.swift

In Color.swift I am trying to extend a type from Floor.swift (a nested type `Floor.Room` to be exact). This works just fine when building the project via Xcode (xcodeproj generated with SPM). On running `swift build` however I get the following error.

error: 'Room' is not a member type of 'Floor'

Whilst debugging this I was asked to rename the Models directory to AModels, so that it would come before Extensions when listing the dirs alphabetically. Interestingly enough this resolves the issue and SPM is now able to build the project.

Depending on the alphabetical order of subdirectories feels very odd

Posted on behalf of kiliankoe (JIRA User)

belkadan commented 7 years ago

We'd need the sources to be sure, but this is probably another SR-631.