8000 Fix issue where explicit or override wasn't being passed correctly to the generic constraints writer by clairernovotny · Pull Request #1130 · reactiveui/refit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix issue where explicit or override wasn't being passed correctly to the generic constraints writer #1130

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

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion InterfaceStubGenerator.Core/InterfaceStubGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void WriteMethodOpening(StringBuilder source, IMethodSymbol methodSymbol, bool i
source.Append(string.Join(", ", list));
}

source.Append(@$") {GenerateConstraints(methodSymbol.TypeParameters, true)}
source.Append(@$") {GenerateConstraints(methodSymbol.TypeParameters, isExplicitInterface)}
{{");
}

Expand Down
26 changes: 26 additions & 0 deletions Refit.Tests/InheritedGenericInterfacesApi.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;

using Refit; // InterfaceStubGenerator looks for this
using static System.Math; // This is here to verify https://github.com/reactiveui/refit/issues/283

Expand Down Expand Up @@ -47,5 +49,29 @@ public interface IDataCrudApi<T, TKey> where T : class

[Delete("/{key}")]
Task Delete(TKey key);

[Get("")]
Task ReadAllClasses<TFoo>()
where TFoo : class, new();
}


public class DatasetQueryItem<TResultRow>
where TResultRow : class, new()
{
[JsonProperty("global_id")]
public long GlobalId { get; set; }

public long Number { get; set; }

[JsonProperty("Cells")]
public TResultRow Value { get; set; }
}

public interface IDataMosApi
{
[Get("/datasets/{dataSet}/rows")]
Task<DatasetQueryItem<TResulRow>[]> GetDataSetItems<TResulRow>()
where TResulRow : class, new();
}
}
0