diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index d5f23a5a926..4d7f127cb61 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,7 +1,11 @@ +## 13.1.1 + +* [kotlin] Removes unnecessary `;`s in generated code. + ## 13.1.0 * [swift] Fixes Flutter Api void return error handling. - * This shouldn't be breaking for anyone, but if you were incorrectly getting + * This shouldn't be breaking for anyone, but if you were incorrectly getting success responses, you may now be failing (correctly). * Adds method channel name to error response when channel fails to connect. * Reduces code generation duplication. diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index f0388e78515..a8768b8ec98 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -13,7 +13,7 @@ import 'ast.dart'; /// The current version of pigeon. /// /// This must match the version in pubspec.yaml. -const String pigeonVersion = '13.1.0'; +const String pigeonVersion = '13.1.1'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/lib/kotlin_generator.dart b/packages/pigeon/lib/kotlin_generator.dart index 9e7c1327435..6956cdcbe76 100644 --- a/packages/pigeon/lib/kotlin_generator.dart +++ b/packages/pigeon/lib/kotlin_generator.dart @@ -412,17 +412,17 @@ class KotlinGenerator extends StructuredGenerator { indent.writeScoped('if (it is List<*>) {', '} ', () { indent.writeScoped('if (it.size > 1) {', '} ', () { indent.writeln( - 'callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)));'); + 'callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))'); }, addTrailingNewline: false); if (!func.returnType.isNullable && !func.returnType.isVoid) { indent.addScoped('else if (it[0] == null) {', '} ', () { indent.writeln( - 'callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", "")));'); + 'callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", "")))'); }, addTrailingNewline: false); } indent.addScoped('else {', '}', () { if (func.returnType.isVoid) { - indent.writeln('callback(Result.success(Unit));'); + indent.writeln('callback(Result.success(Unit))'); } else { const String output = 'output'; // Nullable enums require special handling. @@ -436,13 +436,13 @@ class KotlinGenerator extends StructuredGenerator { indent.writeln( 'val $output = ${_cast(root, indent, 'it[0]', type: func.returnType)}'); } - indent.writeln('callback(Result.success($output));'); + indent.writeln('callback(Result.success($output))'); } }); }, addTrailingNewline: false); indent.addScoped('else {', '} ', () { indent.writeln( - 'callback(Result.failure(createConnectionError(channelName)));'); + 'callback(Result.failure(createConnectionError(channelName)))'); }); }); }); diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index 6a88b0a0c71..74fb6589fe9 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -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%3Apigeon -version: 13.1.0 # This must match the version in lib/generator_tools.dart +version: 13.1.1 # This must match the version in lib/generator_tools.dart environment: sdk: ">=2.19.0 <4.0.0" diff --git a/packages/pigeon/test/kotlin_generator_test.dart b/packages/pigeon/test/kotlin_generator_test.dart index 19527e8f2a6..9f2fb321816 100644 --- a/packages/pigeon/test/kotlin_generator_test.dart +++ b/packages/pigeon/test/kotlin_generator_test.dart @@ -518,6 +518,8 @@ void main() { final String code = sink.toString(); expect(code, contains('callback: (Result) -> Unit')); expect(code, contains('callback(Result.success(Unit))')); + // Lines should not end in semicolons. + expect(code, isNot(contains(RegExp(r';\n')))); }); test('gen host void argument api', () { @@ -1584,6 +1586,6 @@ void main() { expect( code, contains( - 'callback(Result.failure(createConnectionError(channelName)));')); + 'callback(Result.failure(createConnectionError(channelName)))')); }); }