# Where is FullTypedThrows?

**URL:** <https://forums.swift.org/t/where-is-fulltypedthrows/72346>\
**Category:** Using Swift\
**Created:** [June 11, 2024, 2:33am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346 "2024-06-11T02:33:08Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 11, 2024, 2:33am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/1 "2024-06-11T02:33:08Z")

</div>

Typed throws is finally here with Swift 6 in Xcode 16b1. However, it isn't very useful since you can't actually catch any typed errors without the `FullTypedThrows` experimental feature or Swift 6 mode. However, I can't seem to activate that part of the feature. Neither the experimental flag nor the full Swift 6 mode seem to enable the behavior. Was it removed?

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 11, 2024, 2:48am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/2 "2024-06-11T02:48:11Z")

</div>

I can even write my own `MyResult` type and the compiler knows the `as SomeError` is redundant in the `catch`, and doesn't force me to write a fallback `catch`, yet the type still comes out as `any Error`.

```swift
enum SomeError: Error {
    case first
}

func doThing() throws(SomeError) -> String {
    "string"
}

let result = Result { try doThing() }

enum MyResult<Success, Failure: Error> {
    case success(Success), failure(Failure)
    
    init(catching: () throws(Failure) -> Success) {
        do {
            self = .success(try catching())
        } catch let error as Failure { // 'as' test is always true
            self = .failure(error)
        }
    }
}

let myResult = MyResult { try doThing() }

print(type(of: result), type(of: myResult))

// prints Result<String, Error> MyResult<String, Error>

```

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 11, 2024, 2:51am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/3 "2024-06-11T02:51:05Z")

</div>

Ah, I can get a typed error if I pass the throwing function directly: `let result = Result(catching: doThing)` is properly typed as `Result<String, SomeError>`. However, even in that case `get()` throws `any Error`.

---

<div class="post-metadata">

