Uploaded image for project: 'Swift'
  1. Swift
  2. SR-3788

Code not compiling in Swift 3.1

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Won't Do
    • Component/s: Compiler
    • Labels:
    • Environment:

      Xcode 8.3 beta (8W109m)
      Compiler: bundled with Xcode and swift-3.1-DEVELOPMENT-SNAPSHOT-2017-01-22-a

      Description

      Hi,

      Our project doesn't compile on Swift 3.1 but it does on Swift 3.0

      STR

      clone: https://github.com/badoo/Chatto
      open ./ChattoApp/ChattoApp.xcworkspace
      compile ChattoApp target

      Issues:

      a)

      /Users/diegosanchez/branches/Chatto/ChattoAdditions/Source/Input/Photos/PhotosInputDataProvider.swift:144:42: error: cannot perform mutating operation: 'self.photosDataProvider' is a 'let' constant
              self.photosDataProvider.delegate = self
                                               ^
      /Users/diegosanchez/branches/Chatto/ChattoAdditions/Source/Input/Photos/PhotosInputDataProvider.swift:138:13: note: change 'let' to 'var' to make it mutable
          private let photosDataProvider: PhotosInputDataProviderProtocol
                  ^~~
                  var
      

      This one I agree with the compiler, it shouldn't compile and should be fixed manually by adding a class constraint to PhotosInputDataProviderProtocol

      b)

      /Users/diegosanchez/branches/Chatto/ChattoAdditions/Source/Input/Photos/PhotosInputView.swift:189:53: error: ambiguous use of 'collectionView'
              self.addConstraint(NSLayoutConstraint(item: self.collectionView, attribute: .leading, relatedBy: .equal, toItem: self, attribute: .leading, multiplier: 1, constant: 0))
                                                          ^
      /Users/diegosanchez/branches/Chatto/ChattoAdditions/Source/Input/Photos/PhotosInputView.swift:195:10: note: found this candidate
          func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
               ^
      /Users/diegosanchez/branches/Chatto/ChattoAdditions/Source/Input/Photos/PhotosInputView.swift:199:10: note: found this candidate
          func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
               ^
      /Users/diegosanchez/branches/Chatto/ChattoAdditions/Source/Input/Photos/PhotosInputView.swift:211:10: note: found this candidate
          func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
               ^
      

      Once fixed that manually, by creating a local variable referencing self.collectionView, I get this other one:

      c)

      /Users/diegosanchez/branches/Chatto/ChattoApp/ChattoApp/Source/FakeDataSource.swift:106:20: error: cannot convert value of type '(didAdjust: Bool)' to expected argument type 'Bool'
              completion((didAdjust: didAdjust))
                         ^~~~~~~~~~~~~~~~~~~~~~
                                                as! Bool
      

      Commenting that line leads to...

      d)

      Undefined symbols for architecture x86_64:
        "__TIFC9ChattoApp40BaseMessageCollectionViewCellAvatarStylecFT6colorsVC15ChattoAdditions41BaseMessageCollectionViewCellDefaultStyle6Colors18bubbleBorderImagesGSqVS2_18BubbleBorderImages_16failedIconImagesVS2_16FailedIconImages15layoutConstantsVS1_44BaseMessageCollectionViewCellLayoutConstants13dateTextStyleVS2_13DateTextStyle11avatarStyleVS2_11AvatarStyle_S0_A_", referenced from:
            __TFC9ChattoApp22DemoChatViewController23createPresenterBuildersfT_GVs10DictionarySSGSaP6Chatto32ChatItemPresenterBuilderProtocol___ in DemoChatViewController.o
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            diegosanchezr Diego
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: