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

If parametrized value is struct type, GetHashCode show an error #19

Open
desarrollo03TR opened this issue Dec 27, 2017 · 1 comment
Open

Comments

@desarrollo03TR
Copy link

desarrollo03TR commented Dec 27, 2017

Description

For union's choices with non-generic parameter, if the parameter is struct, compiler shows an error.

Repro steps

Please provide the steps required to reproduce the problem

  1. Create csunion file like this:
namespace Test.Unions
{
	union Choice
	{
		Contains<bool>
	}
}
  1. Step B

Save the file. open the g.cs file and check the GetHashCode method in the Contains class.

Expected behavior

I think the created class should check if the type is class or struct.

Actual behavior

Not checking.

Known workarounds

Editing the g.cs file is the only one workaround, but if the csunion is edited, the changes will be lost.

EDIT: use nullable tipes:

namespace Test.Unions
{
	union Choice
	{
		Contains<bool?>
	}
}
@desarrollo03TR
Copy link
Author

A workaround that I found is to use nullable types. int? insteand int, bool? insteand bool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant