diff --git a/CHANGELOG.md b/CHANGELOG.md index 932ca7f6a7..7a8267ec4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ [Ornithologist Coder](https://github.com/ornithocoder) [#1885](https://github.com/realm/SwiftLint/issues/1885) +* Add 4.1.0, 4.1.1 and 4.2.0 to Swift version detection. + [norio-nomura](https://github.com/norio-nomura) + [#2143](https://github.com/realm/SwiftLint/issues/2143) + #### Bug Fixes * Fixes an issue with the `yoda_condition` rule where the severity would always diff --git a/Source/SwiftLintFramework/Models/SwiftVersion.swift b/Source/SwiftLintFramework/Models/SwiftVersion.swift index 6aa7906b3a..707bf4a779 100644 --- a/Source/SwiftLintFramework/Models/SwiftVersion.swift +++ b/Source/SwiftLintFramework/Models/SwiftVersion.swift @@ -43,7 +43,11 @@ extension SwiftVersion { } let file = File(contents: """ - #if swift(>=4.1.0) + #if swift(>=4.2.0) + let version = "4.2.0" + #elseif swift(>=4.1.1) + let version = "4.1.1" + #elseif swift(>=4.1.0) let version = "4.1.0" #elseif swift(>=4.0.3) let version = "4.0.3" @@ -53,6 +57,12 @@ extension SwiftVersion { let version = "4.0.1" #elseif swift(>=4.0.0) let version = "4.0.0" + #elseif swift(>=3.4.0) + let version = "3.4.0" + #elseif swift(>=3.3.1) + let version = "3.3.1" + #elseif swift(>=3.3.0) + let version = "3.3.0" #elseif swift(>=3.2.3) let version = "3.2.3" #elseif swift(>=3.2.2) diff --git a/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift b/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift index 9ba26e6226..9f748dd8fd 100644 --- a/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift +++ b/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift @@ -329,7 +329,11 @@ class LinterCacheTests: XCTestCase { } func testDetectSwiftVersion() { - #if swift(>=4.1.0) + #if swift(>=4.2.0) + let version = "4.2.0" + #elseif swift(>=4.1.1) + let version = "4.1.1" + #elseif swift(>=4.1.0) let version = "4.1.0" #elseif swift(>=4.0.3) let version = "4.0.3" @@ -339,6 +343,12 @@ class LinterCacheTests: XCTestCase { let version = "4.0.1" #elseif swift(>=4.0.0) let version = "4.0.0" + #elseif swift(>=3.4.0) + let version = "4.2.0" // Since we can't pass SWIFT_VERSION=3 to sourcekit, it returns 4.2.0 + #elseif swift(>=3.3.1) + let version = "4.1.1" // Since we can't pass SWIFT_VERSION=3 to sourcekit, it returns 4.1.1 + #elseif swift(>=3.3.0) + let version = "4.1.0" // Since we can't pass SWIFT_VERSION=3 to sourcekit, it returns 4.1.0 #elseif swift(>=3.2.3) let version = "4.0.3" // Since we can't pass SWIFT_VERSION=3 to sourcekit, it returns 4.0.3 #elseif swift(>=3.2.2)