Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 23.0.0

* **Breaking Change** [swift] Fixes a compile error about PigeonError's sendability conformance in Swift 6.

## 22.7.4

* [dart] Fixes bug with multi-instance event channel support.
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/example/app/ios/Runner/Messages.g.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import Foundation
final class PigeonError: Error {
let code: String
let message: String?
let details: Any?
let details: Sendable?

init(code: String, message: String?, details: Any?) {
init(code: String, message: String?, details: Sendable?) {
self.code = code
self.message = message
self.details = details
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/generator_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'ast.dart';
/// The current version of pigeon.
///
/// This must match the version in pubspec.yaml.
const String pigeonVersion = '22.7.4';
const String pigeonVersion = '23.0.0';

/// Read all the content from [stdin] to a String.
String readStdin() {
Expand Down
5 changes: 3 additions & 2 deletions packages/pigeon/lib/swift_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2463,10 +2463,11 @@ private func nilOrValue<T>(_ value: Any?) -> T? {
() {
indent.writeln('let code: String');
indent.writeln('let message: String?');
indent.writeln('let details: Any?');
indent.writeln('let details: Sendable?');
indent.newln();
indent.writeScoped(
'init(code: String, message: String?, details: Any?) {', '}', () {
'init(code: String, message: String?, details: Sendable?) {', '}',
() {
indent.writeln('self.code = code');
indent.writeln('self.message = message');
indent.writeln('self.details = details');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Foundation
final class PigeonError: Error {
let code: String
let message: String?
let details: Any?
let details: Sendable?

init(code: String, message: String?, details: Any?) {
init(code: String, message: String?, details: Sendable?) {
self.code = code
self.message = message
self.details = details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Foundation
final class EventChannelTestsError: Error {
let code: String
let message: String?
let details: Any?
let details: Sendable?

init(code: String, message: String?, details: Any?) {
init(code: String, message: String?, details: Sendable?) {
self.code = code
self.message = message
self.details = details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Foundation
final class ProxyApiTestsError: Error {
let code: String
let message: String?
let details: Any?
let details: Sendable?

init(code: String, message: String?, details: Any?) {
init(code: String, message: String?, details: Sendable?) {
self.code = code
self.message = message
self.details = details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Foundation
final class PigeonError: Error {
let code: String
let message: String?
let details: Any?
let details: Sendable?

init(code: String, message: String?, details: Any?) {
init(code: String, message: String?, details: Sendable?) {
self.code = code
self.message = message
self.details = details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Foundation
final class EventChannelTestsError: Error {
let code: String
let message: String?
let details: Any?
let details: Sendable?

init(code: String, message: String?, details: Any?) {
init(code: String, message: String?, details: Sendable?) {
self.code = code
self.message = message
self.details = details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import Foundation
final class ProxyApiTestsError: Error {
let code: String
let message: String?
let details: Any?
let details: Sendable?

init(code: String, message: String?, details: Any?) {
init(code: String, message: String?, details: Sendable?) {
self.code = code
self.message = message
self.details = details
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pigeon
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
version: 22.7.4 # This must match the version in lib/generator_tools.dart
version: 23.0.0 # This must match the version in lib/generator_tools.dart

environment:
sdk: ^3.4.0
Expand Down
21 changes: 21 additions & 0 deletions packages/pigeon/test/swift_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,27 @@ void main() {
expect(code, contains('var aFloat64List: FlutterStandardTypedData? = nil'));
});

test('gen pigeon error type', () {
final Root root = Root(apis: <Api>[], classes: <Class>[], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
const SwiftOptions swiftOptions = SwiftOptions();
const SwiftGenerator generator = SwiftGenerator();

generator.generate(
swiftOptions,
root,
sink,
dartPackageName: DEFAULT_PACKAGE_NAME,
);
final String code = sink.toString();
expect(code, contains('class PigeonError: Error'));
expect(code, contains('let code: String'));
expect(code, contains('let message: String?'));
expect(code, contains('let details: Sendable?'));
expect(code,
contains('init(code: String, message: String?, details: Sendable?)'));
});

test('gen one flutter api', () {
final Root root = Root(apis: <Api>[
AstFlutterApi(name: 'Api', methods: <Method>[
Expand Down