Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[operators][2/2]feat: Add Assignment operation expr with xor assignemnt #342

Merged
merged 9 commits into from
Sep 28, 2020

Conversation

summer-ji-eng
Copy link
Contributor

Enables ^= operator and add unit test.

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 24, 2020
@summer-ji-eng summer-ji-eng changed the title [javanaut][operationExpr][1/2]feat: Add Assignment operation expr with xor assignemnt [javanaut][operationExpr][2/2]feat: Add Assignment operation expr with xor assignemnt Sep 24, 2020
Copy link
Contributor

@miraleung miraleung left a comment

Choose a reason for hiding this comment

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

LGTM with nits addressed.

// LHS is non-floating-point numeric types, RHS should be non-float-point numeric types or
// their boxed types.
if (TypeNode.isNumericType(variableType)
&& !TypeNode.isBoxedType(variableType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider checking up-front and returning false first if:

  • One of variableType or valueType is not a numeric type.
  • valueType is boxed or is a floating-point type.
  • valueType is a floating-point type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could do like

    private boolean isValidXorAssignmentType(TypeNode variableType, TypeNode valueType) {

      // LHS is boolean or its boxed type, RHS should be boolean or its boxed type.
      if (variableType.equals(TypeNode.BOOLEAN)) {
        return valueType.equals(variableType);
      }
      // LHS is integer boxed type, RHS should be non-floating-point numeric types or their boxed
      // types.
      if (variableType.equals(TypeNode.INT)) {
        return TypeNode.isNumericType(valueType) && !TypeNode.isFloatingPointType(valueType);
      }

      if (!TypeNode.isNumericType(variableType) || !TypeNode.isNumericType(valueType)) {
        return false;
      }
      if (TypeNode.isFloatingPointType(variableType) || TypeNode.isFloatingPointType(valueType)) {
        return false;
      }
      if (TypeNode.isBoxedType(variableType)) {
        return false;
      }
      return true;
    }

But I don't see the point of checking up-front. Could you explain more the benefit to do so?

Copy link
Contributor

Choose a reason for hiding this comment

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

When rearranged this way, we can now simplify it as follows:

return TypeNode.isNumericType(variableType) && TypeNode.isNumericType(valueType)
    && !TypeNode.isFloatingPointType(variableType) && !TypeNode.isFloatingPointType(valueType)
    && !TypeNode.isBoxedType(variableType);

The original benefit was to make the true-checks easier to read, but this rearrangement works too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, LMK what you think on new version.

@summer-ji-eng summer-ji-eng merged commit 118defc into master Sep 28, 2020
@summer-ji-eng summer-ji-eng deleted the xor_operator branch September 28, 2020 05:08
@summer-ji-eng summer-ji-eng changed the title [javanaut][operationExpr][2/2]feat: Add Assignment operation expr with xor assignemnt [operatirs][2/2]feat: Add Assignment operation expr with xor assignemnt Feb 26, 2021
@summer-ji-eng summer-ji-eng changed the title [operatirs][2/2]feat: Add Assignment operation expr with xor assignemnt [operators][2/2]feat: Add Assignment operation expr with xor assignemnt Feb 26, 2021
suztomo pushed a commit that referenced this pull request Dec 16, 2022
…342)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.protobuf:protobuf-bom](https://developers.google.com/protocol-buffers/) ([source](https://togithub.com/protocolbuffers/protobuf)) | `3.19.4` -> `3.20.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.protobuf:protobuf-bom/3.20.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.protobuf:protobuf-bom/3.20.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.protobuf:protobuf-bom/3.20.0/compatibility-slim/3.19.4)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.protobuf:protobuf-bom/3.20.0/confidence-slim/3.19.4)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>protocolbuffers/protobuf</summary>

### [`v3.20.0`](https://togithub.com/protocolbuffers/protobuf/releases/v3.20.0)

[Compare Source](https://togithub.com/protocolbuffers/protobuf/compare/v3.19.4...v3.20.0)

2022-03-25 version 3.20.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

### C++

-   Add option to use external GTest in CMake ([#&#8203;8736](https://togithub.com/protocolbuffers/protobuf/issues/8736))
-   cmake: Set correct sonames for libprotobuf-lite.so and libprotoc.so ([#&#8203;8635](https://togithub.com/protocolbuffers/protobuf/issues/8635)) ([#&#8203;9529](https://togithub.com/protocolbuffers/protobuf/issues/9529))

### Java

-   Revert "Standardize on Array copyOf" ([#&#8203;9400](https://togithub.com/protocolbuffers/protobuf/issues/9400))
-   Resolve more java field accessor name conflicts ([#&#8203;8198](https://togithub.com/protocolbuffers/protobuf/issues/8198))

### Python

-   Pin multibuild scripts to get manylinux1 wheels back ([#&#8203;9216](https://togithub.com/protocolbuffers/protobuf/issues/9216))
-   Dropped support for Python < 3.7 ([#&#8203;9480](https://togithub.com/protocolbuffers/protobuf/issues/9480))

### PHP

-   fix: \[PHP] add missing reserved classnames ([#&#8203;9458](https://togithub.com/protocolbuffers/protobuf/issues/9458))

### Ruby

-   Dropped Ruby 2.3 and 2.4 support for CI and releases. ([#&#8203;9311](https://togithub.com/protocolbuffers/protobuf/issues/9311))
-   \[Ruby] Message.decode/encode: Add max_recursion_depth option ([#&#8203;9218](https://togithub.com/protocolbuffers/protobuf/issues/9218))
-   Ruby: rename max_recursion_depth to recursion_limit ([#&#8203;9486](https://togithub.com/protocolbuffers/protobuf/issues/9486))
-   Fix conversion of singleton classes in Ruby ([#&#8203;9342](https://togithub.com/protocolbuffers/protobuf/issues/9342))
-   Suppress warning for intentional circular require ([#&#8203;9556](https://togithub.com/protocolbuffers/protobuf/issues/9556))
-   \[Ruby] allow encode json options to be an object that responds to to_hash ([#&#8203;9513](https://togithub.com/protocolbuffers/protobuf/issues/9513))

### Other

-   \[C#] Fix trim warnings ([#&#8203;9182](https://togithub.com/protocolbuffers/protobuf/issues/9182))
-   Add protoc-gen-go-svc to options.md ([#&#8203;9280](https://togithub.com/protocolbuffers/protobuf/issues/9280))
-   Fixes NullReferenceException when accessing FieldDescriptor.IsPacked ([#&#8203;9430](https://togithub.com/protocolbuffers/protobuf/issues/9430))
-   Add ToProto() method to all C# descriptor classes ([#&#8203;9426](https://togithub.com/protocolbuffers/protobuf/issues/9426))
-   Add cmake option `protobuf_INSTALL` to not install files ([#&#8203;7123](https://togithub.com/protocolbuffers/protobuf/issues/7123))
-   \[CMake] Allow custom plugin options e.g. to generate mocks ([#&#8203;9105](https://togithub.com/protocolbuffers/protobuf/issues/9105))
-   Add an option to preserve proto names in JsonFormatter ([#&#8203;6307](https://togithub.com/protocolbuffers/protobuf/issues/6307))
-   Add test scope to kotlin-test for protobuf-kotlin-lite ([#&#8203;9518](https://togithub.com/protocolbuffers/protobuf/issues/9518))
-   Add prefix_to_proto_package_mappings_path ObjC option. ([#&#8203;9498](https://togithub.com/protocolbuffers/protobuf/issues/9498))
-   \[ObjC] Rename `proto_package_to_prefix_mappings_path` to `package_to_prefix_mappings_path`. ([#&#8203;9552](https://togithub.com/protocolbuffers/protobuf/issues/9552))
-   cmake: Use linker version scripts ([#&#8203;9545](https://togithub.com/protocolbuffers/protobuf/issues/9545))
-   Add a generation option to control use of forward declarations in headers. ([#&#8203;9568](https://togithub.com/protocolbuffers/protobuf/issues/9568))
-   \[C#] fix parse failure for extensions with large field numbers ([#&#8203;9591](https://togithub.com/protocolbuffers/protobuf/issues/9591))

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-common-protos).
suztomo pushed a commit that referenced this pull request Dec 16, 2022
🤖 I have created a release *beep* *boop*
---


### [2.8.1](googleapis/java-common-protos@v2.8.0...v2.8.1) (2022-04-07)


### Dependencies

* update dependency com.google.protobuf:protobuf-bom to v3.20.0 ([#342](googleapis/java-common-protos#342)) ([c7e05b8](googleapis/java-common-protos@c7e05b8))
* update dependency com.google.protobuf:protobuf-java to v3.20.0 ([#343](googleapis/java-common-protos#343)) ([24bdd0a](googleapis/java-common-protos@24bdd0a))
* update dependency io.grpc:grpc-bom to v1.45.1 ([#339](googleapis/java-common-protos#339)) ([72e5c1c](googleapis/java-common-protos@72e5c1c))
* update dependency io.grpc:grpc-protobuf to v1.45.1 ([#340](googleapis/java-common-protos#340)) ([f1be92c](googleapis/java-common-protos@f1be92c))
* update dependency io.grpc:grpc-stub to v1.45.1 ([#341](googleapis/java-common-protos#341)) ([6a893e3](googleapis/java-common-protos@6a893e3))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
suztomo pushed a commit that referenced this pull request Dec 16, 2022
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 444328399

Source-Link: googleapis/googleapis@c7ca416

Source-Link: https://github.com/googleapis/googleapis-gen/commit/d61705453a62b3ecda78aa30c192840ebc5a8a90
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDYxNzA1NDUzYTYyYjNlY2RhNzhhYTMwYzE5Mjg0MGViYzVhOGE5MCJ9
suztomo pushed a commit that referenced this pull request Mar 21, 2023
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-core](https://togithub.com/googleapis/java-core) | `1.94.7` -> `1.94.8` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/1.94.8/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/1.94.8/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/1.94.8/compatibility-slim/1.94.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core/1.94.8/confidence-slim/1.94.7)](https://docs.renovatebot.com/merge-confidence/) |
| [com.google.cloud:google-cloud-core-bom](https://togithub.com/googleapis/java-core) | `1.94.7` -> `1.94.8` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core-bom/1.94.8/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core-bom/1.94.8/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core-bom/1.94.8/compatibility-slim/1.94.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-core-bom/1.94.8/confidence-slim/1.94.7)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-core</summary>

### [`v1.94.8`](https://togithub.com/googleapis/java-core/blob/master/CHANGELOG.md#&#8203;1948-httpswwwgithubcomgoogleapisjava-corecomparev1947v1948-2021-04-23)

[Compare Source](https://togithub.com/googleapis/java-core/compare/v1.94.7...v1.94.8)

</details>

---

### Configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-shared-dependencies).
suztomo pushed a commit that referenced this pull request Mar 21, 2023
🤖 I have created a release \*beep\* \*boop\*
---
## [0.22.0](https://www.github.com/googleapis/java-shared-dependencies/compare/0.21.1...v0.22.0) (2021-04-23)


### Features

* promote to 1.0.0 ([#341](https://www.github.com/googleapis/java-shared-dependencies/issues/341)) ([1b9cc50](https://www.github.com/googleapis/java-shared-dependencies/commit/1b9cc507e68fe98aba04160d56bb35fd2d345be6))


### Dependencies

* update dependency com.google.api:api-common to v1.10.3 ([#340](https://www.github.com/googleapis/java-shared-dependencies/issues/340)) ([ca5f5da](https://www.github.com/googleapis/java-shared-dependencies/commit/ca5f5da70e12fe5b520633218a46c12d5db7469e))
* update dependency com.google.auth:google-auth-library-bom to v0.25.4 ([#334](https://www.github.com/googleapis/java-shared-dependencies/issues/334)) ([54e0f63](https://www.github.com/googleapis/java-shared-dependencies/commit/54e0f6388880b27d3ae9b36bf43863618842965d))
* update dependency com.google.auth:google-auth-library-bom to v0.25.5 ([#338](https://www.github.com/googleapis/java-shared-dependencies/issues/338)) ([100348f](https://www.github.com/googleapis/java-shared-dependencies/commit/100348f0cf288115b91d4e85bfc64e4db29d112c))
* update dependency org.threeten:threetenbp to v1.5.1 ([#335](https://www.github.com/googleapis/java-shared-dependencies/issues/335)) ([16a87e3](https://www.github.com/googleapis/java-shared-dependencies/commit/16a87e308d1d108464e6a0a260416cc996ff9293))
* update google.core.version to v1.94.8 ([#342](https://www.github.com/googleapis/java-shared-dependencies/issues/342)) ([a3c132e](https://www.github.com/googleapis/java-shared-dependencies/commit/a3c132e3a39c93e56072da2ed8a8cfdebdf8eb21))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
suztomo pushed a commit that referenced this pull request Mar 21, 2023
🤖 I have created a release \*beep\* \*boop\* 
---
### [1.94.2](https://www.github.com/googleapis/java-core/compare/v1.94.1...v1.94.2) (2021-03-01)


### Bug Fixes

* fix gcloud SDK detection on Windows ([#384](https://www.github.com/googleapis/java-core/issues/384)) ([2d8612a](https://www.github.com/googleapis/java-core/commit/2d8612ad710352a6eb9a8a87b63af3fcffbc4041)), closes [#383](https://www.github.com/googleapis/java-core/issues/383)


### Dependencies

* switch from Jackson to GSON ([#368](https://www.github.com/googleapis/java-core/issues/368)) ([924b330](https://www.github.com/googleapis/java-core/commit/924b3309426047d60b0205e0c85a04e475a35bfb))
* update dependency com.google.api-client:google-api-client-bom to v1.31.2 ([#359](https://www.github.com/googleapis/java-core/issues/359)) ([78905ad](https://www.github.com/googleapis/java-core/commit/78905adb2563979f6a688fba95d4cecb3ca92ef5))
* update dependency com.google.api:gax-bom to v1.62.0 ([c05acac](https://www.github.com/googleapis/java-core/commit/c05acac425a9533ece7ff4b67f31f36f7ed1b98d))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.1.0 ([#387](https://www.github.com/googleapis/java-core/issues/387)) ([1496ead](https://www.github.com/googleapis/java-core/commit/1496eada07c3deaa888397e6e1cd779860569a84))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.10 ([#392](https://www.github.com/googleapis/java-core/issues/392)) ([948c4d3](https://www.github.com/googleapis/java-core/commit/948c4d3a89b528f3875d47b311f24b6c0badf430))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.5 ([#345](https://www.github.com/googleapis/java-core/issues/345)) ([5bb49ed](https://www.github.com/googleapis/java-core/commit/5bb49ed8ccf317ff21d8bd0fa055410c42487e2d))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.7 ([#357](https://www.github.com/googleapis/java-core/issues/357)) ([a740db4](https://www.github.com/googleapis/java-core/commit/a740db443652890d5060e21cf4721282f76715bd))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.0.9 ([#372](https://www.github.com/googleapis/java-core/issues/372)) ([8f663c3](https://www.github.com/googleapis/java-core/commit/8f663c3581dd429770d4d6fc6de8b79d2e862fca))
* update dependency com.google.auth:google-auth-library-bom to v0.22.2 ([#343](https://www.github.com/googleapis/java-core/issues/343)) ([322bddf](https://www.github.com/googleapis/java-core/commit/322bddfa19acffe0e6bf851a50b6c4149c3b4dbb))
* update dependency com.google.auth:google-auth-library-bom to v0.23.0 ([#364](https://www.github.com/googleapis/java-core/issues/364)) ([d68e337](https://www.github.com/googleapis/java-core/commit/d68e337727c8d2ebba34450184b9e59d3fd82b4e))
* update dependency com.google.auth:google-auth-library-bom to v0.24.0 ([#382](https://www.github.com/googleapis/java-core/issues/382)) ([42f05b8](https://www.github.com/googleapis/java-core/commit/42f05b83757e2d6ba473f30fd376add8c893d760))
* update dependency com.google.errorprone:error_prone_annotations to v2.5.1 ([#354](https://www.github.com/googleapis/java-core/issues/354)) ([40b33ce](https://www.github.com/googleapis/java-core/commit/40b33ce6a63353da7da15d7f85d62c98b1bed84c))
* update dependency com.google.guava:guava-bom to v30.1-android ([#348](https://www.github.com/googleapis/java-core/issues/348)) ([8101e23](https://www.github.com/googleapis/java-core/commit/8101e23e6fc993a051f87ac98ce589d110768dab))
* update dependency com.google.http-client:google-http-client-bom to v1.38.1 ([#358](https://www.github.com/googleapis/java-core/issues/358)) ([5714e81](https://www.github.com/googleapis/java-core/commit/5714e810872287d6645e428b8036211d072c5de7))
* update dependency com.google.http-client:google-http-client-bom to v1.39.0 ([c05acac](https://www.github.com/googleapis/java-core/commit/c05acac425a9533ece7ff4b67f31f36f7ed1b98d))
* update dependency com.google.protobuf:protobuf-bom to v3.15.0 ([#378](https://www.github.com/googleapis/java-core/issues/378)) ([9b7c9c8](https://www.github.com/googleapis/java-core/commit/9b7c9c8f243b9a827ff2b130cc936379831b22e2))
* update dependency com.google.protobuf:protobuf-bom to v3.15.1 ([#381](https://www.github.com/googleapis/java-core/issues/381)) ([ed5a302](https://www.github.com/googleapis/java-core/commit/ed5a302258980e558ae0f434ba77c22f450c9479))
* update dependency com.google.protobuf:protobuf-bom to v3.15.2 ([#385](https://www.github.com/googleapis/java-core/issues/385)) ([d01c65a](https://www.github.com/googleapis/java-core/commit/d01c65a5cbeea36eb75c2fde60fa2c6b8a0d05f6))
* update dependency com.google.protobuf:protobuf-bom to v3.15.3 ([#391](https://www.github.com/googleapis/java-core/issues/391)) ([9b4ccb7](https://www.github.com/googleapis/java-core/commit/9b4ccb7b8e8feabaf4e1add2f577653c7e006b77))
* update dependency io.grpc:grpc-bom to v1.34.1 ([#342](https://www.github.com/googleapis/java-core/issues/342)) ([60d361e](https://www.github.com/googleapis/java-core/commit/60d361e542bb9a22dd573b7a25f31a674b022ee3))
* update dependency opencensus to v0.28.0 ([c05acac](https://www.github.com/googleapis/java-core/commit/c05acac425a9533ece7ff4b67f31f36f7ed1b98d))
* update io.grpc:grpc-bom to v1.36.0 ([#389](https://www.github.com/googleapis/java-core/issues/389)) ([c05acac](https://www.github.com/googleapis/java-core/commit/c05acac425a9533ece7ff4b67f31f36f7ed1b98d))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants