[SR-2853] Type inference when assigning the result of reduce to a dictionary #45447
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Environment
Tested with Xcode 8 and 8.1 beta on macOS 10.12.
Additional Detail from JIRA
md5: a8c804c59b4216332161a5c76e7e1006
Issue Description:
This fails to compile:
It seems that the compiler tries to make the RHS an
Int?
and therefore infers the type of the initial value0
and the accumulating value$0
asInt?
.However, it compiles if the trailing closure syntax is used:
or if the initial value is given as
Int(0)
instead of0
:I do not know if (A) should compile, but there should not be a difference between (A), (B), and (C).
The text was updated successfully, but these errors were encountered: