Files
swift-mirror/test/expr/delayed-ident/enum.swift
Pavel Yaskevich c30845fa74 [ConstraintSystem] Detect and diagnose missing generic arguments
Introduce a fix to detect and diagnose situations when omitted
generic arguments couldn't be deduced by the solver based on
the enclosing context.

Example:

```swift
struct S<T> {
}

_ = S() // There is not enough context to deduce `T`
```

Resolves: rdar://problem/51203824
2019-05-29 16:39:41 -07:00

28 lines
544 B
Swift

// RUN: %target-typecheck-verify-swift
// Simple enumeration type
enum E1 {
case First
case Second(Int)
case Third(Int, Double)
case `default`
}
var e1: E1 = .First
e1 = .Second(5)
e1 = .Third(5, 3.14159)
e1 = .default // SE-0071
// Generic enumeration type
enum E2<T> { // expected-note {{'T' declared as parameter to type 'E2'}}
case First
case Second(T)
}
var e2a: E2<Int> = .First
e2a = .Second(5)
var e2b: E2 = .Second(5)
e2b = .First
var e2c: E2 = .First // expected-error{{generic parameter 'T' could not be inferred}}