-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: .NET8 Stubs update. #15100
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
C#: .NET8 Stubs update. #15100
Conversation
1a71142
to
118238c
Compare
118238c
to
305e015
Compare
@@ -1436,15 +1436,11 @@ public class DefaultScripts : ServiceStack.Script.ScriptMethods, ServiceStack.Sc | |||
public long decrBy(long value, long by) => throw null; | |||
public long decrement(long value) => throw null; | |||
public long decrementBy(long value, long by) => throw null; | |||
public object default(object returnTarget, object elseReturn) => throw null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this because the stubgenerator fails to escape the name as @default
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I definitely thinks that is the case: https://github.com/ServiceStack/ServiceStack/blob/8134c682b3074b3e9525a269b8ba66427fee10e7/ServiceStack/src/ServiceStack.Common/Script/Methods/DefaultScripts.cs#L1630
I intend to do some follow up work on the stub generator to fix this.
public System.Collections.Generic.IEnumerable<object> distinct(System.Collections.Generic.IEnumerable<object> items) => throw null; | ||
public double div(double lhs, double rhs) => throw null; | ||
public double divide(double lhs, double rhs) => throw null; | ||
public object do(ServiceStack.Script.ScriptScopeContext scope, object expression) => throw null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, @do
.
@@ -1562,9 +1558,7 @@ public class DefaultScripts : ServiceStack.Script.ScriptMethods, ServiceStack.Sc | |||
public string httpPathInfo(ServiceStack.Script.ScriptScopeContext scope) => throw null; | |||
public string httpRequestUrl(ServiceStack.Script.ScriptScopeContext scope) => throw null; | |||
public string humanize(string text) => throw null; | |||
public object if(object test) => throw null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -1846,10 +1840,7 @@ public class DefaultScripts : ServiceStack.Script.ScriptMethods, ServiceStack.Sc | |||
public object resolveContextArg(ServiceStack.Script.ScriptScopeContext scope, string name) => throw null; | |||
public object resolveGlobal(ServiceStack.Script.ScriptScopeContext scope, string name) => throw null; | |||
public object resolvePageArg(ServiceStack.Script.ScriptScopeContext scope, string name) => throw null; | |||
public ServiceStack.Script.StopExecution return(ServiceStack.Script.ScriptScopeContext scope) => throw null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -1939,9 +1930,7 @@ public class DefaultScripts : ServiceStack.Script.ScriptMethods, ServiceStack.Sc | |||
public System.Collections.Generic.IEnumerable<object> thenByDescending(ServiceStack.Script.ScriptScopeContext scope, object target, object expression) => throw null; | |||
public System.Collections.Generic.IEnumerable<object> thenByDescending(ServiceStack.Script.ScriptScopeContext scope, object target, object expression, object scopeOptions) => throw null; | |||
public static System.Collections.Generic.IEnumerable<object> thenByInternal(string filterName, ServiceStack.Script.ScriptScopeContext scope, object target, object expression, object scopeOptions) => throw null; | |||
public object throw(ServiceStack.Script.ScriptScopeContext scope, string message) => throw null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -3265,9 +3253,7 @@ public class ProtectedScripts : ServiceStack.Script.ScriptMethods | |||
public ServiceStack.Script.IgnoreResult Move(string from, string to) => throw null; | |||
public ServiceStack.Script.IgnoreResult Move(ServiceStack.Script.IOScript os, string from, string to) => throw null; | |||
public string mv(ServiceStack.Script.ScriptScopeContext scope, string from, string to) => throw null; | |||
public object new (string typeName) => throw null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -3298,8 +3284,7 @@ public class ProtectedScripts : ServiceStack.Script.ScriptMethods | |||
public string textContents(ServiceStack.IO.IVirtualFile file) => throw null; | |||
public string touch(ServiceStack.Script.ScriptScopeContext scope, string target) => throw null; | |||
public static string TypeNotFoundErrorMessage(string typeName) => throw null; | |||
public System.Type typeof(string typeName) => throw null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -1042,8 +1042,7 @@ public static partial class ListExtensions | |||
} | |||
public class LongRange : System.IEquatable<ServiceStack.LongRange> | |||
{ | |||
public virtual ServiceStack.LongRange<Clone>$() => throw null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the stub generator should not emit this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look into this problem as well (it is different from the previous ones).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because the a "clone" method is created for record class
. It can't be invoked directly (only implicitly via the r with { ... }
expression, so we should just avoid generating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on what our goal is, it might not be enough to remove this method from the stubs.
The with { ... }
expression can only be used with records. So if this class is not generated as a record class
, then we won't be able to write new LongRange() with { ... }
in the test files. (But I think we can live with this limitation)
In this PR we update all the C# generated stubs.
The process was as follows
test/resources/stubs
make_stubs_all.py
script and copy all the generated stubs totest/resources/stubs
and add everything to the repo.options
files to point to the new version of the stubs.A couple of interesting possibilities for improvements
.csproj
files (I think this is due to ranges being used).