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

Disallow counter collections #2350

Merged
merged 3 commits into from
Apr 26, 2021
Merged

Conversation

papafe
Copy link
Contributor

@papafe papafe commented Apr 23, 2021

This PR adds an error in the weaver when declaring collections of RealmInteger.

Fixes #2308

@papafe papafe requested a review from nirinchev April 23, 2021 14:38
@papafe papafe marked this pull request as draft April 23, 2021 14:38
@papafe papafe requested a review from LaPeste April 23, 2021 14:39
@papafe
Copy link
Contributor Author

papafe commented Apr 23, 2021

All seems to work, I just need to understand why I get an error during testing with peverify active

{
return WeavePropertyResult.Error($"{type.Name}.{prop.Name} is an {collectionType} but its generic type is {elementType.Name} which is not supported by Realm.");
if (_counterTypes.Contains(elementType.FullName))
Copy link
Member

Choose a reason for hiding this comment

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

Rather than having a new list of counters, you can check if the type is realm integer by calling elementType.Resolve().IsRealmInteger(out _, out _).

@nirinchev
Copy link
Member

If you get the peverify error on master, it's probably not due to your changes :D

@LaPeste
Copy link
Contributor

LaPeste commented Apr 23, 2021

All seems to work, I just need to understand why I get an error during testing with peverify active

I missed it, has peverify always been there? Or has it been added recently?

@papafe
Copy link
Contributor Author

papafe commented Apr 26, 2021

All seems to work, I just need to understand why I get an error during testing with peverify active

I missed it, has peverify always been there? Or has it been added recently?

It has been there for long time, and I think I already disabled it somewhere else in the past.

@papafe
Copy link
Contributor Author

papafe commented Apr 26, 2021

If you get the peverify error on master, it's probably not due to your changes :D

Yes, I've branched from master :)

@papafe papafe marked this pull request as ready for review April 26, 2021 09:02
@papafe papafe merged commit efa91fb into master Apr 26, 2021
@papafe papafe deleted the fp/disallow-counter-collections-2308 branch April 26, 2021 09:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
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.

Disallow collections of counters
3 participants