Skip to content

#expect doesn't detect "nested" try #996

Open
@finestructure

Description

@finestructure

Description

I have an assertion

#expect(res == .valid(try SPIManifest.Manifest(yml: yml)))

that fails to compile with

Call can throw, but it is executed in a non-throwing autoclosure.

The fix is to change this to

#expect(try res == .valid(SPIManifest.Manifest(yml: yml)))

It's not a big deal to make the change but it's still a little surprising and might stump people converting XCT assertions over to Swift Testing.

Reproduction

#expect(res == .valid(try SPIManifest.Manifest(yml: yml)))

Expected behavior

No compile error.

Environment

❯ swift --version
swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0
❯ uname -a
Darwin Luna.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions