             let length = (dictionary["key.namelength"] as? Int64).flatMap({ Int($0) }),
             case let contents = file.contents.bridge(),
             let range = contents.byteRangeToNSRange(start: offset, length: length),
-            let match = pattern.firstMatch(in: file.contents, options: [], range: range)?.rangeAt(1),
+            let match = genericTypeRegex.firstMatch(in: file.contents, options: [], range: range)?.rangeAt(1),
             match.location < minParameterOffset(parameters: dictionary.enclosedVarParameters, file: file) else {
             return []
         }

            case let start = nameOffset + nameLength,
            case let length = bodyOffset - start,
            let range = contents.byteRangeToNSRange(start: start, length: length),
            let match = pattern.firstMatch(in: file.contents, options: [], range: range)?.rangeAt(1) else {
                return []
        }


        }
    )

    private let genericTypePattern = "<(\\s*\\w.*?)>"
    private var genericTypeRegex: NSRegularExpression {
        return regex(genericTypePattern)
    }

    public func validateFile(_ file: File) -> [StyleViolation] {
        return validateFile(file, dictionary: file.structure.dictionary) +
            validateGenericTypeAliases(file)
    }

    public func validateFile(_ file: File,
                             kind: SwiftDeclarationKind,
