Skip to content

Commit

Permalink
[corefoundation] Simplify CFRange (#11931)
Browse files Browse the repository at this point in the history
* 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()
```
  • Loading branch information
spouliot authored Jun 15, 2021
1 parent 7dc918c commit db8544a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CoreFoundation/CFString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public long LongLength {
}

public CFRange (int loc, int len)
: this ((long) loc, (long) len)
{
this.loc = loc;
this.len = len;
}

public CFRange (long l, long len)
Expand Down

8 comments on commit db8544a

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ [CI 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)

Packages generated

View packages

Test results

2 tests failed, 219 tests passed.

Failed tests

  • introspection/watchOS 32-bits - simulator/Debug (watchOS 5.0): Failed
  • Generator tests/NUnit: Failed (Execution failed with exit code 1)

Pipeline on Agent XAMBOT-1028.BigSur'
[corefoundation] Simplify CFRange (#11931)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

🔥 Tests failed catastrophically on VSTS: device tests tvOS 🔥

Not enough free space in the host.

Pipeline on Agent
[corefoundation] Simplify CFRange (#11931)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[corefoundation] Simplify CFRange (#11931)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[corefoundation] Simplify CFRange (#11931)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS Mac Catalina (10.15) ✅

Tests passed

All tests on macOS X Mac Catalina (10.15) passed.

Pipeline on Agent
[corefoundation] Simplify CFRange (#11931)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS Mac Mojave (10.14) ✅

Tests passed

All tests on macOS X Mac Mojave (10.14) passed.

Pipeline on Agent
[corefoundation] Simplify CFRange (#11931)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS Mac High Sierra (10.13) ✅

Tests passed

All tests on macOS X Mac High Sierra (10.13) passed.

Pipeline on Agent
[corefoundation] Simplify CFRange (#11931)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS32b). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[corefoundation] Simplify CFRange (#11931)

Please sign in to comment.