Files
swift-mirror/test/Interpreter/nested_generics.swift
Dmitri Hrybenko de9a0c8ff0 stdlib/printing: remove ReplPrintable protocol
It is replaced by debugPrint() family of functions, that are called by REPL.

There is a regression in printing types that don't conform to Printable, this
is tracked by rdar://16898708


Swift SVN r18006
2014-05-13 16:22:56 +00:00

40 lines
645 B
Swift

// RUN: %target-run-simple-swift | FileCheck %s
protocol MyPrintable {
func print()
}
struct PrintableValue : MyPrintable {
init(_ value: String) {
self.value = value
}
func print() {
Swift.print(value)
}
var value: String
}
class Foo<T : MyPrintable> {
init<U : MyPrintable>(_ t: T, _ u: U) {
print("init ")
t.print()
print(" ")
u.print()
println("")
}
func bar<U : MyPrintable>(u: U) {
print("bar ")
u.print()
println("")
}
}
// CHECK: init 1 two
var foo = Foo<PrintableValue>(PrintableValue("1"), PrintableValue("two"))
// CHECK: bar 3
var c = PrintableValue("3")
foo.bar(c)