Last active
May 28, 2021 06:32
-
-
Save anhnguyen1618/327962f11dc7f2b250573b329429eb81 to your computer and use it in GitHub Desktop.
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 Color: Int { | |
case green | |
} | |
struct Test { | |
static func f<A>(_ z: A) { | |
print("Not enum") | |
} | |
static func f<A>(_ z: A) where A == Color { | |
print("Enum") | |
} | |
} | |
func g<K>(_ n: K) { | |
Test.f(n) | |
} | |
g(Color.green) // Not enum | |
g(1) // Not enum | |
Test.f(Color.green) // Enum | |
Test.f(1) // Not enum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment