forked from swiftlang/swift
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass-func.swift
30 lines (23 loc) · 724 Bytes
/
class-func.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
// REQUIRES: swift_in_compiler
// REQUIRES: executable_test
// REQUIRES: optimized_stdlib
// REQUIRES: swift_feature_Embedded
@main
structMain{
staticfunc main(){
letarray:[MyClass]=[MyClass(),MySubclass()]
forein array {
e.method()
}
}
}
classMyClass{
func method(){Self.foo()}
classfunc foo(){print("MyClass.foo")}
}
classMySubclass:MyClass{
overrideclassfunc foo(){print("MySubclass.foo")}
}
// CHECK: MyClass.foo
// CHECK: MySubclass.foo