Skip to content

Instantly share code, notes, and snippets.

@ezura
Last active July 23, 2017 07:49
Show Gist options
  • Save ezura/a1aa2c4a6c5c5579880314a81e42d64c to your computer and use it in GitHub Desktop.
Save ezura/a1aa2c4a6c5c5579880314a81e42d64c to your computer and use it in GitHub Desktop.
enum E<T: ExpressibleByIntegerLiteral>
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
@ezura
Copy link
Author

ezura commented Jul 10, 2017

Swift の SILGen のテストコードにあったやつを動く形に書き換えたんだけど、元にしたコードってどこだっけ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment