Files
swift-mirror/test/expr/delayed-ident/enum.swift
Chris Lattner b5500b8600 Generalize the conditions in which we'll accept an ambiguous solution to
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.
2016-01-11 17:04:46 -08:00

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}}