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

Disable unboxing and generic conversions to/from ref-like types #22357

Merged
merged 4 commits into from
Oct 3, 2017

Conversation

agocke
Copy link
Member

@agocke agocke commented Sep 26, 2017

There is no conversion between ref like types and either object or generic parameters (even if constrained to struct) in either direction. This change enforces that rule and adds tests around pattern matching, which exercises this rule.

@agocke agocke requested review from gafter and VSadov September 26, 2017 22:22
@agocke agocke requested review from OmarTawfik and a team September 26, 2017 22:22
@agocke agocke changed the title Disable unboxing and generic conversions to ref-like types Disable unboxing and generic conversions to/from ref-like types Sep 26, 2017
@agocke agocke requested a review from jcouv September 27, 2017 20:00
@agocke
Copy link
Member Author

agocke commented Sep 28, 2017

cc @jcouv for ask mode approval

{
switch (s)
{
case Span<object> span:
Copy link
Member

Choose a reason for hiding this comment

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

What about an identity case? Dont see that tested in this PR but seems like it would be valid

Copy link
Member Author

Choose a reason for hiding this comment

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

It should be valid and I'll add a test for it.

@agocke agocke force-pushed the ref-readonly-tests branch from 2964476 to 352e3c2 Compare October 2, 2017 23:46
@agocke agocke merged commit c83671f into dotnet:master Oct 3, 2017
@agocke agocke deleted the ref-readonly-tests branch October 3, 2017 19:14
@agocke
Copy link
Member Author

agocke commented Oct 3, 2017

@jaredpar I presumed that your approval was both ask mode and PR approval. Was that correct?

@jaredpar
Copy link
Member

jaredpar commented Oct 3, 2017

Correct

333fred added a commit to 333fred/roslyn that referenced this pull request Oct 5, 2017
* dotnet/master: (33 commits)
  Test dumper change to include Isimplicit/Language and some formatting change  (dotnet#22309)
  Add regression tests for fixed local function crashes (dotnet#22470)
  Use error=true in Obsolete attribute on IsByRefLikeAttribute for ref struct (dotnet#22492)
  Add tests with ref readonly and ref assemblies (dotnet#22419)
  Add test for sequence point issue with local function and conditional (dotnet#22499)
  Keep ProjectState._documentStates sorted rather than resorting the IDs
  Throttle NFW watson. (dotnet#22483)
  Suggest "in" for argument positions in IDE (dotnet#22480)
  Disable unboxing and generic conversions to/from ref-like types (dotnet#22357)
  Hold DocumentIds in ProjectState in ImmutableLists
  Fix bug in build-utils Ensure-SdkInPathAndData
  Add additional tests around Span escaping (dotnet#22413)
  Turn on the compiler server by default for the compiler VSIX (dotnet#22473)
  add 64bit detect code to razor remote host client (dotnet#22432)
  Fix a bug in escape analysis related to 'in' arguments (dotnet#22457)
  Ref must come before 'partial' in a 'ref partial struct' (dotnet#22403)
  Address PR feedback
  Ensure partial method implementation is completed when needed (dotnet#22414)
  Remove PROTOTYPE markers from "private protected" feature (dotnet#22407)
  added IVariableDeclarationStatement back to for loop's before condition (dotnet#22358)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants