There are two different writing:
func dicFuncA() -> Dictionary<String, Any> {
return [
"a": "ooo",
"b": 30,
"c": [1, 2, 3],
"d": 2.33
]
}
And
func dicFuncB() -> Dictionary<String, Any> {
let dic: [String : Any] = [
"a": "ooo",
"b": 30,
"c": [1, 2, 3],
"d": 2.33
]
return dic
}
When add "-Xfrontend -debug-time-function-bodies" to Other Swift Flags:
We can get the compile time of the function:
The compile time of dicFuncA is about 54 times longer than the time of dicFuncB!
That's Why?
Probably, it's the cause of type check. But, is there some way to figure out what the compiler have done during the compile time?
I try to use swiftc command, like -dump-ast/-dump-parse, to find out the real reason. But, still confused.

