@@ -167,7 +167,7 @@ public void EqualityOperator_WithNullables_ShouldReturnExpectedResult()
167167#pragma warning disable IDE0004 // Deliberate casts to test specific operators
168168#pragma warning disable CS8073 // Deliberate casts to test specific operators
169169 Assert . True ( ( StringValue ? ) null == ( StringValue ? ) null ) ;
170- Assert . True ( ( DecimalValue ? ) null == ( DecimalValue ? ) null ) ;
170+ Assert . True ( ( DecimalValue ? ) null == ( DecimalValue ? ) null ) ;
171171
172172 Assert . False ( ( StringValue ? ) null == ( StringValue ? ) "" ) ;
173173 Assert . False ( ( DecimalValue ? ) null == ( DecimalValue ? ) 0 ) ;
@@ -382,7 +382,7 @@ public void CastToCoreType_Regularly_ShouldReturnExpectedResult(int? value, int?
382382 [ InlineData ( 1 , 1 ) ]
383383 public void CastToNullableCoreType_Regularly_ShouldReturnExpectedResult ( int ? value , int ? expectedResult )
384384 {
385- var intInstance = value is null ? ( NestedIntValue ? ) null : new NestedIntValue ( new IntValue ( value . Value ) ) ;
385+ var intInstance = value is null ? ( NestedIntValue ? ) null : new NestedIntValue ( new IntValue ( value . Value ) ) ;
386386 Assert . Equal ( expectedResult , ( int ? ) intInstance ) ;
387387
388388 var decimalInstance = value is null ? null : new NestedDecimalValue ( new DecimalValue ( value . Value ) ) ;
@@ -601,7 +601,7 @@ public void Deserialize_FromCoreType_ShouldReturnExpectedResult(int value)
601601 {
602602 Assert . IsType < FormatAndParseTestingIntWrapper > ( Deserialize < FormatAndParseTestingIntWrapper , int > ( value ) ) ;
603603 Assert . Equal ( value , Deserialize < FormatAndParseTestingIntWrapper , int > ( value ) . Value . Value ) ;
604-
604+
605605 Assert . IsType < FormatAndParseTestingStringWrapper > ( Deserialize < FormatAndParseTestingStringWrapper , string > ( value . ToString ( ) ) ) ;
606606 Assert . Equal ( value . ToString ( ) , Deserialize < FormatAndParseTestingStringWrapper , string > ( value . ToString ( ) ) . Value . Value . Value . Value ) ;
607607 }
@@ -841,6 +841,16 @@ public void ParsabilityAndFormattability_InAllScenarios_ShouldBeGeneratedAccordi
841841 Assert . DoesNotContain ( interfaces , interf => interf . Name == "IUtf8SpanFormattable" ) ;
842842 Assert . DoesNotContain ( interfaces , interf => interf . Name == "IUtf8SpanParsable`1" ) ;
843843 }
844+
845+ /// <summary>
846+ /// A multi-param ctor with the 2nd and further parameters optional should prevent the single-param ctor from being generated.
847+ /// </summary>
848+ [ Fact ]
849+ public void Construct_WithManualConstructorWithSecondParamOptional_ShouldUseThat ( )
850+ {
851+ var result = new ManualCtorIntWrapper ( 1 ) ;
852+ Assert . Equal ( Int32 . MinValue , result . Value ) ; // Hand-written ctor should have been used
853+ }
844854 }
845855
846856 // Use a namespace, since our source generators dislike nested types
@@ -1045,6 +1055,15 @@ public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnly
10451055 throw new Exception ( "Serialization should have delegated to the wrapped value." ) ;
10461056 }
10471057 }
1058+ [ WrapperValueObject < int > ]
1059+ internal partial struct ManualCtorIntWrapper
1060+ {
1061+ public ManualCtorIntWrapper ( int value , string ? paramName = null )
1062+ {
1063+ this . Value = value is Int32 . MinValue ? value : Int32 . MinValue ;
1064+ _ = paramName ;
1065+ }
1066+ }
10481067
10491068 /// <summary>
10501069 /// Should merely compile.
0 commit comments