Last active
July 23, 2017 07:49
-
-
Save ezura/a1aa2c4a6c5c5579880314a81e42d64c to your computer and use it in GitHub Desktop.
enum E<T: ExpressibleByIntegerLiteral>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum E<T: ExpressibleByIntegerLiteral>: T where T: Equatable { | |
case a = 1 | |
} | |
struct MyType: ExpressibleByIntegerLiteral, Equatable { | |
let v: String | |
init(integerLiteral value: IntegerLiteralType) { v = String(value) } | |
static func ==(lhs: MyType, rhs: MyType) -> Bool { return true } | |
} | |
let ei: E<Int> = .a | |
let es: E<MyType> = .a | |
let i: Int = E<Int>.a.rawValue | |
let s: MyType = E<MyType>.a.rawValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Swift の SILGen のテストコードにあったやつを動く形に書き換えたんだけど、元にしたコードってどこだっけ