Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

SpanOfT: Fix reference types #6954

Merged
merged 1 commit into from
Aug 29, 2016
Merged

SpanOfT: Fix reference types #6954

merged 1 commit into from
Aug 29, 2016

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Aug 29, 2016

  • Generic ArrayPinningHelper resulted into incorrect array data offset for reference types. Use non-generic one instead.
  • Add array covariance checks to guarantee type safety.

- Generic ArrayPinningHelper resulted into incorrect array data offset for reference types. Use non-generic one instead.
- Add array covariance checks to guarantee type safety.
@@ -43,6 +49,12 @@ public Span(T[] array, int start, int length)
if ((uint)start >= (uint)array.Length || (uint)length > (uint)(array.Length - start))
ThrowHelper.ThrowArgumentOutOfRangeException();

if (default(T) == null) // Arrays of valuetypes are nnever covariant
Copy link

Choose a reason for hiding this comment

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

typo nnever -> never

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in #6959. Thanks for taking a look!

jkotas added a commit to jkotas/coreclr that referenced this pull request Oct 29, 2016
- Generic ArrayPinningHelper resulted into incorrect array data offset for reference types. Use non-generic one instead.
- Add array covariance checks to guarantee type safety.
jkotas added a commit to jkotas/coreclr that referenced this pull request Oct 29, 2016
- Generic ArrayPinningHelper resulted into incorrect array data offset for reference types. Use non-generic one instead.
- Add array covariance checks to guarantee type safety.
jkotas added a commit to jkotas/coreclr that referenced this pull request Oct 29, 2016
- Generic ArrayPinningHelper resulted into incorrect array data offset for reference types. Use non-generic one instead.
- Add array covariance checks to guarantee type safety.
jkotas added a commit to jkotas/coreclr that referenced this pull request Oct 29, 2016
- Generic ArrayPinningHelper resulted into incorrect array data offset for reference types. Use non-generic one instead.
- Add array covariance checks to guarantee type safety.
jkotas added a commit to jkotas/coreclr that referenced this pull request Oct 31, 2016
- Generic ArrayPinningHelper resulted into incorrect array data offset for reference types. Use non-generic one instead.
- Add array covariance checks to guarantee type safety.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants