Xcode 9b6: Autocompleting SKAction.run(_ block:) inside SKScene.run(_:) deletes enclosing scope

Originator:igeek1
Number:rdar://34230324 Date Originated:03-Sep-2017 10:20 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9.0 (9M214v)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
If you nest an invocation of SKAction.run(_ block:) inside a call to SKScene.run(.sequence([…])), double-clicking or hitting Return to expand the code placeholder replaces the whole nested stack with the innermost call.

Steps to Reproduce:
1. Create a subclass of SKScene.
2. In an instance function or initializer, add the following code:

run(.sequence([
    .wait(forDuration: 3),
]))

3. Add a newline after .wait(forDuration: 3), and type the following:

.run

4. Note that there are three available autocomplete suggestions that take a closure parameter:
 - 1. run { code }
 - 2. run(block: () -> Void)
 - 3. run(block: () -> Void, queue: DispatchQueue)

5. If you accept the first suggestion, it expands the suggestion inline as you would expect, using trailing closure syntax, as .run {\n\t<#code#>\n}. (newlines and tabs indicated with 
\n and \t for clarity).
6. Instead, go back a step and try accepting the second suggestion.

Expected Results:
Like step 5, it replaces just the innermost placeholder with the {\n\t<#code#>\n} trailing closure syntax.

Actual Results:
It replaces the whole run(.sequence([…])) block with just run {\n\t<#code#>\n}.

Version:
Xcode 9.0 (9M214v)

Notes:
Attached video also uploaded to https://cl.ly/mJu2

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!