Skip to content

Conversation

@jbogard
Copy link
Contributor

@jbogard jbogard commented Dec 5, 2017

This fixes the newly introduced issue of casting collection types. I didn't think forcing everyone to use UseDestinationValue was a good solution, this change centers around the interfaces and the concrete types are only used for instantiation.

…s; remove collection mappers from assuming the destination type; fixes #2397; fixes #2435; fixes #2436; fixes #2449; fixes #2447
@jbogard jbogard added this to the 6.2.2 milestone Dec 5, 2017
Assign(passedDestination, destExpression),
assignNewExpression,
Call(destination, clearMethod),
ToType(mapExpr, createInstance.Type)
Copy link
Contributor

Choose a reason for hiding this comment

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

Stupid question. Wouldn't this be sufficient not to cast the result back? Not sure why anything else would be needed. The problem wasn't that collection was a List when passed down it's cause it was casted as such instead of ICollection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No that's where I started with, just removing this piece. The problem is our execution plan includes two paths for deciding what concrete type to create.

return Constant(null, typeof(string));
}

if (type.IsInterface())
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really necessary? CollectionMapper returns ICollection it's just casts to List instead of left as instance type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is called in a few places so I can't assume what the mappers do.

Copy link
Contributor

@lbargaoanu lbargaoanu Dec 6, 2017

Choose a reason for hiding this comment

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

I guess it's not that bad :) What about ISet? Maybe move arrays here too? Or move this code there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll get another PR for that for now lgtm

@jbogard
Copy link
Contributor Author

jbogard commented Dec 5, 2017

@TylerCarlson1
Copy link
Contributor

Ok looks good enough to me.

Also I don't feel like debugging Expressions atm. :)

@jbogard jbogard merged commit 877d917 into master Dec 6, 2017
@jbogard jbogard deleted the CollectionBug branch December 6, 2017 15:04
@jbogard jbogard added the Bug label Dec 6, 2017
@lock
Copy link

lock bot commented May 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants