splash/Sources/Splash/Extensions/Equatable/Equatable+AnyOf.swift
John Sundell be35cef1ea Correctly handle static methods called on a generic type
This patch fixes syntax highlighting for the following scenario:

```
Type<GenericType>.call()
```

Highlighting generic types is especially tricky, since we want them to
be highlighted when appearing at the call site, like above - but we don’t
want to highlight them when they are being declared. Hopefully with this
fix all/most edge cases are covered.
2018-08-27 00:10:08 +02:00

18 lines
356 B
Swift

/**
* Splash
* Copyright (c) John Sundell 2018
* MIT license - see LICENSE.md
*/
import Foundation
extension Equatable {
func isAny(of candidates: Self...) -> Bool {
return candidates.contains(self)
}
func isAny<S: Sequence>(of candidates: S) -> Bool where S.Element == Self {
return candidates.contains(self)
}
}