Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftgenerics and constraintsSingle-choice MCQ

Which call below is rejected by the compiler, given these overloaded generic constraints?

func describe<T: Equatable>(_ x: T) -> String { "equatable" } func describe<T: Comparable>(_ x: T) -> String { "comparable" } struct Tag: Equatable {} let a = describe(5) // (1) let b = describe(Tag()) // (2) let c = describe("hi") // (3)