[SR-7392] Initializer incorrectly marked as 'throwing' #49935
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
Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1)
Target: x86_64-apple-darwin17.4.0
Additional Detail from JIRA
md5: e91ecbf4610b9a29f828604d6a5394ee
Issue Description:
The following bug was recently discovered / discussed on the Swift Forums (https://forums.swift.org/t/i-dont-know-why-the-compiler-thinks-can-throw/11777):
In this example, a call to the first initializer should only be considered "throwing" if the function / closure argument is itself "throwing". However, in the second initializer the compiler demands that the explicit call through
self.init()
is marked withtry
even though the closure argument is not throwing. This is probably a bug.The text was updated successfully, but these errors were encountered: