Skip to content

[pigeon]enable treat warning as errors for swift code in unit test - #3889

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
hellohuanlin:pigeon_unit_test_treat_warning_as_errors
May 3, 2023
Merged

auto-submit[bot] merged 1 commit into
flutter:mainfrom
hellohuanlin:pigeon_unit_test_treat_warning_as_errors

Conversation

@hellohuanlin

@hellohuanlin hellohuanlin commented May 2, 2023 •

Copy link
Copy Markdown
Contributor

This will make it easier to spot issues where we accidentally create an "implicit optional". For more details about why implicit optional is bad, see #3658

For example, the following warning was ignored previously:

Screenshot 2023-04-06 at 4 15 07 PM

List which issues are fixed by this PR. You must list at least one issue.

Mentioned in PR: #3658 (comment)

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@hellohuanlin
hellohuanlin marked this pull request as ready for review May 2, 2023 21:29
@hellohuanlin
hellohuanlin requested a review from tarrinneal as a code owner May 2, 2023 21:29
@tarrinneal

Copy link
Copy Markdown
Contributor

Does this apply to ci? I would expect this to fail without any code changes.

@hellohuanlin

hellohuanlin commented May 2, 2023 •

Copy link
Copy Markdown
Contributor Author

Does this apply to ci?

Not sure how CI runs our test. If it runs from Xcode (CMD+U), it should apply (@stuartmorgan probably knows?)

I would expect this to fail without any code changes.

I fixed the warnings in the previous PR.

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

Not sure how CI runs our test.

https://github.com/flutter/packages/blob/main/packages/pigeon/tool/shared/test_suites.dart#L323-L327

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. I turned on warnings-as-errors for the generated code built by the tests, but apparently forgot to do the test code itself.

@hellohuanlin hellohuanlin added the autosubmit Merge PR when tree becomes green via auto submit App label May 2, 2023
@auto-submit
auto-submit Bot merged commit 4b80d4f into flutter:main May 3, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 3, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 3, 2023
auto-submit Bot pushed a commit to flutter/flutter that referenced this pull request May 3, 2023
flutter/packages@f163786...407b7da

