# Referring to failable initializer with leading dot syntax

**URL:** <https://forums.swift.org/t/referring-to-failable-initializer-with-leading-dot-syntax/13570>\
**Category:** Using Swift\
**Created:** [June 11, 2018, 11:42pm UTC](https://forums.swift.org/t/referring-to-failable-initializer-with-leading-dot-syntax/13570 "2018-06-11T23:42:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [June 12, 2018, 1:49am UTC](https://forums.swift.org/t/referring-to-failable-initializer-with-leading-dot-syntax/13570/2 "2018-06-12T01:49:44Z")

</div>

The rule for leading dot syntax is that it will look in the _contextual type_ for a method/initializer/case whose result type is _identical_ to that type. That means it can't find failable initializers: if it looked for them on `Foo`, it would find a result type of type `Foo?`, and if it looked for them on `Optional`, it wouldn't find them at all.

That said, Optional is already ~~magic~~ treated specially in various parts of the language—failable initializers being one of them—and so it might be reasonable to extend the rule to allow cases like this. I'm not sure how much work that would be in the type checker, though.

---

_[View the full topic](https://forums.swift.org/t/referring-to-failable-initializer-with-leading-dot-syntax/13570)._
