Files
swift-mirror/test/Interpreter/conversions.swift
2016-08-10 23:52:02 -07:00

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>())