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-4478] Library compiles in 3.0 without optimizations; needs WMO turned on to compile in 3.1 #47055

Closed
swift-ci opened this issue Apr 3, 2017 · 8 comments
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 Apr 3, 2017

Previous ID SR-4478
Radar rdar://problem/32343027
Original Reporter ianterrell (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

OS X 10.12.4 (16E195)
Xcode 8.3 (8E162)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 3.1Regression
Assignee None
Priority Medium

md5: f1f4fe5206120e47742721e942af9a11

Issue Description:

I have a small library that compiles fine in Xcode 8.2 Swift 3.0, but has issues in Xcode 8.3 Swift 3.1.

  • Xcode 8.2 -Onone: Compiles

  • Xcode 8.2 -Owholemodule: Compiles

  • Xcode 8.3 -Onone: Fails to compile

  • Xcode 8.3 -Owholemodule: Compiles

The errors are around the collections API:

/Sources/Routing.swift:51:5: Type 'Route' does not conform to protocol 'Sequence'
/Swift.Sequence:122:20: Multiple matching types named 'SubSequence'
/Cordux.Route:3:22: Possibly intended match
/Cordux.Route:6:22: Possibly intended match
/Sources/Routing.swift:51:5: Type 'Route' does not conform to protocol 'RandomAccessCollection'
/Swift.RandomAccessCollection:24:20: Protocol requires nested type 'SubSequence'; do you want to add it?
/Cordux.Route:3:22: Possibly intended match 'Route.SubSequence' (aka 'RangeReplaceableSlice<Route>') does not conform to 'BidirectionalCollection'
/Sources/Routing.swift:51:5: Type 'Route' does not conform to protocol 'BidirectionalCollection'
/Swift.BidirectionalCollection:40:20: Protocol requires nested type 'SubSequence'; do you want to add it?
/Cordux.Route:3:22: Possibly intended match 'Route.SubSequence' (aka 'RangeReplaceableSlice<Route>') does not conform to '_BidirectionalIndexable'
/Sources/Routing.swift:51:5: Type 'Route' does not conform to protocol '_IndexableBase'
/Swift._IndexableBase:53:20: Multiple matching types named 'SubSequence'
/Cordux.Route:3:22: Possibly intended match
/Cordux.Route:5:22: Possibly intended match

I am having a hard time getting a repro case together that is smaller than the library itself, as deleting code from certain areas causes errors to come or go, in some cases making it where it does not compile even with whole module optimization.

@belkadan
Copy link
Contributor

belkadan commented Apr 3, 2017

Cross-file protocol conformance checking problem. @huonw, @DougGregor, does this sound familiar?

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 3, 2017

Comment by Adam Newton (JIRA)

We were very intrigued by `_IndexableBase`. Is it trying to check for an internal protocol? (Just a curiosity)

@belkadan
Copy link
Contributor

belkadan commented Apr 3, 2017

Yeah, but only as part of checking Collection conformance. _IndexableBase isn't particularly secret.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 3, 2017

Comment by Matt Yohe (JIRA)

Is this similar to the boilerplate generation issue that came up during development of 3.1 that was corrected here: https://github.com/apple/swift/pull/7136/files#diff-6290705036ea8e99c92cd1a8afc9494bR800 ?

It does look like extending `Route` with `RangeReplaceableCollection` and providing a typealias for `SubSequence` and an implementation for subsequence that gyb would provide does get the test project to compile.

#if swift(>=3.1)
    extension Route: RangeReplaceableCollection {
        public typealias SubSequence = RangeReplaceableRandomAccessSlice<Route>

        public subscript(slice: Range<Route.Index>) -> SubSequence {
            return SubSequence(base: self, bounds: slice)
        }
    }
#endif

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 4, 2017

Comment by Carmelo Gallo (JIRA)

I guess is the same compiler problem I had in SR-4432

@swift-ci
Copy link
Collaborator Author

Comment by Adam Newton (JIRA)

Just wanted to check in to see if this would possibly make it into Swift 4. cc/ @belkadan

@belkadan
Copy link
Contributor

@swift-ci create

@DougGregor
Copy link
Member

This is fixed in the 6/12 snapshot for the 4.0 branch.

@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

3 participants