mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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
25 lines
526 B
Swift
25 lines
526 B
Swift
// RUN: rm -rf %t
|
|
// RUN: mkdir %t
|
|
// RUN: %swift -emit-module -o %t/def_union.swiftmodule %S/Inputs/def_union.swift
|
|
// RUN: llvm-bcanalyzer %t/def_union.swiftmodule | FileCheck %s
|
|
// RUN: %swift -parse -I=%t %s -o /dev/null
|
|
|
|
// CHECK-NOT: FALL_BACK_TO_TRANSLATION_UNIT
|
|
// CHECK-NOT: UnknownCode
|
|
|
|
import def_union
|
|
|
|
var a : Basic
|
|
a = .Untyped
|
|
a.doSomething()
|
|
a = .HasType(4)
|
|
a.doSomething()
|
|
|
|
var g = Generic.Left(false)
|
|
g = .Right(true)
|
|
|
|
var lazy = Lazy.Thunk({ 42 })
|
|
var comp : Computable = lazy
|
|
comp.compute()
|
|
lazy.compute()
|