Enum selection fails to compile
bug
### Description
Selecting an enum type (`asset.type`) leads to a compilation error in the below query:
```swift
Self.join(LocalAsset.all) { task, asset in task.localId.eq(asset.id) }
.where { task, asset in asset.checksum.isNot(nil) }
.select { task, asset in
LocalAssetTaskData.Columns(
attempts: task.attempts,
checksum: asset.checksum,
createdAt: asset.createdAt,
filePath: task.filePath,
isFavorite: asset.isFavorite,
isLivePhoto: task.isLivePhoto,
livePhotoVideoId: task.livePhotoVideoId,
localId: asset.id,
priority: task.priority,
taskId: task.id,
type: asset.type,
updatedAt: asset.updatedAt
)
}
```
The error described in this issue is from the reproducing project attached. The error in my actual project is different and it only failed for release builds, very similar to the issue [here](https://github.com/groue/GRDB.swift/issues/1281) (and disabling the optimization pass as mentioned also worked in that case). I'm not sure if the underlying cause is the same.
### Checklist
- [x] I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
- [ ] If possible, I've reproduced the issue using the `main` branch of this package.
- [x] This issue hasn't been addressed in an [existing GitHub issue](https://github.com/pointfreeco/swift-structured-queries/issues) or [discussion](https://github.com/pointfreeco/swift-structured-queries/discussions).
### Expected behavior
It should compile without error, seeing as `type` in both the struct and table definition are the same enum type.
### Actual behavior
It fails to compile with `Type '(_: LocalAsset)' cannot conform to 'Table'`. If I comment out the type field in the struct and query, it compiles successfully.
### Reproducing project
[repro.zip](https://github.com/user-attachments/files/23611135/repro.zip)
### Structured Queries version information
0.25.2
### Destination operating system
iOS 26.1
### Xcode version information
26.1.1
### Swift Compiler version information
```shell
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Target: arm64-apple-macosx26.0
```
关闭于 2025-11-19 7 条评论