Skip to content

Conversation

@dtchepak
Copy link
Member

No description provided.

@dtchepak dtchepak marked this pull request as ready for review August 27, 2023 09:55
@dtchepak
Copy link
Member Author

@alexandrnikitin do you know of any changes to travis ci?

https://www.travis-ci.com/nsubstitute/NSubstitute

@icalvo This is prep work for releasing your Arg.AnyType change. Seem ok to release this as minor version increment as it should be a non-breaking change?

@icalvo
Copy link
Contributor

icalvo commented Aug 27, 2023

@icalvo This is prep work for releasing your Arg.AnyType change. Seem ok to release this as minor version increment as it should be a non-breaking change?

Yes, I think that's right.

@icalvo
Copy link
Contributor

icalvo commented Aug 27, 2023

@dtchepak I've realized I didn't update the docs, I can help with that as well if you're not already doing it.

@dtchepak
Copy link
Member Author

@dtchepak I've realized I didn't update the docs, I can help with that as well if you're not already doing it.

That would be awesome! No rush though, I can push the website changes after the release (so fine to be separate MR; it won't hold up the release).

@icalvo
Copy link
Contributor

icalvo commented Aug 27, 2023

@dtchepak, while preparing the docs I've realized there are a couple of use cases that won't work with the current implementation or Arg.AnyType:

  • If the generic type we are representing with Arg.AnyType has generic constraints it won't work because Arg.AnyType won't satisfy those constraints.
  • Arg.Is<T>() matcher does not support Arg.AnyType.

I can take a look at those issues or go ahead with the docs to finish 5.1.0 as it is, what do you prefer?

@dtchepak
Copy link
Member Author

@icalvo Good catch!

I think we should sort that prior to release to avoid breaking changes. WDYT?


I haven't tried it and first thought is something like this (sorry if this is stupid idea, literally the first thing that came to mind):

public interface AnyType {}

public class AnyClassType : AnyType {
    public AnyClassType() {}
}

public struct AnyValueType : AnyType {}

For more specific constraints people could define their own type:

public interface AnyWidgetType : AnyType, IWidget, IWidgetFactory {}

Alternatively don't know if something like this would help?

public interface AnyType<T> : AnyType, T {}

As an aside, I think we should add code docs (///) to Arg.AnyType.

@dtchepak dtchepak marked this pull request as draft August 27, 2023 21:24
@Romfos
Copy link
Contributor

Romfos commented Aug 28, 2023

I propose also bump System.Threading.Tasks.Extensions dependency to latest version (was release 3 years ago and widely adopted by .net ecosystem, have .net standard 2.0 of of the box support)

@icalvo
Copy link
Contributor

icalvo commented Aug 28, 2023

I also thought about converting AnyType to an interface, IMO that enables the user to derive a custom AnyType that satisfies any possible constraint. The alternative approach with AnyType<T> doesn't even compile because an interface cannot be derived from a class.

I take note about the xmldoc comments for Arg.AnyType.

@dtchepak dtchepak self-assigned this Sep 3, 2023
@dtchepak dtchepak marked this pull request as ready for review September 3, 2023 10:03
Copy link
Contributor

@zlangner zlangner left a comment

Choose a reason for hiding this comment

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

Looks good, just please get my name right :)

Copy link
Member

@alexandrnikitin alexandrnikitin left a comment

Choose a reason for hiding this comment

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

LGTM!

Just a minor comment regarding System.Threading.Tasks.Extensions update.

@alexandrnikitin do you know of any changes to travis ci?
https://www.travis-ci.com/nsubstitute/NSubstitute

It's gone 😞 . They stopped supporting OSS and looks like deleted everything. When I log in it offers to create an account and I don't see any projects.

As per PR review comment. No upper bound so users can update to which
ever version they like, and lower bound reflects the lowest we can support.
@dtchepak dtchepak merged commit c3d4c38 into nsubstitute:main Sep 10, 2023
@dtchepak dtchepak deleted the prep-5.1.0-release branch September 10, 2023 04:38
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

Successfully merging this pull request may close these issues.

6 participants