-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Use case
When -enable-upcoming-feature ExistentialAny is set to Other Swift Flags, it results in a build error.
This feature is said to default to true in Swift 7, and 'any' needs to be appended to Existential Type.
Since the code generated by the current pigeon does not append 'any' to the Existential Type, I would like it to be modified to include this.
In issue( #147283 ), I provided sample code and a feature request that also covers ExistentialAny.
However, this issue will focus specifically on addressing errors related to ExistentialAny.
By generating code from the following code using pigeon and simply adding -enable-upcoming-feature ExistentialAny to Other Swift Flags, you can see a build error.
import 'package:pigeon/pigeon.dart';
@ConfigurePigeon(
PigeonOptions(
dartOut: 'lib/generated/sample.g.dart',
dartOptions: DartOptions(),
swiftOut: 'ios/Runner/generated/Sample.g.swift',
swiftOptions: SwiftOptions(),
),
)
@HostApi()
abstract class SampleApi {
@async
Sample fetchSampleAsync(SampleParameter parameter);
Sample fetchSampleSync(SampleParameter parameter);
@async
Object? objectSampleAsync(Object? parameter);
Object? objectSampleSync(Object? parameter);
}
@FlutterApi()
abstract class CallFromNative {
Sample fetchSample(SampleParameter parameter);
Object? objectSample(Object? parameter);
}
class Sample {
Sample({
required this.text,
required this.id,
});
final String text;
final int id;
}
class SampleParameter {
SampleParameter({
required this.text,
required this.id,
});
final String text;
final int id;
}I will provide a link to a sample repository to easily confirm the build error.
https://github.com/yuukiw00w/ExistentialAnySampleForFlutter
Proposal
Please add 'any' to the Existential Type as in the following Pull Request.
https://github.com/yuukiw00w/ExistentialAnySampleForFlutter/pull/1/files
From what I've confirmed, 'any' needs to be added to 'Error' (in completion handler), to the 'api' in the 'setUp' function and FlutterBinaryMessenger.