mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
a constraint system in "allowFreeTypeVariables" mode. Previously, we only allowed a few specific constraints, now we allow any relational and member constraints. The later one is a big deal because it means that we can allow ".Foo" expressions as ambiguous solutions, which CSDiags can handle well. This unblocks solving 23942743 and enables some minor improvements across the board, including diagnosing things like this better: Optional(.none) // now: generic parameter 'T' could not be inferred That said, it also just permutes some non-awesome diagnostics.
25 lines
436 B
Swift
25 lines
436 B
Swift
// RUN: %target-parse-verify-swift
|
|
|
|
// Simple enumeration type
|
|
enum E1 {
|
|
case First
|
|
case Second(Int)
|
|
case Third(Int, Double)
|
|
}
|
|
|
|
var e1: E1 = .First
|
|
e1 = .Second(5)
|
|
e1 = .Third(5, 3.14159)
|
|
|
|
// Generic enumeration type
|
|
enum E2<T> {
|
|
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}}
|