Files
swift-mirror/test/Serialization/Inputs/def_union.swift
Jordan Rose 674a03b085 Replace "oneof" with "union"...everywhere.
We haven't fully updated references to union cases, and enums still are not
their own thing yet, but "oneof" is gone. Long live "union"!

Swift SVN r6783
2013-07-31 21:33:33 +00:00

31 lines
384 B
Swift

union Basic {
case Untyped
case HasType(Int)
constructor() {
this = .Untyped
}
func doSomething() {}
}
union Generic<A> {
case Left(A)
case Right(A)
}
protocol Computable {
func compute()
}
union Lazy<T> : Computable {
case Thunk(() -> T)
case Value(T)
func compute() {
// if (this ~= .Thunk(var fn)) {
// this = .Value(fn())
// }
}
}