**Author:** ![Quedlinbug](https://avatars.discourse-cdn.com/v4/letter/q/77aa72/32.png) [@Quedlinbug](https://forums.swift.org/u/Quedlinbug)\
**Post date:** [June 11, 2024, 4:47am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/5 "2024-06-11T04:47:48Z")

</div>

> [@Jon\_Shier](#):
>
> However, even in that case `get()` throws `any Error`.

This is not the behavior I am seeing.

 ![Screenshot 2024-06-11 at 12.44.48 AM](https://global.discourse-cdn.com/swift/original/3X/d/c/dc85317fcb158e2e91e0c796412802d4ba1277ca.png)

I am finding that it is necessary to be [explicit](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md#specific-types-in-catch-blocks) more than it should be, requiring this sort of annotation in some cases:

```swift
do throws(SomeError)

```

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 11, 2024, 4:58am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/6 "2024-06-11T04:58:36Z")

</div>

All you’re doing is getting an unspoiled function reference there, you’re not actually capturing an error or calling `get()`.

---

<div class="post-metadata">

**Author:** ![Quedlinbug](https://avatars.discourse-cdn.com/v4/letter/q/77aa72/32.png) [@Quedlinbug](https://forums.swift.org/u/Quedlinbug)\
**Post date:** [June 11, 2024, 5:01am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/7 "2024-06-11T05:01:30Z")

</div>

I didn't think it was necessary to show that.

 ![Screenshot 2024-06-11 at 1.01.05 AM](https://global.discourse-cdn.com/swift/original/3X/b/a/ba04ea45fb3c470b76ba727e7f30fe49bd1b0a65.png)

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 14, 2024, 10:06pm UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/8 "2024-06-14T22:06:25Z")

</div>

That still doesn't show the feature works.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 14, 2024, 10:08pm UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/9 "2024-06-14T22:08:11Z")

</div>

In any case, it appears that `FullTypedThrows` hasn't been completed. Can experimental features be accessed from Apple toolchains in the first place? Is there anyway to use it in Xcode 16 at all, or will it need to be completed as an upcoming feature first? (@hborla)

---

<div class="post-metadata">

**Author:** ![wadetregaskis](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/wadetregaskis/32/8494_2.png) [@wadetregaskis](https://forums.swift.org/u/wadetregaskis)\
**Post date:** [June 14, 2024, 11:12pm UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/10 "2024-06-14T23:12:41Z")

</div>

Tangentially, note that enabling `FullTypedThrows` in the WWDC Swift build typically causes the compiler to use hundreds of gigabytes of RAM and effectively spin forever, for non-trivial packages. It's clearly not ready for broad use - probably not outside the compiler team. (possibly top of tree is better, I haven't checked)

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 14, 2024, 11:20pm UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/11 "2024-06-14T23:20:32Z")

</div>

I’m not sure it does anything at all, or whether experimental features are enabled at all for Xcode’s toolchain.

---

<div class="post-metadata">

**Author:** ![Quedlinbug](https://avatars.discourse-cdn.com/v4/letter/q/77aa72/32.png) [@Quedlinbug](https://forums.swift.org/u/Quedlinbug)\
**Post date:** [June 15, 2024, 1:07am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/12 "2024-06-15T01:07:18Z")

</div>

> [@Jon\_Shier](#):
>
> That still doesn't show the feature works.

"Works" is a spectrum. I appreciate that you're frustrated, and I'm sure you have code that's exhibiting problems, but it's unclear from what you've said so far what the problems are. It would be useful to the rest of us if you could demonstrate what we should be on the lookout for. (From what @wadetregaskis says, maybe it just takes scale for things to break down.)

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 15, 2024, 1:52am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/13 "2024-06-15T01:52:59Z")

</div>

I've already provided an example that I'd expect to work but doesn't (error types in closures, creation in the init method). I see no difference in behavior no matter what flags I have.

---

<div class="post-metadata">

**Author:** ![Quedlinbug](https://avatars.discourse-cdn.com/v4/letter/q/77aa72/32.png) [@Quedlinbug](https://forums.swift.org/u/Quedlinbug)\
**Post date:** [June 15, 2024, 3:19am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/14 "2024-06-15T03:19:18Z")

</div>

What's listed in the proposal under [**Closure thrown type inference**](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0413-typed-throws.md#closure-thrown-type-inference) is not working for me either, but implicit typing is not necessary, just a definite nice-to-have.

 ![Screenshot 2024-06-14 at 11.24.41 PM](https://global.discourse-cdn.com/swift/original/3X/0/0/006efc18e04c7cd0de19fff383eaa33b6281f5f5.png)

---

<div class="post-metadata">

**Author:** ![hborla](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hborla/32/27563_2.png) [@hborla](https://forums.swift.org/u/hborla)\
**Post date:** [June 15, 2024, 3:33am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/15 "2024-06-15T03:33:43Z")

</div>

> [@Jon\_Shier](#):
>
> In any case, it appears that `FullTypedThrows` hasn't been completed. Can experimental features be accessed from Apple toolchains in the first place? Is there anyway to use it in Xcode 16 at all, or will it need to be completed as an upcoming feature first? (@hborla)

The `FullTypedThrows` experimental feature is currently enable-able in Xcode 16 Beta 1. As in, you can enable it explicitly with `-enable-experimental-feature FullTypedThrows`. However, I believe this was accidental, as `FullTypedThrows` isn't ready to be enabled in a real-world project yet, and I'm currently preparing a PR to make it only enable-able in asserts toolchains (e.g. in development snapshots from [Swift.org](http://Swift.org)).

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [June 15, 2024, 3:54am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/16 "2024-06-15T03:54:16Z")

</div>

Good to know, thanks. When it comes back will it be an experimental or upcoming feature? And since it's not part of 6 that means it can't be enabled by default until Swift 7 (or whatever the next mode is called) right?

---

<div class="post-metadata">

**Author:** ![hborla](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hborla/32/27563_2.png) [@hborla](https://forums.swift.org/u/hborla)\
**Post date:** [June 15, 2024, 4:03am UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/17 "2024-06-15T04:03:04Z")

</div>

> [@Jon\_Shier](#):
>
> When it comes back will it be an experimental or upcoming feature?

It'll come back as an upcoming feature.

> [@Jon\_Shier](#):
>
> And since it's not part of 6 that means it can't be enabled by default until Swift 7 (or whatever the next mode is called) right?

Yes, when `FullTypedThrows` is available as an upcoming feature, it won't be enabled by default in the Swift 6 language mode. It'll be enabled by default in whatever the next language mode is along with `ExistentialAny` and `InternalImportsByDefault`.

---

<div class="post-metadata">

**Author:** ![setoelkahfi](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/setoelkahfi/32/3471_2.png) [@setoelkahfi](https://forums.swift.org/u/setoelkahfi)\
**Post date:** [December 17, 2024, 1:42pm UTC](https://forums.swift.org/t/where-is-fulltypedthrows/72346/18 "2024-12-17T13:42:16Z")

</div>

> [@Jon\_Shier](#):
>
> FullTypedThrows

The `FullTypedThrows` feature is interesting for me, but apparently is is [uninteresting feature](https://github.com/swiftlang/swift/blob/f2ad9f3d9018f18cc2307f4bd8829672d8579c52/lib/AST/FeatureSet.cpp#L67) for the compiler.
