Skip to content

Conversation

@grynspan
Copy link
Contributor

@grynspan grynspan commented Jul 7, 2025

This PR prevents `@Test` from being applied to an operator declaration
such as:

```swift
@test(arguments: ...)
static func +(lhs: A, rhs: B) { ... }
```

Now, the following error will be emitted by the compiler:

> 🛑 Attribute 'Test' cannot be applied to an operator

Previously, applying `@Test` to an operator produced undefined/unstable
effects.

Resolves #1204.

### Checklist:

- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
@grynspan grynspan added this to the Swift 6.2 milestone Jul 7, 2025
@grynspan grynspan self-assigned this Jul 7, 2025
@grynspan grynspan added bug 🪲 Something isn't working macros 🔭 Related to Swift macros such as @Test or #expect integration ⚙️ Integrating work to release branches labels Jul 7, 2025
@grynspan
Copy link
Contributor Author

grynspan commented Jul 7, 2025

@swift-ci test

@grynspan grynspan merged commit 93fd967 into release/6.2 Jul 8, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/1204-block-operators-as-test-decls-6.2 branch July 8, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working integration ⚙️ Integrating work to release branches macros 🔭 Related to Swift macros such as @Test or #expect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants