Closed
Description
Swiftlint 0.14.0 crashes when run as build phase in Xcode 8.2 (8C38) while trying to parse following statement:
public typealias 🔳 = QRCode
/Users/XXXXX/Library/Developer/Xcode/DerivedData/XXXXXX-aqobyostblawgtbajeamvisokbcm/Build/Intermediates/CodeCoverage/Intermediates/XXXXXX.build/Debug-appletvsimulator/XXXXXX.build/Script-5BEA03541CCE131F008B1777.sh: line 6: 16251 Illegal instruction: 4 swiftlint
Command /bin/sh failed with exit code 132
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
jpsim commentedon Dec 19, 2016
That's a fun one 😄 . Thanks for reporting! Although I can't reproduce this...
What does your configuration look like? Are you enabling any opt-in rules? Are you sure it crashes with just the sample you've provided, or does that string crash with a rule for text later in the file?
marcelofabri commentedon Dec 19, 2016
I was able to reproduce the crash by adding this example on
nonTriggeringExamples
and running the tests:marcelofabri commentedon Dec 19, 2016
It seems that
samePosition(in: content.utf16)
is returningnil
.marcelofabri commentedon Dec 19, 2016
Replacing
lineAndCharacter(forByteOffset:
in SourceKitten with this implementation solves the crash.All tests in SourceKitten pass, but I had to change
OverriddenSuperCallRule.swift
andProhibitedSuperRule.swift
so the markers intriggeringExamples
would be after the{
(they are before now). So I'm not 100% sure this is a correct change 😅jpsim commentedon Dec 19, 2016
Sounds like there's a bug somewhere in SourceKitten, whether it's in
lineAndCharacter(forByteOffset:)
,location(fromByteOffset:)
orlineAndCharacter(forCharacterOffset:)
. 😬marcelofabri commentedon Dec 19, 2016
It's in
lineAndCharacter(forByteOffset:)
😅marcelofabri commentedon Dec 19, 2016
This line actually: https://github.com/jpsim/SourceKitten/blob/master/Source/SourceKittenFramework/String%2BSourceKitten.swift#L183
marcelofabri commentedon Dec 19, 2016
Or were you referring to the +1 offset after changing the implementation? 🤔
jpsim commentedon Dec 19, 2016
All of it. There's a bug now with
lineAndCharacter(forByteOffset:)
(as evidenced by this crash) and there's a bug in eitherlocation(fromByteOffset:)
,lineAndCharacter(forCharacterOffset:)
orOverriddenSuperCall
/ProhibitedSuper
(as evidenced by the changed offset).marcelofabri commentedon Dec 19, 2016
I have no clue why only these tests are failing. I thought it could be because of
\t
(and maybe\n
), but even after removing them I still get the failures 😭 (and the same behavior with the old implementation)mknabbe commentedon Dec 20, 2016
I don't know if it's still relevant. Here's my configuration.
16 remaining items