 import Foundation
 import SourceKittenFramework
 
-public struct SyntacticSugarRule: ConfigurationProviderRule, AutomaticTestableRule {
+public struct SyntacticSugarRule: SubstitutionCorrectableRule, ConfigurationProviderRule, AutomaticTestableRule {
     public var configuration = SeverityConfiguration(.warning)
+
+    private var pattern: String {
+        let types = ["Optional", "ImplicitlyUnwrappedOptional", "Array", "Dictionary"]
+        let negativeLookBehind = "(?:(?<!\\.)|Swift\\.)"
+        return negativeLookBehind + "\\b(" + types.joined(separator: "|") + ")\\s*<.*?>"
+    }
 
     public init() {}
 

            "func x(a: ↓Array<Int>, b: Int) -> ↓Dictionary<Int, String>",
            "let x = ↓Array<String>.array(of: object)",
            "let x: ↓Swift.Optional<String>"
        ]
    )

    public func validate(file: File) -> [StyleViolation] {
        let types = ["Optional", "ImplicitlyUnwrappedOptional", "Array", "Dictionary"]
        let negativeLookBehind = "(?:(?<!\\.)|Swift\\.)"
        let pattern = negativeLookBehind + "\\b(" + types.joined(separator: "|") + ")\\s*<.*?>"
        let excludingKinds = SyntaxKind.commentAndStringKinds
        let contents = file.contents.bridge()
        let range = NSRange(location: 0, length: contents.length)

                    return nil
            }

            return result
        }
    }

