You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently you are unable to work with nullable structs, for example a method that returns Unum? will throw "The declaration of the type System.Nullable`1[[Lombiq.Arithmetics.Unum]] couldn't be found." error in the TypeConverter. Also null-coalescing operations need to be tested.
Similarly, (int A, int B) Foo() => (1, 1); will throw "The declaration of the type System.ValueTuple`2[[System.Int32],[System.Int32]] couldn't be found.".
Although not a bug, both are commonly used features of modern C# where lack of support will hinder adoption.
I'm not sure if this is related or a separate issue, but also if you return an array from a method instead of a property it won't work even if the two are functionally equivalent. For example Quire.Segments is an array returning property which is not suggested for performance reasons. But if I replace it with a ulong[] GetSegments() => _segments; method, I will get the The length of the array holder System.Void Lombiq.Arithmetics.Quire::.ctor(System.UInt64[],System.UInt16).Lombiq.Arithmetics.Quire.GetSegments (@this)[82..87) couldn't be statically determined. error. Checking if a method returns a trivial reference could resolve that problem.
The second one is a different issue. However, fixing CA1819 should rather be ulong[] GetSegments() => _segments.Clone(); which would need specific support on top of that.
Okay, then I will open a new issue for it here. As for your suggestion, wouldn't the cloning cause unnecessary overhead? If possible passing an immutable reference via IReadOnlyList<ulong> GetSegments() => _segments; makes more sense to me. Then the consumer can clone via .ToArray() if that's actually what they need.
github-actionsbot
changed the title
Add support for transforming Nullable, ValueTuple
Add support for transforming Nullable, ValueTuple (HAST-239)
Sep 18, 2022
Currently you are unable to work with nullable structs, for example a method that returns
Unum?
will throw "The declaration of the type System.Nullable`1[[Lombiq.Arithmetics.Unum]] couldn't be found." error in theTypeConverter
. Also null-coalescing operations need to be tested.Similarly,
(int A, int B) Foo() => (1, 1);
will throw "The declaration of the type System.ValueTuple`2[[System.Int32],[System.Int32]] couldn't be found.".Although not a bug, both are commonly used features of modern C# where lack of support will hinder adoption.
Jira issue
The text was updated successfully, but these errors were encountered: