Swift does not work. To call a function that requires a metatype?

Here is the code I'm writing:

func printType<T: Any>(one: T.Type) {
    print(one)
}
func printType2<T: Any>(one: T.Type, name: String) {
    print(one)
}
printType(Set<Int>)
printType2(Set<Int>.self, name: "name")

I wonder why it printType(Set<Int>)might work. And printType2(Set<Int>.self, name: "name")I can’t leave. To make it work.

Edit:

I want to know what rule implies when I can omit .self. I tried to find it in the official Apple links, but could not.

Edit:

I am testing codes in Xcode version 7.1 (7B91b).

+2
source share
1 answer

I also ask him on the official Apple forum and get an answer there:

This is a well-known undocumented Swift function starting with 1.0 (or earlier> beta, which I cannot confirm).

> .self. , Swift, sizeof-like > , .

https://forums.developer.apple.com/thread/24980

+1

Source: https://habr.com/ru/post/1614302/