Files
swift-mirror/test/Serialization/class.swift
Jordan Rose 9a67bc597e [serialization] Add support for classes.
Classes are exactly like structs except that they may have a base class.
However, this type will show up in the inheritance list. That means we
don't actually need to serialize it twice; we can just grab the base class
from the inheritance list.

Swift SVN r6133
2013-07-10 23:25:34 +00:00

62 lines
1.0 KiB
Swift

// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %swift -emit-module -o %t/def_class.swiftmodule %S/Inputs/def_class.swift
// RUN: llvm-bcanalyzer %t/def_class.swiftmodule | FileCheck %s
// RUN: %swift -emit-silgen -I=%t %s -o /dev/null
// CHECK-NOT: FALL_BACK_TO_TRANSLATION_UNIT
import def_class
var a : Empty
var b = TwoInts(1, 2)
var c : ComputedProperty
var sum = b.x + b.y + c.value
var intWrapper = ResettableIntWrapper()
var r = intWrapper as Resettable
r.reset()
class AnotherIntWrapper : SpecialResettable {
var value : Int
func reset() {
value = 0
}
func compute() {
value = 42
}
}
var intWrapper2 = AnotherIntWrapper()
r = intWrapper2
r.reset()
var c = intWrapper2 as Cacheable
c.compute()
c.reset()
var p = Pair(1, 2.5)
p.first = 2
p.second = 5.0
struct Int {}
var gc = GenericCtor<Int>()
gc.doSomething()
a = StillEmpty()
r = StillEmpty()
var bp = BoolPair()
bp.bothTrue()
var rawBP : Pair<Bool, Bool>
rawBP = bp
var rev : SpecialPair<Double>
rev.first = 42
var comp : Computable = rev