Skip to content

Make all generated members nonisolated#26

Merged
mattt merged 2 commits into
mainfrom
mattt/nonisolated-generable
Nov 9, 2025
Merged

Make all generated members nonisolated#26
mattt merged 2 commits into
mainfrom
mattt/nonisolated-generable

Conversation

@mattt

@mattt mattt commented Nov 9, 2025

Copy link
Copy Markdown
Collaborator

Resolves #24

This PR fixes MainActor isolation compilation issues by updating the @Generable macro declarations to be nonisolated.

@mattt
mattt requested a review from Copilot November 9, 2025 11:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for @MainActor isolation to the @Generable macro by marking all generated protocol requirement implementations as nonisolated. This allows types annotated with both @MainActor and @Generable to work correctly without actor isolation conflicts.

Key changes:

  • Added nonisolated keyword to all generated methods and properties in the @Generable macro
  • Added a test case to verify @MainActor isolated structs work with the @Generable macro
  • Minor code style improvements (removing extra blank lines, simplifying syntax initializers)

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Sources/AnyLanguageModelMacros/GenerableMacro.swift Added nonisolated keyword to all generated protocol implementations (init, properties, and methods) to support @MainActor isolation; minor syntax and formatting improvements
Tests/AnyLanguageModelTests/GenerableMacroTests.swift Added test case with @MainActor isolated struct to verify the macro works correctly with actor isolation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mattt
mattt merged commit bfee8f6 into main Nov 9, 2025
9 checks passed
@mattt
mattt deleted the mattt/nonisolated-generable branch November 9, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example doesn't compile with default MainActor isolation

2 participants