Simplified PrivateTypesTest.Either classes by reducing reflection use #1627
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
I'm currently attempting to create a lightweight extension on top of System.Reactive for use with the latest version 2021.2 of the Unity Game engine. The existing adoption of System.Reactive for Unity called UniRx has lacked maintenance in a big way for years hence a growing community interest in the ability to benefit from the improvements made to System.Reactive in recent years.
To validate the correct operation of the library System.Reactive when used with Unities unique features like IL2CPP which is required to support builds onto various platforms, I'm using the existing Tests existing in this repository.
I having an automated continues integration setup which is making use of the tests as they are in this repository to continuously validate each new version of System.Reactive for its use in unity.
Discovery:
Running the tests in PrivateTypesTest.cs I ran into issues when using an ahead of time compilation (IL2CPP) as because of the heavy use of reflection the compiler wasn't able to figure out which generic types it had to generate for their use at runtime.
Reason for creating this PR:
Reading through EitherBase as well as Either<,> and it's nested classes (all nested within PrivateTypesTest) I was faced with some confusing, until I realized the exactly, what's being attempted to accomplish there. I wanted to make it a little easier for others to understand this.
Solution:
To archive this I reduced to use of reflection which lead to typing being clearer when reading the code.
This incidentally ended up also fixed my ahead of time compilation issues.