2023-05-03 [email protected] Update Cirrus to Xcode 14.3 (flutter/packages#3890)
2023-05-03 [email protected] [file_selector] Deprecates `macUTIs` (flutter/packages#3888)
2023-05-03 [email protected] [pigeon]enable treat warning as errors for swift code in unit test (flutter/packages#3889)
2023-05-02 [email protected] Update xcode to 14e222b (flutter/packages#3868)
2023-05-02 [email protected] [pigeon]fix "as Any" workaround due to nested optional (flutter/packages#3658)
2023-05-02 [email protected] [webview_flutter_android] Adds support to accept third party cookies (flutter/packages#3834)
2023-05-02 [email protected] [webview_flutter_wkwebview] Fixes an exception caused by the `onUrlChange` callback returning a null url (flutter/packages#3848)
2023-05-02 [email protected] [google_maps_flutter] [Docs] Note regarding usage within a bounded & an unbound widget  (flutter/packages#3691)
2023-05-02 [email protected] [local_auth_android] Fix Android lint warnings (flutter/packages#3764)
2023-05-02 [email protected] [go_router_builder] Support go_router v7 (flutter/packages#3858)
2023-05-02 [email protected] [webview_flutter_wkwebview] Fixes internal enum type and adds unknown enum values (flutter/packages#3812)
2023-05-02 [email protected] [file_selector] Add MIME type support on macOS (flutter/packages#3862)
2023-05-02 [email protected] Roll Flutter from 828a040 to db6074a (12 revisions) (flutter/packages#3881)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
stuartmorgan-g pushed a commit that referenced this pull request May 3, 2023
auto-submit Bot pushed a commit that referenced this pull request May 3, 2023
… test" (#3898)

Reverts #3889

The tree is red on a warning in the test code, most likely new in the Xcode version that the tree was just updated to. Reverting so we can re-land this with a fix for the new warning.
auto-submit Bot pushed a commit that referenced this pull request May 4, 2023
…t test (#3901)

`as [Any?]` here is actually not a "cast", but a "type annotation". An equivalent fix can be: 

```
let arg: [Any?] = [nil]
let inputEncoded = binaryMessenger.codec.encode(arg)
```

Fixes
```
heterogeneous collection literal could only be inferred to '[Any?]'; add explicit type annotation if this is intentional
```

Which was introduced in #3889 and later got reverted. 

See flutter/flutter#126006 for more details about some interesting research on this warning. 

*List which issues are fixed by this PR. You must list at least one issue.*

Fixes flutter/flutter#126006

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
…lutter#3889)

This will make it easier to spot issues where we accidentally create an "implicit optional". For more details about why implicit optional is bad, see flutter#3658

For example, the following warning was ignored previously: 

![Screenshot 2023-04-06 at 4 15 07 PM](https://user-images.githubusercontent.com/41930132/235790274-776f096a-212c-445b-ae81-f748b143f982.png)

*List which issues are fixed by this PR. You must list at least one issue.*

Mentioned in PR: flutter#3658 (comment)

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
… test" (flutter#3898)

Reverts flutter#3889

The tree is red on a warning in the test code, most likely new in the Xcode version that the tree was just updated to. Reverting so we can re-land this with a fix for the new warning.
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
…t test (flutter#3901)

`as [Any?]` here is actually not a "cast", but a "type annotation". An equivalent fix can be: 

```
let arg: [Any?] = [nil]
let inputEncoded = binaryMessenger.codec.encode(arg)
```

Fixes
```
heterogeneous collection literal could only be inferred to '[Any?]'; add explicit type annotation if this is intentional
```

Which was introduced in flutter#3889 and later got reverted. 

See flutter/flutter#126006 for more details about some interesting research on this warning. 

*List which issues are fixed by this PR. You must list at least one issue.*

Fixes flutter/flutter#126006

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
@reidbaker reidbaker mentioned this pull request Aug 4, 2023
10 of 11 tasks
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…lutter#3889)

This will make it easier to spot issues where we accidentally create an "implicit optional". For more details about why implicit optional is bad, see flutter#3658

For example, the following warning was ignored previously: 

![Screenshot 2023-04-06 at 4 15 07 PM](https://user-images.githubusercontent.com/41930132/235790274-776f096a-212c-445b-ae81-f748b143f982.png)

*List which issues are fixed by this PR. You must list at least one issue.*

Mentioned in PR: flutter#3658 (comment)

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
… test" (flutter#3898)

Reverts flutter#3889

The tree is red on a warning in the test code, most likely new in the Xcode version that the tree was just updated to. Reverting so we can re-land this with a fix for the new warning.
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…t test (flutter#3901)

`as [Any?]` here is actually not a "cast", but a "type annotation". An equivalent fix can be: 

```
let arg: [Any?] = [nil]
let inputEncoded = binaryMessenger.codec.encode(arg)
```

Fixes
```
heterogeneous collection literal could only be inferred to '[Any?]'; add explicit type annotation if this is intentional
```

Which was introduced in flutter#3889 and later got reverted. 

See flutter/flutter#126006 for more details about some interesting research on this warning. 

*List which issues are fixed by this PR. You must list at least one issue.*

Fixes flutter/flutter#126006

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
…lutter#3889)

This will make it easier to spot issues where we accidentally create an "implicit optional". For more details about why implicit optional is bad, see flutter#3658

For example, the following warning was ignored previously: 

![Screenshot 2023-04-06 at 4 15 07 PM](https://user-images.githubusercontent.com/41930132/235790274-776f096a-212c-445b-ae81-f748b143f982.png)

*List which issues are fixed by this PR. You must list at least one issue.*

Mentioned in PR: flutter#3658 (comment)

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
… test" (flutter#3898)

Reverts flutter#3889

The tree is red on a warning in the test code, most likely new in the Xcode version that the tree was just updated to. Reverting so we can re-land this with a fix for the new warning.
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
…t test (flutter#3901)

`as [Any?]` here is actually not a "cast", but a "type annotation". An equivalent fix can be: 

```
let arg: [Any?] = [nil]
let inputEncoded = binaryMessenger.codec.encode(arg)
```

Fixes
```
heterogeneous collection literal could only be inferred to '[Any?]'; add explicit type annotation if this is intentional
```

Which was introduced in flutter#3889 and later got reverted. 

See flutter/flutter#126006 for more details about some interesting research on this warning. 

*List which issues are fixed by this PR. You must list at least one issue.*

Fixes flutter/flutter#126006

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: pigeon platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants