Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

cbracken
Copy link
Member

@cbracken cbracken commented Jun 9, 2019

If a LicenseType is ever left unhandled in the switch statement, we now
throw an exception. This also fixes a 'missing return statements' lint.

If a LicenseType is ever left unhandled in the switch statement, we now
throw an exception. This also fixes a 'missing return statements' lint.
@Hixie
Copy link
Contributor

Hixie commented Jun 9, 2019

this shouldn't be necessary, the linter will complain if there's ever an enum value added that isn't handled by the switch.

@cbracken
Copy link
Member Author

cbracken commented Jun 9, 2019

See the description: This is specifically to address the missing return lint. Not sure if lints are able to have awareness of other lints; if so, we can file a bug against the missing return lint.

@Hixie
Copy link
Contributor

Hixie commented Jun 10, 2019

The usual pattern we use is to assert non-null before the switch, and return null after. The assert and the return with go away with NNBD.

@cbracken
Copy link
Member Author

cbracken commented Jun 10, 2019

The usual pattern we use is to assert non-null before the switch, and return null after.

Happy to change it, though given that we don't run the license tool with asserts enabled, that seems less safe than throwing. e.g. someone edits our lints to be less strict.

The assert and the return with go away with NNBD.

I'm looking forward to this as much as anyone :)

@Hixie
Copy link
Contributor

Hixie commented Jun 10, 2019

why is it less safe?

@cbracken
Copy link
Member Author

cbracken commented Jun 10, 2019

For the reason in my comment — two options will eliminate the lint: a return or a throw. Given a choice between the two, we’d want to throw with an obvious error message for a statement that's meant to be un-hittable. This should only ever occur if the switch lint were ever removed.

@Hixie
Copy link
Contributor

Hixie commented Jun 10, 2019

If that lint were ever removed we'd have bigger problems.
I think the way to address that is to have a test that verifies the lint is still working.

@cbracken
Copy link
Member Author

sgtm - I'm happy to add something like the existing fail test both here and in the framework.

Would you prefer I change this to return null rather than throw or fine to land as-is?

@Hixie
Copy link
Contributor

Hixie commented Jun 10, 2019

Returning null would be more consistent with the rest of the codebase, but I don't feel strongly. It'll be moot soon anyway since NNBD will turn the throw or return null into dead code and we'll have to remove it.

@cbracken
Copy link
Member Author

Done.

@cbracken cbracken merged commit 10a3ab0 into flutter:master Jun 11, 2019
@cbracken cbracken deleted the missing-return branch June 11, 2019 17:49
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 11, 2019
@cbracken
Copy link
Member Author

cbracken commented Jun 11, 2019

/cc @devoncarew @pq given that it's possible to determine through static analysis that (a) the switch covers all possible enum values and (b) that every one of the values returns, should this be filed as a feature request/bug for the linter?

Opposing argument: there's no guarantee that the input is non-null when asserts are disabled. With that in mind, the lint seems correct as implemented (at least insofar as the implementation pertains to this PR)

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 11, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Jun 11, 2019
flutter/engine@4d68474...02e6a13

git log 4d68474..02e6a13 --no-merges --oneline
02e6a13 Roll src/third_party/dart 7ecd81b0b8..b37aa3b036 (4 commits) (flutter/engine#9272)
95f9b3d Fix crash on minimize with GLFW shell (flutter/engine#9278)
8d017fa Roll src/third_party/skia a716809d5ad3..df586b7d568d (17 commits) (flutter/engine#9279)
10a3ab0 Fix missing return lint (flutter/engine#9246)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
the roller if necessary.
huqiuser pushed a commit to huqiuser/engine that referenced this pull request Jun 12, 2019
A recent Dart roll improved the detection of missing return statements.
Since we enforce that all enum values must be covered in switch
statements, this isn't an issue, but we add a return to fix the lint.
jonahwilliams pushed a commit to jonahwilliams/flutter that referenced this pull request Jun 12, 2019
commit 92e52d5
Merge: 421e4e4 da6dde6
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Wed Jun 12 14:12:36 2019 -0700

    Merge branch 'master' of github.com:flutter/flutter into add_network_image_impl

commit 421e4e4
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Wed Jun 12 14:03:11 2019 -0700

    address comments

commit da6dde6
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Wed Jun 12 16:49:55 2019 -0400

    Roll engine ab5c14b..67aadb6 (2 commits) (flutter#34350)

    flutter/engine@ab5c14b...67aadb6

    git log ab5c14b..67aadb6 --no-merges --oneline
    67aadb6 Roll src/third_party/skia d62d406aa24c..81756e4cae95 (5 commits) (flutter/engine#9300)
    0a2e28d Revert tracing changes (flutter/engine#9296)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit 8163c0a
Author: Todd Volkert <tvolkert@users.noreply.github.com>
Date:   Wed Jun 12 13:47:47 2019 -0700

    Re-apply compressionState changes. (flutter#34341)

    This re-applies the changes that were made in flutter#33697 and flutter#33729,
    but which were reverted in flutter#33792 and flutter#33790, respectively due to
    the Dart SDK not having received the update within Google yet.
    The SDK has now rolled, so these changes can be re-applied.

    flutter#32374
    flutter#33791

commit 25c8400
Author: Devon Carew <devoncarew@google.com>
Date:   Wed Jun 12 13:14:20 2019 -0700

    Revert "update the Flutter.Frame event to use new engine APIs (flutter#34243)" (flutter#34352)

    This reverts commit 446179f.

commit c40d701
Author: Jenn Magder <magder@google.com>
Date:   Wed Jun 12 11:31:17 2019 -0700

    Change Xcode project developmentRegion to 'en' and plist CFBundleDevelopmentRegion to DEVELOPMENT_LANGUAGE (flutter#34293)

commit 446179f
Author: Devon Carew <devoncarew@google.com>
Date:   Wed Jun 12 11:20:10 2019 -0700

    update the Flutter.Frame event to use new engine APIs (flutter#34243)

    * update the Flutter.Frame event to use new engine APIs

    * add a test

    * update test

commit 22ca3f9
Author: Zachary Anderson <zanderso@users.noreply.github.com>
Date:   Wed Jun 12 11:18:53 2019 -0700

    [flutter_tool] Don't truncate verbose logs from _flutter.listViews (flutter#34255)

commit 75b5cec
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Wed Jun 12 14:03:56 2019 -0400

    ab5c14b Set Dart version to git hash 3166bbf24b0c929eef33fd5d0f69e0f36a9009f3 (Dart 2.3.3-dev) (flutter/engine#9292) (flutter#34336)

    flutter/engine@d3c213e...ab5c14b

    git log d3c213e..ab5c14b --no-merges --oneline
    ab5c14b Set Dart version to git hash 3166bbf24b0c929eef33fd5d0f69e0f36a9009f3 (Dart 2.3.3-dev) (flutter/engine#9292)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit fb2f18e
Author: Todd Volkert <tvolkert@users.noreply.github.com>
Date:   Wed Jun 12 10:22:50 2019 -0700

    Prepare for Uint8List SDK breaking changes (flutter#34295)

    dart-lang/sdk#36900

commit bdd0724
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Wed Jun 12 13:03:55 2019 -0400

    Roll engine b14d971..d3c213e (3 commits) (flutter#34331)

    flutter/engine@b14d971...d3c213e

    git log b14d971..d3c213e --no-merges --oneline
    d3c213e Roll src/third_party/skia 698fa78b3cae..d62d406aa24c (1 commits) (flutter/engine#9295)
    4d7afb9 Roll src/third_party/skia ed7966f179c6..698fa78b3cae (1 commits) (flutter/engine#9294)
    05e1b6e Roll src/third_party/skia d82ca0bf2c99..ed7966f179c6 (2 commits) (flutter/engine#9293)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit fa174a1
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Wed Jun 12 00:45:55 2019 -0400

    Roll engine 4fc95eb..b14d971 (4 commits) (flutter#34310)

    flutter/engine@4fc95eb...b14d971

    git log 4fc95eb..b14d971 --no-merges --oneline
    b14d971 Roll src/third_party/skia f39124b0764d..d82ca0bf2c99 (3 commits) (flutter/engine#9291)
    87c26ae Refactor Delayed Tasks to their own file (flutter/engine#9290)
    9baf589 [iOS] [a11y] Don&flutter#39;t allow scroll views to grab a11y focus (flutter/engine#9282)
    f80ac5f [fuchsia] Fix alignment of Fuchsia/non-Fuchsia tracing (flutter/engine#9289)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit 70840d4
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Tue Jun 11 23:41:58 2019 -0400

    4fc95eb Fixed memory leaks within FlutterFragment and FlutterView (flutter#34268, flutter#34269, flutter#34270). (flutter/engine#9288) (flutter#34305)

commit d6425a2
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Tue Jun 11 21:54:55 2019 -0400

    Roll engine 2d2cfc0..de350c4 (2 commits) (flutter#34302)

    flutter/engine@2d2cfc0...de350c4

    git log 2d2cfc0..de350c4 --no-merges --oneline
    de350c4 Report timings faster (100ms) in profile/debug (flutter/engine#9287)
    6dc4d6c Add refresh callback to GLFW shell (flutter/engine#9280)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit 9a46b3e
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Tue Jun 11 20:17:55 2019 -0400

    Roll engine 02e6a13..2d2cfc0 (3 commits) (flutter#34292)

    flutter/engine@02e6a13...2d2cfc0

    git log 02e6a13..2d2cfc0 --no-merges --oneline
    2d2cfc0 Expose a hasRenderedFirstFrame() method in FlutterView (flutter#34275). (flutter/engine#9285)
    8040117 Fix TextInputPlugin NPE caused by PlatformViewsController ref in new embedding (flutter#34283). (flutter/engine#9283)
    c7b25f1 Roll src/third_party/skia df586b7d568d..f39124b0764d (11 commits) (flutter/engine#9284)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit 21a5326
Author: Emmanuel Garcia <egarciad@google.com>
Date:   Tue Jun 11 16:24:03 2019 -0700

    Split gradle_plugin_test.dart (flutter#34282)

    Fixes timeout when running gradle_plugin_test

commit 8247963
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Tue Jun 11 18:30:55 2019 -0400

    Roll engine 4d68474..02e6a13 (4 commits) (flutter#34281)

    flutter/engine@4d68474...02e6a13

    git log 4d68474..02e6a13 --no-merges --oneline
    02e6a13 Roll src/third_party/dart 7ecd81b0b8..b37aa3b036 (4 commits) (flutter/engine#9272)
    95f9b3d Fix crash on minimize with GLFW shell (flutter/engine#9278)
    8d017fa Roll src/third_party/skia a716809d5ad3..df586b7d568d (17 commits) (flutter/engine#9279)
    10a3ab0 Fix missing return lint (flutter/engine#9246)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit 9d724d4
Author: Jonah Williams <jonahwilliams@google.com>
Date:   Tue Jun 11 14:51:03 2019 -0700

    Compatibility pass on flutter/widgets tests for JavaScript compilation. (8) (flutter#33377)

commit d9c1962
Author: Emmanuel Garcia <egarciad@google.com>
Date:   Tue Jun 11 14:46:00 2019 -0700

    Instrument usage of include_flutter.groovy and xcode_backend.sh (flutter#34189)

    This is done via `flutter build bundle`.   As a consequence, this PR introduces a new way to disable analytics via the `FLUTTER_SUPPRESS_ANALYTICS` env flag.

commit 1eb8c64
Author: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
Date:   Tue Jun 11 14:14:54 2019 -0700

    Fix CupertinoTabScaffold index out of range (flutter#33624)

commit 89d887f
Author: Jason Simmons <jason-simmons@users.noreply.github.com>
Date:   Tue Jun 11 13:34:24 2019 -0700

    Strip debug symbols from ELF library snapshots (flutter#34250)

    AOT compiled code is now packaged as an ELF library for Android targets.
    By default gen_snapshot's output contains debug symbols.  The symbols could
    be stripped as a separate step, but that requires NDK tools that the user
    may not have available.

    This change passes a gen_snapshot flag that omits the symbols, and it filters
    out a warning printed when that flag is used.

commit 6d0e618
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Tue Jun 11 15:55:56 2019 -0400

    Roll engine de420a0..4d68474 (3 commits) (flutter#34258)

    flutter/engine@de420a0...4d68474

    git log de420a0..4d68474 --no-merges --oneline
    4d68474 Load AOT compiled Dart assets only from ELF libraries (flutter/engine#9260)
    3e9ffe1 Whitelist the —enable_mirrors flag to fix regression in existing embedder. (flutter/engine#9266)
    7cde42c Unbreak internal rolls (flutter/engine#9270)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit e59d9a8
Author: Ben Konyi <bkonyi@google.com>
Date:   Tue Jun 11 11:37:47 2019 -0700

    Reland "Added --dart-flags option to flutter run (flutter#33924)" (flutter#34181)

    Reland "Added --dart-flags option to flutter run (flutter#33924)"

    This reverts commit 587687e.

commit 7cc7161
Author: Jonah Williams <jonahwilliams@google.com>
Date:   Tue Jun 11 11:22:37 2019 -0700

    Compatibility pass on flutter/semantics tests for JavaScript compilation. (7) (flutter#33360)

commit 1bc8402
Author: guoskyhero <guojiex@users.noreply.github.com>
Date:   Tue Jun 11 11:15:50 2019 -0700

    Add hintStyle in SearchDelegate (flutter#30388)

    SearchDelegate hintStyle parameter

commit 336e4c4
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Tue Jun 11 14:12:56 2019 -0400

    Roll engine c9bbd0e..de420a0 (4 commits) (flutter#34247)

    flutter/engine@c9bbd0e...de420a0

    git log c9bbd0e..de420a0 --no-merges --oneline
    de420a0 Roll src/third_party/dart 97f91fecdb..7ecd81b0b8 (5 commits) (flutter/engine#9268)
    8812781 Roll src/third_party/skia bba5aa761cd5..a716809d5ad3 (1 commits) (flutter/engine#9269)
    b470913 Roll src/third_party/skia 77cb2ca3c9aa..bba5aa761cd5 (3 commits) (flutter/engine#9267)
    48ecbca Roll src/third_party/skia bb74990a11d9..77cb2ca3c9aa (1 commits) (flutter/engine#9265)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (liyuqian@google.com), and stop
    the roller if necessary.

commit 7feddfd
Author: Jonah Williams <jonahwilliams@google.com>
Date:   Tue Jun 11 10:35:10 2019 -0700

    make sure this test doesnt run for real (flutter#34199)

commit d850d69
Author: Neevash Ramdial <mail@neevash.dev>
Date:   Tue Jun 11 12:57:17 2019 -0400

    Added tool sample for PageController (flutter#34137)

    * Added tool sample for PageController

    * Fixed text directionality bug

commit 05e92c8
Author: Jonah Williams <jonahwilliams@google.com>
Date:   Tue Jun 11 09:09:13 2019 -0700

    Compatibility pass on flutter/physics tests for JavaScript compilation. (6) (flutter#33359)

commit 30fb980
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Tue Jun 11 11:41:47 2019 -0400

    c9bbd0e Roll src/third_party/dart 7f146e431e..97f91fecdb (22 commits) (flutter#34203)

commit e9ca112
Author: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
Date:   Mon Jun 10 19:17:55 2019 -0700

    update CupertinoDialogAction isDefaultAction documentation (flutter#34163)

commit fcaf96d
Author: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Date:   Mon Jun 10 21:35:55 2019 -0400

    Roll engine f3ab2e4..4c0daac (2 commits) (flutter#34197)

    flutter/engine@f3ab2e4...4c0daac

    git log f3ab2e4..4c0daac --no-merges --oneline
    4c0daac Roll src/third_party/skia cb1adb40d0f3..bb74990a11d9 (3 commits) (flutter/engine#9261)
    2d0103a Removed VIRTUAL_KEYBOARD check in TextInputPlugin because it&flutter#39;s blocking Espresso work and its purpose is unknown. (flutter/engine#9238)

    The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

    If the roll is causing failures, please contact the current sheriff (bmparr@google.com), and stop
    the roller if necessary.

commit 89b1533
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Mon Jun 10 16:49:44 2019 -0700

    skip chunk test

commit c11b61f
Merge: b182271 1b3fc53
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Mon Jun 10 16:49:34 2019 -0700

    Merge branch 'master' of github.com:flutter/flutter into add_network_image_impl

commit b182271
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Mon Jun 10 16:14:06 2019 -0700

    update to remove extra asset image indirection

commit 96d7939
Merge: 3700e32 f530b80
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Mon Jun 10 15:42:02 2019 -0700

    Merge branch 'master' of github.com:flutter/flutter into add_network_image_impl

commit 3700e32
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Sat Jun 8 13:13:32 2019 -0700

    fix foundation import

commit e31b5e4
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Sat Jun 8 13:09:19 2019 -0700

    add web and io implemenations of network and asset image
@pq
Copy link
Contributor

pq commented Jun 27, 2019

Sorry for the slow follow-up on this one. My sense is that we should be able to detect that the return is unnecessary (and actually dead code). @bwilkerson: does that seem right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants