mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
18 lines
421 B
Swift
18 lines
421 B
Swift
// RUN: %target-run-simple-swift | %FileCheck %s
|
|
// REQUIRES: executable_test
|
|
|
|
class B { func foo() { print("foo") } }
|
|
class D : B { func bar() { print("bar") } }
|
|
class G<T> : B { func bas() { print("bas") } }
|
|
|
|
// CHECK: foo
|
|
func up(_ d: D) { d.foo() }
|
|
// CHECK: bar
|
|
func down(_ b: B) { (b as! D).bar() }
|
|
// CHECK: bas
|
|
func down_generic(_ b: B) { (b as! G<Int>).bas() }
|
|
|
|
up(D())
|
|
down(D())
|
|
down_generic(G<Int>())
|