-
Notifications
You must be signed in to change notification settings - Fork 324
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Swift version
swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a, also reproducible with Xcode 26.0.1.
Platform
macOS 15.7.2
Editor
Neovim
Description
No diagnostics is produced within code-blocks hidden in non-default traits even if such traits are enabled in .sourcekit-lsp/config.json. Code in such blocks is also not indexed.
Steps to Reproduce
mkdir traits-repro
cd traits-repro
swift package init
Make sure that Package.swift looks like this:
// swift-tools-version: 6.2
import PackageDescription
let package = Package(
name: "traits-repro",
products: [
.library(
name: "traits-repro",
targets: ["traits-repro"]
),
],
traits: [
.default(enabledTraits: []),
"NonDefaultTrait",
],
targets: [
.target(
name: "traits-repro"
),
]
)Enable the trait in .sourcekit-lsp/config.json:
{
"swiftPM": {
"traits": ["NonDefaultTrait"]
}
}Add following code to Sources/traits-repro/traits_repro.swift:
#if NonDefaultTrait
func f(arg: Int) {
arg
}
func g() {
f(arg: "foo")
}
#endifYou will see that no error diagnostic is produced in the body of func g() declaration as long as NonDefaultTrait is not included in the default trait.
Logging
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working