From ea8ef1435ea9112841ec8dbe6f3cd69372a0dab5 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Sun, 5 Aug 2018 10:14:13 -0700 Subject: [PATCH] Prevent changing the value of Lazy.value this should only be set by running `computation()` --- Source/SwiftLintFramework/Rules/LineLengthRule.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/SwiftLintFramework/Rules/LineLengthRule.swift b/Source/SwiftLintFramework/Rules/LineLengthRule.swift index b1d44c511..6c43db827 100644 --- a/Source/SwiftLintFramework/Rules/LineLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/LineLengthRule.swift @@ -129,7 +129,7 @@ public struct LineLengthRule: ConfigurationProviderRule { // extracted from https://forums.swift.org/t/pitch-declaring-local-variables-as-lazy/9287/3 private class Lazy { private var computation: () -> Result - lazy var value: Result = computation() + fileprivate private(set) lazy var value: Result = computation() init(_ computation: @escaping @autoclosure () -> Result) { self.computation = computation