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

[corefoundation] Simplify CFRange #11931

Merged
merged 1 commit into from
Jun 15, 2021
Merged

Conversation

spouliot
Copy link
Contributor

  • Avoid chaining constructors, so one can be eliminated (if the other is not used)
  • Remove casts (int parameters does not need them for nint fields)
  • Reduce metadata (when a .ctor can be eliminated, like MySingleView)
--- a.cs	2021-06-14 20:56:22.000000000 -0400
+++ b.cs	2021-06-14 20:56:25.000000000 -0400
@@ -5068,13 +5068,8 @@

 		public CFRange(int P_0, int P_1)
 		{
-			this = new CFRange((long)P_0, (long)P_1);
-		}
-
-		public CFRange(long P_0, long P_1)
-		{
-			loc = (nint)P_0;
-			len = (nint)P_1;
+			loc = P_0;
+			len = P_1;
 		}

 		public override string ToString()

* Avoid chaining constructors, so one can be eliminated (if the other is not used)
* Remove casts (`int` parameters does not need them for `nint` fields)
* Reduce metadata (when a `.ctor` can be eliminated, like MySingleView)

```diff
--- a.cs	2021-06-14 20:56:22.000000000 -0400
+++ b.cs	2021-06-14 20:56:25.000000000 -0400
@@ -5068,13 +5068,8 @@

 		public CFRange(int P_0, int P_1)
 		{
-			this = new CFRange((long)P_0, (long)P_1);
-		}
-
-		public CFRange(long P_0, long P_1)
-		{
-			loc = (nint)P_0;
-			len = (nint)P_1;
+			loc = P_0;
+			len = P_1;
 		}

 		public override string ToString()
```
@spouliot spouliot requested a review from rolfbjarne as a code owner June 15, 2021 01:04
@spouliot spouliot added the not-notes-worthy Ignore for release notes label Jun 15, 2021
@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (no change)

GitHub pages

Results can be found in the following github pages (it might take some time to publish):

Test results

1 tests failed, 85 tests passed.

Failed tests

  • introspection/watchOS 32-bits - simulator/Debug (watchOS 5.0): Failed

Pipeline on Agent XAMBOT-1104.BigSur'
Merge 753e7d4 into 447c59d

@spouliot
Copy link
Contributor Author

introspection/watchOS 32-bits - simulator/Debug (watchOS 5.0): Failed

unrelated, known issue -> https://github.com/xamarin/maccore/issues/2454

@spouliot spouliot merged commit db8544a into xamarin:main Jun 15, 2021
@spouliot spouliot deleted the cfrange-simplify branch June 15, 2021 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-notes-worthy Ignore for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants