)]}'
{
  "commit": "7411ddb2d716c31f07035ef2aa14c2478e2bb117",
  "tree": "e33985597ccdb52aa3f677b6d7ce6986e29c74c8",
  "parents": [
    "cf717accfbe12626587c2476cbdbe9ca0b01a82f"
  ],
  "author": {
    "name": "Paul Berry",
    "email": "paulberry@google.com",
    "time": "Mon Apr 28 13:25:40 2025 -0700"
  },
  "committer": {
    "name": "Commit Queue",
    "email": "dart-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "time": "Mon Apr 28 13:25:40 2025 -0700"
  },
  "message": "[analysis server] Improve dead code removal to prepare for sound-flow-analysis.\n\nThe following improvements are made to the \"remove dead code\" quick fix:\n\n- Dead code removal can now replace conditional expressions like\n  `condition ? live : dead` or `condition ? dead : live` with just the\n  live subexpression, provided that the condition appears free of side\n  effects.\n\n- Dead code removal can now replace `if` statements like `if\n  (condition) live; else dead;` or `if (condition) dead; else live;`\n  with just the live statement, provided that the condition appears\n  free of side effects.\n\n- Dead code removal can now fully remove `if` statements like `if\n  (condition) dead;`, provided that the condition appears free of side\n  effects.\n\nExtra care is taken around opening and closing braces to try to\npreserve reasonable formatting as much as possible.\n\nThese features were chosen by examining the set of new dead code\nwarnings that pop up inside google3 if the sound-flow-analysis\nlanguage feature is enabled. They are sufficient to allow 98% of those\nnew warnings to be addressed by the quick fix. This should help\ncustomers adjust their code quickly when moving to a language version\nthat enables this language feature.\n\nThe notion that a condition \"appears free of side effects\" is defined\nto include casts, non-null assertions, and getter invocations. It is\nof course possible that a getter invocation, a cast, or a non-null\nassertion could have a side effect that is important, but it would be\ndifficult to build the necessary static analysis to detect these\ncases, and in practice, they don\u0027t happen very often. Considering that\nthe \"remove dead code\" quick fix is not usable in an automated fashion\n(it must be explicitly requested by the user in their editor for each\npiece of affected dead code), I believe this is a good tradeoff.\n\nBug: https://github.com/dart-lang/sdk/issues/60438\nChange-Id: Ied43500c4b7a729bbd686708ab10e80e72f22088\nReviewed-on: https://dart-review.googlesource.com/c/sdk/+/425180\nCommit-Queue: Paul Berry \u003cpaulberry@google.com\u003e\nReviewed-by: Samuel Rawlins \u003csrawlins@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "186461775a9dd8e83c2218e1419fd1f295bd1bf9",
      "old_mode": 33188,
      "old_path": "pkg/analysis_server/lib/src/services/correction/dart/remove_dead_code.dart",
      "new_id": "5a46cd7cd60dac177b0158f4cff83a5f73316667",
      "new_mode": 33188,
      "new_path": "pkg/analysis_server/lib/src/services/correction/dart/remove_dead_code.dart"
    },
    {
      "type": "modify",
      "old_id": "773ae547d097f9af32325e6713032014f8bcc22d",
      "old_mode": 33188,
      "old_path": "pkg/analysis_server/test/src/services/correction/fix/remove_dead_code_test.dart",
      "new_id": "aa2bf7807a2a8afa8c1d045dd155cc956f54b411",
      "new_mode": 33188,
      "new_path": "pkg/analysis_server/test/src/services/correction/fix/remove_dead_code_test.dart"
    }
  ]
}
