Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

No description provided.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 20, 2025 19:53
#else
public enum BinaryOperatorSpacingOptions
#endif
internal enum BinaryOperatorSpacingOptionsInternal
Copy link
Member Author

Choose a reason for hiding this comment

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

this was causing no end of pain.

@CyrusNajmabadi CyrusNajmabadi requested review from JoeRobich and tmat June 20, 2025 20:00
}
}

public enum LabelPositionOptions
Copy link
Member Author

Choose a reason for hiding this comment

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

thse are not new apis. they just moved from the shared location her.e we don't want it in teh shared location as that adds public types to multiple assemblies, which is bad (esp. for code that then references both assemblies.

#else
public enum LabelPositionOptions
#endif
internal enum LabelPositionOptionsInternal
Copy link
Member Author

Choose a reason for hiding this comment

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

these are now internal and renamed (so no conflicts anymore). all shared code now uses the internal option.

@CyrusNajmabadi
Copy link
Member Author

@JoeRobich @tmat ptal.

where TToEnum : struct, Enum
{
// Ensure that this is only called for enums that are actually compatible with each other.
Contract.ThrowIfTrue(typeof(TFromEnum).GetEnumUnderlyingType() != typeof(int));
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this just be typeof(TFromEnum).GetEnumUnderlyingType() != typeof(TToEnum).GetEnumUnderlyingType()?

Copy link
Member Author

Choose a reason for hiding this comment

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

this has changed. i previously took a dependency on int in teh impl code. now i have a TEnumUnderlyingType that i can use instead.

And i do confirm that everything is cromulent between all 3 type parameters.

tmat
tmat previously requested changes Jun 20, 2025
Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

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

Let's move convert out of formatting options.

@CyrusNajmabadi CyrusNajmabadi requested a review from tmat June 20, 2025 20:49
@CyrusNajmabadi
Copy link
Member Author

Let's move convert out of formatting options.

This was done. PTAL @tmat

where TToEnum : struct
where TUnderlyingEnumType : struct
{
return Unsafe.As<TUnderlyingEnumType, TToEnum>(ref Unsafe.As<TFromEnum, TUnderlyingEnumType>(ref value));
Copy link
Member Author

Choose a reason for hiding this comment

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

witness, the power of .net. note that this should get fully elided to nothing in the jit :)

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge June 20, 2025 21:09
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