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-9877] sourcekitd returns an error response making SemanticRefactoring (Local Rename) request #52283

Closed
jshier opened this issue Feb 7, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. found by stress tester Flag: An issue found by the SourceKit stress tester

Comments

@jshier
Copy link
Contributor

jshier commented Feb 7, 2019

Previous ID SR-9877
Radar rdar://problem/48086267
Original Reporter @jshier
Type Bug

Attachment: Download

Environment

Xcode 10.2 beta 2, Swift Development Snapshot from 2/3/19.

Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, FoundByStressTester
Assignee None
Priority Medium

md5: 8aaa47c4b936b69eaeaa0d1ccca4e398

Issue Description:

Using the new sourcekitd stress test on https://github.com/jshier/HazeLight produced the following output:

Detected unexpected failure: SourceKit returned an error response

request: SemanticRefactoring (Local Rename) in /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/CredentialsModelController.swift (modified: concurrent) at offset 1563 with args: -incremental -module-name HazeLight -Onone -enable-batch-mode -enforce-exclusivity=checked -Xfrontend -disable-swift3-objc-inference -DDEBUG -D COCOAPODS -Xcc -fmodule-map-file=/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Products/Debug-iphonesimulator/Alamofire/Alamofire.modulemap -Xcc -fmodule-map-file=/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Products/Debug-iphonesimulator/Valet/Valet.modulemap -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk -target x86_64-apple-ios12.2-simulator -g -module-cache-path /Users/jshier/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Index/DataStore -swift-version 5 -Xlinker -rpath -Xlinker /usr/lib/swift -I /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Products/Debug-iphonesimulator -I /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Products/Debug-iphonesimulator/Alamofire -I /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Products/Debug-iphonesimulator/Valet -F /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Products/Debug-iphonesimulator -c -j8 /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/Network/NetworkController.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/Network/Responses/BaseResponse.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/Network/Router.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/Network/BaseResponseSerializer.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/CredentialsModelController.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/Observable/Observable.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/Observable/ObservableNotifications.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/Network/Requestable.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/ViewController.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/AddUserViewController.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/Network/Responses/User.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/AppDelegate.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/Network/RawDecodable.swift /Users/jshier/Desktop/Code/HazeLight/HazeLight/CloudflareAPI/UsersModelController.swift -output-file-map /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/Objects-normal/x86_64/HazeLight-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/Objects-normal/x86_64/HazeLight.swiftmodule -Xcc -I/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/HazeLight-generated-files.hmap -Xcc -I/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/HazeLight-own-target-headers.hmap -Xcc -I/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/HazeLight-all-target-headers.hmap -Xcc -iquote -Xcc /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/HazeLight-project-headers.hmap -Xcc -I/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/jshier/Desktop/Code/HazeLight/Pods/Headers/Public -Xcc -I/Users/jshier/Desktop/Code/HazeLight/Pods/Headers/Public/Valet -Xcc -I/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/DerivedSources-normal/x86_64 -Xcc -I/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/DerivedSources/x86_64 -Xcc -I/Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -emit-objc-header -emit-objc-header-path /Users/jshier/Library/Developer/Xcode/DerivedData/HazeLight-frpauynzixkrxmaqlujlqaxjkiyp/Build/Intermediates.noindex/HazeLight.build/Debug-iphonesimulator/HazeLight.build/Objects-normal/x86_64/HazeLight-Swift.h -working-directory /Users/jshier/Desktop/Code/HazeLight

response: error response (Request Failed): :0: error: value decl ''rawValue'' has no declaration location

– begin file content --------

//

// CredentialsModelController.swift

// HazeLight

//

// Created by Jon Shier on 12/20/18.

// Copyright © 2018 Jon Shier. All rights reserved.

//

import Foundation

import Valet

final class CredentialsModelController {

struct UserCredential: Codable {

    let email: String

    let token: String

}



static let shared = CredentialsModelController()



let storage: CredentialStorage

let network: NetworkController



let allCredentials: NotificationObservable<[UserCredential]>

let currentCredential: NotificationObservable<UserCredential?>

let isVerifyingCredential: NotificationObservable<Bool>



init(storage: CredentialStorage = Keychain.shared, network: NetworkController = .shared) {

    self.storage = storage

    self.network = network

    

    allCredentials = NotificationObservable(initialValue: storage.allCredentials

protocol CredentialStorage: AnyObject {

var allCredentials: [CredentialsModelController.UserCredential] \{ get set }

var currentCredential: CredentialsModelController.UserCredential? \{ get set }

}

final class Keychain {

enum Key: String {

    case currentCredential, allCredentials

}



static let shared = Keychain()



let valet = Valet.valet(with: Identifier(nonEmpty: "com.hazelight.keychain")!, accessibility: .whenUnlocked)

let encoder = JSONEncoder()

let decoder = JSONDecoder()



func setValue<T: Codable>(_ value: T, for key: Key) {

    valet.set(object: try! encoder.encode(value), forKey: key.<refactor-offset>rawValue

extension Keychain: CredentialStorage {

var allCredentials: [CredentialsModelController.UserCredential] {

    get \{ return value(forKey: .allCredentials) ?? [] }

    set \{ setValue(newValue, for: .allCredentials) }

}



var currentCredential: CredentialsModelController.UserCredential? {

    get \{ return value(forKey: .currentCredential) }

    set \{ setValue(newValue, for: .currentCredential) }

}

}

– end file content ----------

@belkadan
Copy link
Contributor

belkadan commented Feb 7, 2019

cc @nkcsgexi

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@bnbarham
Copy link
Contributor

We no longer return local refactoring as an option here and the global refactoring has the "cannot rename system symbol" error.

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. found by stress tester Flag: An issue found by the SourceKit stress tester
Projects
None yet
Development

No branches or pull requests

3 participants