tailor
tailor copied to clipboard
Parse failure when omitting external name in completion block
Tailor Version: v0.11.1
Swift Version: 3.0
Platform (Mac/Linux/Windows/CI): Mac
Installation Method: Homebrew
Steps to Reproduce Issue
make a new file Test.swift
import Foundation
class Test {
func log(_ text: String, completion: (_ text: String) -> Void) {
print(text)
completion(text)
}
}
Result
./Test.swift could not be parsed successfully, skipping...
Using --debug
Analyzing 1 file:
line 5:39 no viable alternative at input 'func log(_ text: String, completion: (_'
line 5:12 mismatched input 'text' expecting {';', '{', ',', '(', ')', '*', '<', '>', '==', '.', '=', '->', '...', '?', '!', 'is', 'as', '[', '-', '/', '&', '&&', '||', '>=', OperatorHead, '..'}
line 5:24 extraneous input ',' expecting {';', 'for', 'case', 'in', 'while', 'repeat', 'if', 'else', 'guard', 'switch', '{', '}', 'default', 'break', 'continue', 'fallthrough', 'return', 'throw', 'defer', 'do', 'catch', 'let', 'var', 'where', '#available', '(', '*', 'iOS', 'iOSApplicationExtension', 'OSX', 'watchOS', 'tvOS', '<', '>', '==', 'class', 'convenience', 'dynamic', 'final', 'infix', 'lazy', 'mutating', 'nonmutating', 'optional', 'override', 'postfix', 'prefix', 'required', 'static', 'unowned', 'safe', 'weak', 'private', 'set', 'fileprivate', 'internal', 'public', 'open', 'import', 'typealias', 'struct', 'enum', 'protocol', 'func', '.', '=', 'get', 'willSet', 'didSet', 'throws', 'rethrows', '->', '...', '_', 'indirect', 'associatedtype', 'init', '?', '!', 'deinit', 'extension', 'subscript', 'operator', 'precedence', 'associativity', 'left', 'right', 'none', 'is', 'as', '@', '[', '-', '/', '&', 'try', '#file', '#line', '#column', '#function', 'self', 'super', '#selector', '#keyPath', 'dynamicType', '&&', '||', '>=', 'Type', 'Protocol', 'Any', 'Self', 'inout', '#endif', '#if', '#elseif', '#else', 'os', 'arch', 'i386', 'x86_64', 'arm', 'arm64', '#sourceLocation', 'file', 'line', '#colorLiteral', 'fileLiteral', 'imageLiteral', 'OSXApplicationExtension', BooleanLiteral, 'nil', OperatorHead, '..', Identifier, BinaryLiteral, OctalLiteral, DecimalLiteral, HexadecimalLiteral, FloatingPointLiteral, StringLiteral}
line 5:38 no viable alternative at input 'completion: ('
line 5:41 mismatched input 'text' expecting {';', '{', ',', '(', ')', '*', '<', '>', '==', '.', '=', '->', '...', '?', '!', 'is', 'as', '[', '-', '/', '&', '&&', '||', '>=', OperatorHead, '..'}
line 5:53 extraneous input ')' expecting {';', 'for', 'case', 'in', 'while', 'repeat', 'if', 'else', 'guard', 'switch', '{', '}', 'default', 'break', 'continue', 'fallthrough', 'return', 'throw', 'defer', 'do', 'catch', 'let', 'var', 'where', '#available', '(', '*', 'iOS', 'iOSApplicationExtension', 'OSX', 'watchOS', 'tvOS', '<', '>', '==', 'class', 'convenience', 'dynamic', 'final', 'infix', 'lazy', 'mutating', 'nonmutating', 'optional', 'override', 'postfix', 'prefix', 'required', 'static', 'unowned', 'safe', 'weak', 'private', 'set', 'fileprivate', 'internal', 'public', 'open', 'import', 'typealias', 'struct', 'enum', 'protocol', 'func', '.', '=', 'get', 'willSet', 'didSet', 'throws', 'rethrows', '->', '...', '_', 'indirect', 'associatedtype', 'init', '?', '!', 'deinit', 'extension', 'subscript', 'operator', 'precedence', 'associativity', 'left', 'right', 'none', 'is', 'as', '@', '[', '-', '/', '&', 'try', '#file', '#line', '#column', '#function', 'self', 'super', '#selector', '#keyPath', 'dynamicType', '&&', '||', '>=', 'Type', 'Protocol', 'Any', 'Self', 'inout', '#endif', '#if', '#elseif', '#else', 'os', 'arch', 'i386', 'x86_64', 'arm', 'arm64', '#sourceLocation', 'file', 'line', '#colorLiteral', 'fileLiteral', 'imageLiteral', 'OSXApplicationExtension', BooleanLiteral, 'nil', OperatorHead, '..', Identifier, BinaryLiteral, OctalLiteral, DecimalLiteral, HexadecimalLiteral, FloatingPointLiteral, StringLiteral}
line 5:62 no viable alternative at input '-> Void)'
line 5:62 extraneous input ')' expecting {';', 'for', 'case', 'in', 'while', 'repeat', 'if', 'else', 'guard', 'switch', '{', '}', 'default', 'break', 'continue', 'fallthrough', 'return', 'throw', 'defer', 'do', 'catch', 'let', 'var', 'where', '#available', '(', '*', 'iOS', 'iOSApplicationExtension', 'OSX', 'watchOS', 'tvOS', '<', '>', '==', 'class', 'convenience', 'dynamic', 'final', 'infix', 'lazy', 'mutating', 'nonmutating', 'optional', 'override', 'postfix', 'prefix', 'required', 'static', 'unowned', 'safe', 'weak', 'private', 'set', 'fileprivate', 'internal', 'public', 'open', 'import', 'typealias', 'struct', 'enum', 'protocol', 'func', '.', '=', 'get', 'willSet', 'didSet', 'throws', 'rethrows', '->', '...', '_', 'indirect', 'associatedtype', 'init', '?', '!', 'deinit', 'extension', 'subscript', 'operator', 'precedence', 'associativity', 'left', 'right', 'none', 'is', 'as', '@', '[', '-', '/', '&', 'try', '#file', '#line', '#column', '#function', 'self', 'super', '#selector', '#keyPath', 'dynamicType', '&&', '||', '>=', 'Type', 'Protocol', 'Any', 'Self', 'inout', '#endif', '#if', '#elseif', '#else', 'os', 'arch', 'i386', 'x86_64', 'arm', 'arm64', '#sourceLocation', 'file', 'line', '#colorLiteral', 'fileLiteral', 'imageLiteral', 'OSXApplicationExtension', BooleanLiteral, 'nil', OperatorHead, '..', Identifier, BinaryLiteral, OctalLiteral, DecimalLiteral, HexadecimalLiteral, FloatingPointLiteral, StringLiteral}
.
********** XXXX/Test.swift **********
XXXX/Test.swift:5:06: warning: [function-whitespace] Function should have at least one blank line after it
XXXX/Test.swift:5:12: warning: [parenthesis-whitespace] Parentheses content should not end with whitespace
XXXX/Test.swift:5:41: warning: [parenthesis-whitespace] Parentheses content should not end with whitespace
Analyzed 1 file, skipped 0 files, and detected 3 violations (0 errors, 3 warnings).
Expected Behavior
Parses file
Actual Behavior
Fails to parse file
Thank you for reporting this @mattlawer! We will try to get this fixed in the coming release.
Any progress on this one? Its still blocking