sonyps5201314
84a07fb395
Use a UI to control whether to use the `struct field initializer` syntax sugar.
5 months ago
sonyps5201314
117bf54327
Fix the unit test failure caused by the last commit.
5 months ago
sonyps5201314
793d4171f2
Support for `struct` types written in non-primary constructor form that contain field initialization statements has been added. This type was previously mentioned in the commit with the message "The logic was temporarily adjusted so that the `StructWithDefaultCtor` type in the unit test could pass the test. In fact, the member initialization statement in its constructor could be moved."
...
Here's an example:
```cs
public struct StructWithDefaultCtor2
{
public int X = 42;
public int Y = Math.Max(1, 2);
public event EventHandler MyEvent = delegate { };
public int Z { get; set; } = Math.Max(3, 5);
public StructWithDefaultCtor2()
{
}
}
public struct StructWithDefaultCtor3
{
public int X = 42;
public int Y = Math.Max(1, 2);
public event EventHandler MyEvent;
public int Z { get; set; }
public StructWithDefaultCtor3()
{
MyEvent = delegate { };
Z = Math.Max(3, 5);
}
}
```
5 months ago
sonyps5201314
13f0ec93db
The special rule for `IsPrimaryConstructor` determination is extended: for `record` types, a complete sequence of assignment statements from the constructor parameters to the `BackingFieldOfAutomaticProperty` must exist.
...
Here's an example:
```cs
record WebPair7(string name, string? value, ref readonly object encode)
{
public string? Value { get; } = name;
public string Name { get; } = value;
string? WebValue { get; } = name != null ? "111" : value;
string? WebValue2;
}
```
5 months ago
sonyps5201314
dc452836e0
Fix failing unit tests: `InitializerTests` and `ValueTypes`.
5 months ago
sonyps5201314
e4a31b8952
Fix an issue in IL code comparison where identical input files could incorrectly produce different output lines, such as ` 275 (-) IL_000a: stloc.0` versus ` 275 (+) IL_000a: stlocc.0`.
5 months ago
sonyps5201314
5a67d15e0f
In `PrettyTestRunner`, when a test case fails, prioritize using a folder without a numbered suffix for the output directory.
5 months ago
sonyps5201314
1a0696e851
Add a special case to the `IsPrimaryConstructor` determination logic: for a `record struct` type, there must be at least one assignment from a constructor parameter to a `BackingFieldOfAutomaticProperty`.
5 months ago
sonyps5201314
ae24166cd4
The primary constructor check is also skipped when a constructor ends with `NOP NOP RET` instructions, to allow some unit tests to pass.
5 months ago
sonyps5201314
2a887cc5fd
When a constructor starts with a NOP instruction, the primary constructor check is skipped to allow some unit tests to pass.
5 months ago
sonyps5201314
f624cfc525
`PrettyTestRunner` output format adjustment
5 months ago
sonyps5201314
f478f366bb
The unit test method in `PrettyTestRunner` is changed to prioritize comparison using C# source code, and falls back to IL code comparison on failure.
5 months ago
sonyps5201314
5672c58bcf
Fixed an issue where the `TestRef` type in the example below could not be decompiled correctly after the commit: `Fixed an issue where the logic of moving the initialization statement of class members in the constructor to the class member declaration was incompatible with complex expressions using parameters.`
...
```cs
public ref struct TestRef(ref int a)
{
public ref int AAA = ref a;
public void Print()
{
int val = AAA;
Console.WriteLine(val);
}
}
```
5 months ago
sonyps5201314
8abe38128e
Fixed an issue where [RestClientOptions]( https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Options/RestClientOptions.cs ) could not be decompiled correctly after the commit: `Fixed an issue where the logic of moving the initialization statement of class members in the constructor to the class member declaration was incompatible with complex expressions using parameters.`
5 months ago
sonyps5201314
16c2b8c1a9
The logic was temporarily adjusted so that the `StructWithDefaultCtor` type in the unit test could pass the test. In fact, the member initialization statement in its constructor could be moved.
...
Here's an example:
when `IsPrimaryConstructor` return `false`:
```cs
struct StructWithDefaultCtor
{
int X = 42;
public StructWithDefaultCtor()
{
}
}
```
when `IsPrimaryConstructor` return `true`:
```cs
struct StructWithDefaultCtor()
{
int X = 42;
}
```
5 months ago
sonyps5201314
851a1f3af5
Fixed an issue where the logic of moving the initialization statement of class members in the constructor to the class member declaration was incompatible with complex expressions using parameters.
...
Here's an example:
```cs
public struct FromBinaryOperator
{
public int Leet;
public FromBinaryOperator(int dummy1, int dummy2)
{
Leet = dummy1 + dummy2;
}
}
public struct FromCall
{
public int Leet;
public FromCall(int dummy1, int dummy2)
{
Leet = Math.Max(dummy1, dummy2);
}
}
public struct FromConvert
{
public int Leet;
public FromConvert(double dummy1, double dummy2)
{
Leet = (int)Math.Min(dummy1, dummy2);
}
}
```
5 months ago
sonyps5201314
439ceef2a2
Fixed an issue where the copy constructor of type `DerivedGeneric` in unit tests was not recognized as compiler-generated code after the commit "`Fixed the issue where the DefaultParameters type in https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/DefaultParameters.cs was incorrectly judged as to whether the primary constructor was used due to incorrect initialization logic of isStruct and isInheritedRecord in the constructor of the RecordDecompiler class.`".
5 months ago
sonyps5201314
461ffe57fe
Fixed an issue in unit tests where the `RefFields` type would be decompiled into incorrect code when the return value of the `IsPrimaryConstructor` function was forcibly changed to `false`.
5 months ago
sonyps5201314
fee9db9f9d
Fixed an issue where two `PrimaryCtorWithField` types in unit tests could not be decompiled correctly
5 months ago
sonyps5201314
c5fc18c94e
Fixed an issue where the `Range` type in " https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Polyfills/Range.cs " could not be decompiled correctly after adjusting the judgment logic of the primary constructor.
5 months ago
sonyps5201314
27f5275718
Fixed unsupport for types containing multiple regular constructors, none of which chain calls to the primary constructor.
...
Here's an example:
```cs
public record struct CopilotContextId
{
public CopilotContextId() => this.Id = Guid.NewGuid();
public CopilotContextId(Guid id) => this.Id = id;
public Guid Id { get; }
}
```
5 months ago
sonyps5201314
ae86ddf3c8
Fixed the issue that the `Index` type in “ https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Polyfills/Index.cs ” would be decompiled incorrectly after the commit of “Make `ILSpy` support `struct` and `record struct` types declared with a primary constructor and containing other constructors.”.
5 months ago
sonyps5201314
cae466e5b0
Make `ILSpy` support `struct` and `record struct` types declared with a primary constructor and containing other constructors.
...
Here's an example:
```cs
public record struct CopilotContextId_RecordStruct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_RecordStruct() : this(Guid.NewGuid())
{
}
}
public struct CopilotContextId_Struct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_Struct() : this(Guid.NewGuid())
{
}
}
```
5 months ago
sonyps5201314
89c7e59176
Fixed an issue where the `record struct` type declared with a primary constructor could not be decompiled correctly. The reason was that `HandleInstanceFieldInitializers` did not support the `struct` type, but `DetectPrimaryConstructor` did not exclude it in advance.
...
Here's an example:
```cs
public record struct CopilotContextId_RecordStruct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_RecordStruct() : this(Guid.NewGuid())
{
}
}
```
5 months ago
sonyps5201314
9a4e49a7d4
Fixed an issue where the "CopilotQueriedScopeMention" type in "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\Microsoft.VisualStudio.Copilot.Contracts\Microsoft.VisualStudio.Copilot.dll" could not be decompiled correctly after expanding the judgment logic of IsPrimaryConstructor.
5 months ago
sonyps5201314
554ec92e73
Fix the issue where parameters in the base class constructor call are not passed correctly for inherited classes declared using the primary constructor form (e.g., the `DeserializationException` type in RestSharp), and also fix the subsequent issue where an extra parenthesis '()' is output if the base class is an interface (e.g., the `XmlRestSerializer` type in RestSharp).
6 months ago
sonyps5201314
828fb52390
`IsBaseCtorCall` no longer checks the number of parameters. Otherwise, it would cause the translation of the `DeserializationException` type in ` https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Serializers/DeseralizationException.cs ` to fail, as it is a primary constructor declaration that calls a base constructor with two arguments.
...
Additionally, dotPeek's `IsPrimaryConstructorFast` function has been introduced. This is because, after the aforementioned modification to `IsBaseCtorCall`, the `NamedParameter` type in RestSharp was being incorrectly identified as a primary constructor. Without this correction, it would lead to many compilation errors.
6 months ago
sonyps5201314
8d1cfee963
The internal judgment logic of IsPrimaryConstructor should exclude the copy constructor first, otherwise it will be judged incorrectly whether the NamedParameter type in https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/Parameter.cs uses the primary constructor.
6 months ago
sonyps5201314
10ce064833
Fixed the issue where the DefaultParameters type in https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/DefaultParameters.cs was incorrectly judged as to whether the primary constructor was used due to incorrect initialization logic of isStruct and isInheritedRecord in the constructor of the RecordDecompiler class.
6 months ago
sonyps5201314
aae1a28895
The IsPrimaryConstructor function is reimplemented based on some of dotPeek's judgment rules and the definition and characteristics of the primary constructor. However, it is found that dotPeek's judgment logic is also problematic. For example, it does not support the following scenario: ``` class WebPair(string name, string? value, ref readonly object encode) { public string Name { get; } = name; public string? Value { get; } = value; string? WebValue { get; } = encode is null ? "111" : value; string? WebValue2 { get; } = encode.ToString(); } ```
6 months ago
sonyps5201314
e8f32ec592
Fixed the issue where IsPrimaryConstructor's judgment was too conservative, which resulted in the inability to generate correct code in many scenarios.
6 months ago
Siegfried Pammer
126e870a5a
Fix #3577 : Properly infer the switch governing type and preserve conversions
6 months ago
Christoph Wille
4f11813829
.NET 10 RC2 packages ( #3599 )
...
Note: transport feed had only 106 for dotnet-format and ILCompiler.Reflection.ReadyToRun.Experimental
6 months ago
Youssef Victor
eebc8ea222
Move from dotnet.config to global.json ( #3553 )
...
* Delete dotnet.config
* Update global.json
6 months ago
Christoph Wille
df49abdaeb
Merge pull request #3594 from icsharpcode/dependabot/github_actions/github/codeql-action-4
...
Bump github/codeql-action from 3 to 4
6 months ago
dependabot[bot]
80a9f51379
Bump github/codeql-action from 3 to 4
...
Bumps [github/codeql-action](https://github.com/github/codeql-action ) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases )
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md )
- [Commits](https://github.com/github/codeql-action/compare/v3...v4 )
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: '4'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
6 months ago
Siegfried Pammer
c075f7b9c8
Fix out var for expressions appearing in a lambda and not in a statement.
6 months ago
Siegfried Pammer
d11c40719d
#3569 : Don't move out variable declarations out of lambdas.
6 months ago
Siegfried Pammer
995d31fc2d
Fix #3318 : missing x:FieldModifier in BAML decompiler
6 months ago
Siegfried Pammer
d736b02e2b
Fix #3480 : assert at ExpressionBuilder.BuildArrayInitializerExpression with properties that are not C# indexers, but parameterized properties.
6 months ago
Christoph Wille
8b1fb633f3
Merge pull request #3589 from miloush/master
...
List name first in ILSpy title for multiple instances
6 months ago
Jan Kučera
5297b0b322
List name first in ILSpy title for multiple instance
6 months ago
Christoph Wille
e214742c91
Merge pull request #3550 from icsharpcode/fix/3521
...
#3521 : Add API to set an initially highlighted entity after navigation
6 months ago
Siegfried Pammer
7e8b0500ce
Add nullability annotations to some tree nodes.
6 months ago
Siegfried Pammer
d6ab43d839
Fix #3521 : Add API to set an initially highlighted entity after navigation.
6 months ago
Siegfried Pammer
b403b7bb3d
Fix #3542 : Invalid explicit cast for implicit conversion to generic struct with interface type constraint
6 months ago
Daniel Grunwald
d13835e2cc
Add test for "params scoped Span'.
6 months ago
dependabot[bot]
ed36ba1d8a
Bump ossf/scorecard-action from 2.4.2 to 2.4.3 ( #3583 )
...
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action ) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/ossf/scorecard-action/releases )
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md )
- [Commits](https://github.com/ossf/scorecard-action/compare/v2.4.2...v2.4.3 )
---
updated-dependencies:
- dependency-name: ossf/scorecard-action
dependency-version: 2.4.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
6 months ago
Jeremy Pritts
b50f4e1d72
Enable detection of .NET version without TargetFrameworkAttribute ( #3580 )
6 months ago
Siegfried Pammer
16b74f6aec
Merge pull request #3579 from ds5678/issue3576
...
Do not create object initializers for tuples
6 months ago