fixes for Swift 6 and threading concerns
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"originHash" : "761afb81afb2ac947c6453b20b16362a6beb5e16c81166e6f2953e07cff14b07",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "linenoise-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/andybest/linenoise-swift",
|
||||
"state" : {
|
||||
"revision" : "afc897c02b030af7333105c4fedcd843a8339238",
|
||||
"version" : "0.0.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "nimble",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/Quick/Nimble.git",
|
||||
"state" : {
|
||||
"revision" : "e9d769113660769a4d9dd3afb855562c0b7ae7b0",
|
||||
"version" : "7.3.4"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 3
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// swift-tools-version: 6.0
|
||||
//
|
||||
// Phase 201 regression fixture — committed smoke test.
|
||||
//
|
||||
// Proves that a consumer building under Xcode 26's default
|
||||
// `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor` (reproduced here with
|
||||
// `.swiftLanguageMode(.v6)` + the raw `-default-isolation MainActor` unsafe flag —
|
||||
// `.defaultIsolation(MainActor.self)` is unavailable in this SwiftPM toolchain) can
|
||||
// subclass `SynthesizerBase` and override `build()` with ZERO concurrency annotations.
|
||||
//
|
||||
// If `SynthesizerBase`'s `@MainActor` isolation ever regresses, this package fails to
|
||||
// compile with:
|
||||
// "main actor-isolated instance method 'build()' has different actor isolation
|
||||
// from nonisolated overridden declaration"
|
||||
//
|
||||
// Build to verify: (cd RegressionFixtures/MainActorConsumer && swift build)
|
||||
//
|
||||
// This is a standalone SwiftPM package (not part of the root `swift test`), mirroring
|
||||
// the `LiveCompile/` sub-package layout. It references the core package by relative path.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "MainActorConsumer",
|
||||
platforms: [.macOS(.v15)],
|
||||
dependencies: [
|
||||
.package(name: "Lyrebird", path: "../..")
|
||||
],
|
||||
targets: [
|
||||
.executableTarget(
|
||||
name: "MainActorConsumer",
|
||||
dependencies: [
|
||||
.product(name: "Lyrebird", package: "Lyrebird")
|
||||
],
|
||||
swiftSettings: [
|
||||
.swiftLanguageMode(.v6),
|
||||
.unsafeFlags(["-default-isolation", "MainActor"])
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
// main.swift
|
||||
// MainActorConsumer (Phase 201 regression fixture)
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
|
||||
// PHASE 201 GUARANTEE: a consumer under the MainActor-default build mode subclasses
|
||||
// `SynthesizerBase` and overrides `build()` with NO `nonisolated`, NO `@preconcurrency`,
|
||||
// NO `@MainActor`, NO `nonisolated override init`. If this stops compiling, the
|
||||
// language-side actor-isolation guarantee has regressed.
|
||||
final class ToneSynth: SynthesizerBase {
|
||||
@LiveParam var freq: Double = 440
|
||||
override func build() {
|
||||
output(bus: 0, source: OscSin.Audio(freq: $freq) * 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
let synth = ToneSynth()
|
||||
print("Phase 201 regression fixture OK: \(synth)")
|
||||
Reference in New Issue
Block a user