)]}'
{
  "commit": "e5244c88c91e03f4e311d0ddf5b21eb70f20c093",
  "tree": "e15485edd4825efbffd47ac86cac9941aa5fb03e",
  "parents": [
    "909f02415016b796e3367bbe96fe2a25b8cd18b2"
  ],
  "author": {
    "name": "Paul Berry",
    "email": "paulberry@google.com",
    "time": "Wed Jan 17 23:57:13 2024 +0000"
  },
  "committer": {
    "name": "Commit Queue",
    "email": "dart-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "time": "Wed Jan 17 23:57:13 2024 +0000"
  },
  "message": "[beta] Fix handling of extension types in relational patterns.\n\nIn https://dart-review.googlesource.com/c/sdk/+/345082, type erasure\nwas added to the handling of relational patterns, to address some co19\nfailures, e.g.:\n\n    extension type const BoolET1(bool _) {}\n    const True1 \u003d BoolET1(true);\n    String testStatement1(bool b) {\n      switch (b) {\n        case \u003d\u003d True1:\n\t  ...\n      }\n    }\n\nThis was failing because the type of `True1` (`BoolET1`) is not\nassignable to the argument type of `operator\u003d\u003d`, which is\n`Object`. (This is because extension types do not, by default, extend\n`Object`; they extend `Object?`).\n\nAdding type erasure elimited the co19 failure, but it caused other\ncode to be allowed that shouldn\u0027t be allowed, such as:\n\n    extension type const E(int representation) implements Object {}\n    class A {\n      bool operator \u003c(int other) \u003d\u003e ...;\n    }\n    const E0 \u003d E(0);\n    test(A a) {\n      if (a case \u003c E0) ...;\n    }\n\nThis shouldn\u0027t be allowed because the type expected by `A.\u003c` is `int`;\nallowing `E0` to be passed to this operator breaks extension type\nencapsulation.\n\nThe correct fix is for assignability checks for `operator\u003d\u003d` to use\n`S?` rather than `S`, where `S` is the argument type of\n`operator\u003d\u003d`. This is consistent with the patterns specification, and\nit ensures that `\u003d\u003d null` and `!\u003d null` are allowed, while continuing\nto prohibit relational patterns that break extension type\nencapsulation.\n\nFixes https://github.com/dart-lang/sdk/issues/54594.\n\nBug: https://github.com/dart-lang/sdk/issues/54594.\nChange-Id: Id1f7a52f75e91c0b3b3d535aab68d38da68d37a5\nCherry-pick: https://dart-review.googlesource.com/c/sdk/+/345860\nCherry-pick-request: https://github.com/dart-lang/sdk/issues/54612\nReviewed-on: https://dart-review.googlesource.com/c/sdk/+/345826\nReviewed-by: Chloe Stefantsova \u003ccstefantsova@google.com\u003e\nCommit-Queue: Paul Berry \u003cpaulberry@google.com\u003e\nReviewed-by: Konstantin Shcheglov \u003cscheglov@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "bef1b4b14bbfbcf475db63e44f5543e5968918c5",
      "old_mode": 33188,
      "old_path": "pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart",
      "new_id": "f1292bf3020c0b333eb2348a76365ba0d07dc481",
      "new_mode": 33188,
      "new_path": "pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart"
    },
    {
      "type": "modify",
      "old_id": "b105dbb52b2b081c418aad342630279ef230f08a",
      "old_mode": 33188,
      "old_path": "pkg/_fe_analyzer_shared/test/mini_ast.dart",
      "new_id": "253f2190cd916030a589f3bcacb4f4554b032fb7",
      "new_mode": 33188,
      "new_path": "pkg/_fe_analyzer_shared/test/mini_ast.dart"
    },
    {
      "type": "modify",
      "old_id": "812b09be9fd2afc9fc55b3fb098c25c3e0440919",
      "old_mode": 33188,
      "old_path": "pkg/_fe_analyzer_shared/test/type_inference/type_inference_test.dart",
      "new_id": "fc8775840d2943f40f0da68b3c30771db9c3b48d",
      "new_mode": 33188,
      "new_path": "pkg/_fe_analyzer_shared/test/type_inference/type_inference_test.dart"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "f1cab38a8d2ea4141522d9c4eaf42ea6b0f3d104",
      "new_mode": 33188,
      "new_path": "tests/language/extension_type/relational_pattern_error_test.dart"
    }
  ]
}
