You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hm. Swift's inference says that the "return type" must exactly match the contextual type, so it's not surprising that this isn't supported. In particular, your second statement let y: Bar? = .init() could indicate an initializer defined on Optional, not on Bar. But we could consider adding something like this.
$ swiftc test.swift
test.swift:7:21: error: type of expression is ambiguous without more context
let x: Bar = .init()!
~~~~~~~^
test.swift:8:16: error: value of optional type 'Bar' not unwrapped; did you mean to use '!' or '?'?
let y: Bar? = .init()
^
!
Additional Detail from JIRA
md5: 8e8a1c55fe146af0611d8368222697ed
Issue Description:
this small example program
should even with Swift's local-only type-inference be inferred I believe, however the type-checker fails on both
x
andy
:'(for
and
The text was updated successfully, but these errors were encountered: