diff --git a/src/Cake.Core.Tests/Data/MethodAliasGeneratorData.cs b/src/Cake.Core.Tests/Data/MethodAliasGeneratorData.cs index 5faca2b3eb..c81008e33e 100644 --- a/src/Cake.Core.Tests/Data/MethodAliasGeneratorData.cs +++ b/src/Cake.Core.Tests/Data/MethodAliasGeneratorData.cs @@ -246,5 +246,21 @@ public static dynamic NonGeneric_ExtensionMethodWithDynamicReturnValue(this ICak { throw new NotImplementedException(); } + + [CakeMethodAlias] +#nullable enable + public static void NonGeneric_ExtensionMethodWithNullableParameter(this ICakeContext context, string? parameter) +#nullable disable + { + throw new NotImplementedException(); + } + + [CakeMethodAlias] +#nullable enable + public static string? NonGeneric_ExtensionMethodWithNullableReturnValue(this ICakeContext context) +#nullable disable + { + throw new NotImplementedException(); + } } } \ No newline at end of file diff --git a/src/Cake.Core.Tests/Data/PropertyAliasGeneratorData.cs b/src/Cake.Core.Tests/Data/PropertyAliasGeneratorData.cs index 06542fc8e4..bcfc01a80f 100644 --- a/src/Cake.Core.Tests/Data/PropertyAliasGeneratorData.cs +++ b/src/Cake.Core.Tests/Data/PropertyAliasGeneratorData.cs @@ -123,5 +123,13 @@ public static int Cached_Obsolete_ExplicitError_WithMessage(this ICakeContext co { throw new NotImplementedException(); } + + [CakePropertyAlias(Cache = true)] +#nullable enable + public static string? Cached_Nullable_Type(this ICakeContext context) +#nullable disable + { + throw new NotImplementedException(); + } } } \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethod.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethod.verified.cake index 3dc2260389..32e48d1be2 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethod.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethod.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void Generic_ExtensionMethod() -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethod(Context); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethod(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValue.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValue.verified.cake index 98ad68a1b4..6ed38f7ff1 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValue.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValue.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public TTest Generic_ExtensionMethodWithGenericReturnValue(TTest value) -{ - return Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithGenericReturnValue(Context, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithGenericReturnValue(Context, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints.verified.cake index 2c686ebe56..460f1bef3c 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints.verified.cake @@ -2,6 +2,4 @@ public TOut Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints(TIn arg) where TIn : class, new() where TOut : System.Collections.ArrayList, System.IDisposable -{ - return Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints(Context, arg); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithGenericReturnValueAndTypeParamConstraints(Context, arg); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithParameter.verified.cake index 44046190c2..243e4c734a 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Generic_Methods_name=Generic_ExtensionMethodWithParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void Generic_ExtensionMethodWithParameter(TTest value) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithParameter(Context, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.Generic_ExtensionMethodWithParameter(Context, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithDynamicReturnValue.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithDynamicReturnValue.verified.cake index 4f21aed07e..176b3d095a 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithDynamicReturnValue.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithDynamicReturnValue.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public dynamic NonGeneric_ExtensionMethodWithDynamicReturnValue() -{ - return Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithDynamicReturnValue(Context); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithDynamicReturnValue(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericCollectionOfNestedType.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericCollectionOfNestedType.verified.cake index 63f1d940ff..3df11a5ceb 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericCollectionOfNestedType.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericCollectionOfNestedType.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithGenericCollectionOfNestedType(System.Collections.Generic.ICollection items) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericCollectionOfNestedType(Context, items); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericCollectionOfNestedType(Context, items); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionArrayParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionArrayParameter.verified.cake index 4f2f20600c..0473c84c68 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionArrayParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionArrayParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithGenericExpressionArrayParameter(System.Linq.Expressions.Expression>[] expression) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionArrayParameter(Context, expression); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionArrayParameter(Context, expression); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionParameter.verified.cake index d6938025dd..6fab8485d2 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithGenericExpressionParameter(System.Linq.Expressions.Expression> expression) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionParameter(Context, expression); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionParameter(Context, expression); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionParamsArrayParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionParamsArrayParameter.verified.cake index adef40989b..e0fc61c506 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionParamsArrayParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericExpressionParamsArrayParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithGenericExpressionParamsArrayParameter(params System.Linq.Expressions.Expression>[] expression) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionParamsArrayParameter(Context, expression); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericExpressionParamsArrayParameter(Context, expression); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericParameter.verified.cake index b0cc1889fd..72fbd4a722 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithGenericParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithGenericParameter(System.Action value) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericParameter(Context, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithGenericParameter(Context, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNoParameters.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNoParameters.verified.cake index 4377daf9c0..ca74b8c2c7 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNoParameters.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNoParameters.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithNoParameters() -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithNoParameters(Context); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithNoParameters(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNullableParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNullableParameter.verified.cake new file mode 100644 index 0000000000..756f9ffafc --- /dev/null +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNullableParameter.verified.cake @@ -0,0 +1,3 @@ +[System.Diagnostics.DebuggerStepThrough] +public void NonGeneric_ExtensionMethodWithNullableParameter(System.String? parameter) + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithNullableParameter(Context, parameter); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNullableReturnValue.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNullableReturnValue.verified.cake new file mode 100644 index 0000000000..a2ed6d19ac --- /dev/null +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithNullableReturnValue.verified.cake @@ -0,0 +1,3 @@ +[System.Diagnostics.DebuggerStepThrough] +public System.String? NonGeneric_ExtensionMethodWithNullableReturnValue() + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithNullableReturnValue(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalBooleanParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalBooleanParameter.verified.cake index 0e55a933cf..a582e31fdb 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalBooleanParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalBooleanParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalBooleanParameter(System.Int32 value, System.Boolean flag = false) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalBooleanParameter(Context, value, flag); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalBooleanParameter(Context, value, flag); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalCharParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalCharParameter.verified.cake index b4a6ae2b04..a89ab1efed 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalCharParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalCharParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalCharParameter(System.String s, System.Char c = 's') -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalCharParameter(Context, s, c); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalCharParameter(Context, s, c); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalDecimalParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalDecimalParameter.verified.cake index 4fee401a0b..bf6d48a86e 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalDecimalParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalDecimalParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalDecimalParameter(System.String s, System.Decimal value = (System.Decimal)12.12) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalDecimalParameter(Context, s, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalDecimalParameter(Context, s, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalEnumParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalEnumParameter.verified.cake index 5219816d75..9b9f861896 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalEnumParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalEnumParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalEnumParameter(System.Int32 value, System.AttributeTargets targets = (System.AttributeTargets)4) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalEnumParameter(Context, value, targets); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalEnumParameter(Context, value, targets); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableBooleanParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableBooleanParameter.verified.cake index 5fc4d9a697..ed9dc89338 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableBooleanParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableBooleanParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalNullableBooleanParameter(System.String s, System.Nullable value = (System.Boolean)false) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableBooleanParameter(Context, s, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableBooleanParameter(Context, s, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableCharParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableCharParameter.verified.cake index 49504fb8ee..b883d52848 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableCharParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableCharParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalNullableCharParameter(System.String s, System.Nullable value = (System.Char)'s') -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableCharParameter(Context, s, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableCharParameter(Context, s, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableDecimalParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableDecimalParameter.verified.cake index 9d4cd6c2d8..96bfe95405 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableDecimalParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableDecimalParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalNullableDecimalParameter(System.String s, System.Nullable value = (System.Decimal)123.12) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableDecimalParameter(Context, s, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableDecimalParameter(Context, s, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableDoubleParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableDoubleParameter.verified.cake index b6ab059a48..ff56f6e3e0 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableDoubleParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableDoubleParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalNullableDoubleParameter(System.String s, System.Nullable value = (System.Double)1234567890.12) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableDoubleParameter(Context, s, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableDoubleParameter(Context, s, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableEnumParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableEnumParameter.verified.cake index 1bdc60c744..e7fa4aeeb1 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableEnumParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableEnumParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalNullableEnumParameter(System.String s, System.Nullable targets = (System.AttributeTargets)4) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableEnumParameter(Context, s, targets); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableEnumParameter(Context, s, targets); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableLongParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableLongParameter.verified.cake index c8b25f8cae..53d3146e72 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableLongParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableLongParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalNullableLongParameter(System.String s, System.Nullable value = (System.Int64)1234567890) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableLongParameter(Context, s, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableLongParameter(Context, s, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableTParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableTParameter.verified.cake index 5df7b4ef28..83efdef1d6 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableTParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalNullableTParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalNullableTParameter(System.String s, System.Nullable value = (System.Int32)0) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableTParameter(Context, s, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalNullableTParameter(Context, s, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalObjectParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalObjectParameter.verified.cake index 82c9bac65f..921c14ade0 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalObjectParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalObjectParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalObjectParameter(System.Int32 value, System.Object option = null) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalObjectParameter(Context, value, option); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalObjectParameter(Context, value, option); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalStringParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalStringParameter.verified.cake index 1b8260d784..855d08957c 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalStringParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOptionalStringParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOptionalStringParameter(System.Int32 value, System.String s = "there is a \"string\" here and a \t tab") -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalStringParameter(Context, value, s); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOptionalStringParameter(Context, value, s); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOutputParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOutputParameter.verified.cake index 800ce262a6..c6f8631591 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOutputParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithOutputParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithOutputParameter(out System.IDisposable arg) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOutputParameter(Context, out arg); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithOutputParameter(Context, out arg); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameter.verified.cake index 196d594e5b..5ace2e0914 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithParameter(System.Int32 value) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithParameter(Context, value); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithParameter(Context, value); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameterArray.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameterArray.verified.cake index c265f0b697..8d44f06ec5 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameterArray.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameterArray.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithParameterArray(params System.Int32[] values) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithParameterArray(Context, values); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithParameterArray(Context, values); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameterAttributes.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameterAttributes.verified.cake index 39391cc7f4..f3ae8f531d 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameterAttributes.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithParameterAttributes.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithParameterAttributes([System.Runtime.CompilerServices.CallerMemberName] System.String memberName = "", [System.Runtime.CompilerServices.CallerFilePath] System.String sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] System.Int32 sourceLineNumber = (System.Int32)0) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithParameterAttributes(Context, memberName, sourceFilePath, sourceLineNumber); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithParameterAttributes(Context, memberName, sourceFilePath, sourceLineNumber); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithReservedKeywordParameter.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithReservedKeywordParameter.verified.cake index c16ac53884..f3fc73d725 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithReservedKeywordParameter.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithReservedKeywordParameter.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void NonGeneric_ExtensionMethodWithReservedKeywordParameter(System.Int32 @new) -{ - Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithReservedKeywordParameter(Context, @new); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithReservedKeywordParameter(Context, @new); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithReturnValue.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithReturnValue.verified.cake index 8075bdc12d..3af6e2ae3e 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithReturnValue.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Non_Generic_Methods_name=ExtensionMethodWithReturnValue.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public System.String NonGeneric_ExtensionMethodWithReturnValue() -{ - return Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithReturnValue(Context); -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.NonGeneric_ExtensionMethodWithReturnValue(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ExplicitError_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ExplicitError_WithMessage.verified.cake index d180837ad1..a87e6874ad 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ExplicitError_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ExplicitError_WithMessage.verified.cake @@ -1,5 +1,3 @@ [System.Diagnostics.DebuggerStepThrough] public void Obsolete_ExplicitError_WithMessage() -{ - throw new Cake.Core.CakeException("The alias Obsolete_ExplicitError_WithMessage has been made obsolete. Please use Foo.Bar instead."); -} \ No newline at end of file + => throw new Cake.Core.CakeException("The alias Obsolete_ExplicitError_WithMessage has been made obsolete. Please use Foo.Bar instead."); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ExplicitWarning_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ExplicitWarning_WithMessage.verified.cake index e436ddede9..c617650e9c 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ExplicitWarning_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ExplicitWarning_WithMessage.verified.cake @@ -1,8 +1,5 @@ [System.Diagnostics.DebuggerStepThrough] public void Obsolete_ExplicitWarning_WithMessage() -{ - Context.Log.Warning("Warning: The alias Obsolete_ExplicitWarning_WithMessage has been made obsolete. Please use Foo.Bar instead."); #pragma warning disable 0618 - Cake.Core.Tests.Data.MethodAliasGeneratorData.Obsolete_ExplicitWarning_WithMessage(Context); -#pragma warning restore 0618 -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.Obsolete_ExplicitWarning_WithMessage(Context); +#pragma warning restore 0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ImplicitWarning_NoMessage.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ImplicitWarning_NoMessage.verified.cake index 1523fa310d..ace37bde77 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ImplicitWarning_NoMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ImplicitWarning_NoMessage.verified.cake @@ -1,8 +1,5 @@ [System.Diagnostics.DebuggerStepThrough] public void Obsolete_ImplicitWarning_NoMessage() -{ - Context.Log.Warning("Warning: The alias Obsolete_ImplicitWarning_NoMessage has been made obsolete."); #pragma warning disable 0618 - Cake.Core.Tests.Data.MethodAliasGeneratorData.Obsolete_ImplicitWarning_NoMessage(Context); -#pragma warning restore 0618 -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.Obsolete_ImplicitWarning_NoMessage(Context); +#pragma warning restore 0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ImplicitWarning_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ImplicitWarning_WithMessage.verified.cake index 4ab4b9ea47..1962dbc49e 100644 --- a/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ImplicitWarning_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/MethodAliasGeneratorTests.TheGeneratorMethod.Should_Return_Correct_Generated_Code_For_Obsolete_Methods_name=Obsolete_ImplicitWarning_WithMessage.verified.cake @@ -1,8 +1,5 @@ [System.Diagnostics.DebuggerStepThrough] public void Obsolete_ImplicitWarning_WithMessage() -{ - Context.Log.Warning("Warning: The alias Obsolete_ImplicitWarning_WithMessage has been made obsolete. Please use Foo.Bar instead."); #pragma warning disable 0618 - Cake.Core.Tests.Data.MethodAliasGeneratorData.Obsolete_ImplicitWarning_WithMessage(Context); -#pragma warning restore 0618 -} \ No newline at end of file + => Cake.Core.Tests.Data.MethodAliasGeneratorData.Obsolete_ImplicitWarning_WithMessage(Context); +#pragma warning restore 0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ExplicitError_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ExplicitError_WithMessage.verified.cake index 0d109964de..d25430c7c4 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ExplicitError_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ExplicitError_WithMessage.verified.cake @@ -1,8 +1,5 @@ -public System.Int32 Cached_Obsolete_ExplicitError_WithMessage -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - throw new Cake.Core.CakeException("The alias Cached_Obsolete_ExplicitError_WithMessage has been made obsolete. Please use Foo.Bar instead."); - } -} \ No newline at end of file +[Obsolete("Please use Foo.Bar instead.", true)] +public System.Int32 Cached_Obsolete_ExplicitError_WithMessage +#pragma warning disable CS0618 + => Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Obsolete_ExplicitError_WithMessage(Context); +#pragma warning restore CS0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ExplicitWarning_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ExplicitWarning_WithMessage.verified.cake index a54cb38ce5..15df323b2b 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ExplicitWarning_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ExplicitWarning_WithMessage.verified.cake @@ -1,17 +1,6 @@ private System.Int32? _Cached_Obsolete_ExplicitWarning_WithMessage; -[Obsolete("Please use Foo.Bar instead.")] +[Obsolete("Please use Foo.Bar instead.", false)] public System.Int32 Cached_Obsolete_ExplicitWarning_WithMessage -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - Context.Log.Warning("Warning: The alias Cached_Obsolete_ExplicitWarning_WithMessage has been made obsolete. Please use Foo.Bar instead."); - if (_Cached_Obsolete_ExplicitWarning_WithMessage==null) - { #pragma warning disable CS0618 - _Cached_Obsolete_ExplicitWarning_WithMessage = Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Obsolete_ExplicitWarning_WithMessage(Context); -#pragma warning restore CS0618 - } - return _Cached_Obsolete_ExplicitWarning_WithMessage.Value; - } -} \ No newline at end of file + => _Cached_Obsolete_ExplicitWarning_WithMessage ??= Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Obsolete_ExplicitWarning_WithMessage(Context); +#pragma warning restore CS0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ImplicitWarning_NoMessage.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ImplicitWarning_NoMessage.verified.cake index 0b5db4d12e..6758a9c930 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ImplicitWarning_NoMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ImplicitWarning_NoMessage.verified.cake @@ -1,17 +1,6 @@ private System.Int32? _Cached_Obsolete_ImplicitWarning_NoMessage; [Obsolete] public System.Int32 Cached_Obsolete_ImplicitWarning_NoMessage -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - Context.Log.Warning("Warning: The alias Cached_Obsolete_ImplicitWarning_NoMessage has been made obsolete."); - if (_Cached_Obsolete_ImplicitWarning_NoMessage==null) - { #pragma warning disable CS0618 - _Cached_Obsolete_ImplicitWarning_NoMessage = Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Obsolete_ImplicitWarning_NoMessage(Context); -#pragma warning restore CS0618 - } - return _Cached_Obsolete_ImplicitWarning_NoMessage.Value; - } -} \ No newline at end of file + => _Cached_Obsolete_ImplicitWarning_NoMessage ??= Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Obsolete_ImplicitWarning_NoMessage(Context); +#pragma warning restore CS0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ImplicitWarning_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ImplicitWarning_WithMessage.verified.cake index ffb6c8c272..ffea761aa4 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ImplicitWarning_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Obsolete_Properties_name=Cached_Obsolete_ImplicitWarning_WithMessage.verified.cake @@ -1,17 +1,6 @@ private System.Int32? _Cached_Obsolete_ImplicitWarning_WithMessage; -[Obsolete("Please use Foo.Bar instead.")] +[Obsolete("Please use Foo.Bar instead.", false)] public System.Int32 Cached_Obsolete_ImplicitWarning_WithMessage -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - Context.Log.Warning("Warning: The alias Cached_Obsolete_ImplicitWarning_WithMessage has been made obsolete. Please use Foo.Bar instead."); - if (_Cached_Obsolete_ImplicitWarning_WithMessage==null) - { #pragma warning disable CS0618 - _Cached_Obsolete_ImplicitWarning_WithMessage = Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Obsolete_ImplicitWarning_WithMessage(Context); -#pragma warning restore CS0618 - } - return _Cached_Obsolete_ImplicitWarning_WithMessage.Value; - } -} \ No newline at end of file + => _Cached_Obsolete_ImplicitWarning_WithMessage ??= Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Obsolete_ImplicitWarning_WithMessage(Context); +#pragma warning restore CS0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Dynamic_Type.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Dynamic_Type.verified.cake index b57a1679d3..ee26752285 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Dynamic_Type.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Dynamic_Type.verified.cake @@ -1,13 +1,3 @@ private dynamic _Cached_Dynamic_Type; public dynamic Cached_Dynamic_Type -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - if (_Cached_Dynamic_Type==null) - { - _Cached_Dynamic_Type = Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Dynamic_Type(Context); - } - return _Cached_Dynamic_Type; - } -} \ No newline at end of file + => _Cached_Dynamic_Type ??= Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Dynamic_Type(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Nullable_Type.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Nullable_Type.verified.cake new file mode 100644 index 0000000000..247a2cb74c --- /dev/null +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Nullable_Type.verified.cake @@ -0,0 +1,3 @@ +private System.String? _Cached_Nullable_Type; +public System.String? Cached_Nullable_Type + => _Cached_Nullable_Type ??= Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Nullable_Type(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Reference_Type.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Reference_Type.verified.cake index 203e42b432..f76291c846 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Reference_Type.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Reference_Type.verified.cake @@ -1,13 +1,3 @@ private System.String _Cached_Reference_Type; public System.String Cached_Reference_Type -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - if (_Cached_Reference_Type==null) - { - _Cached_Reference_Type = Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Reference_Type(Context); - } - return _Cached_Reference_Type; - } -} \ No newline at end of file + => _Cached_Reference_Type ??= Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Reference_Type(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Value_Type.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Value_Type.verified.cake index 159ad45343..87cd6a7249 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Value_Type.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Cached_Properties_name=Cached_Value_Type.verified.cake @@ -1,13 +1,3 @@ private System.Boolean? _Cached_Value_Type; public System.Boolean Cached_Value_Type -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - if (_Cached_Value_Type==null) - { - _Cached_Value_Type = Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Value_Type(Context); - } - return _Cached_Value_Type.Value; - } -} \ No newline at end of file + => _Cached_Value_Type ??= Cake.Core.Tests.Data.PropertyAliasGeneratorData.Cached_Value_Type(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ExplicitError_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ExplicitError_WithMessage.verified.cake index 981d8ef161..a13ad1d445 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ExplicitError_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ExplicitError_WithMessage.verified.cake @@ -1,8 +1,5 @@ -public System.Int32 NonCached_Obsolete_ExplicitError_WithMessage -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - throw new Cake.Core.CakeException("The alias NonCached_Obsolete_ExplicitError_WithMessage has been made obsolete. Please use Foo.Bar instead."); - } -} \ No newline at end of file +[Obsolete("Please use Foo.Bar instead.", true)] +public System.Int32 NonCached_Obsolete_ExplicitError_WithMessage +#pragma warning disable CS0618 + => Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Obsolete_ExplicitError_WithMessage(Context); +#pragma warning restore CS0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ExplicitWarning_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ExplicitWarning_WithMessage.verified.cake index 4fc0eb5f89..16d4002b73 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ExplicitWarning_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ExplicitWarning_WithMessage.verified.cake @@ -1,9 +1,5 @@ -public System.Int32 NonCached_Obsolete_ExplicitWarning_WithMessage -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - Context.Log.Warning("Warning: The alias NonCached_Obsolete_ExplicitWarning_WithMessage has been made obsolete. Please use Foo.Bar instead."); - return Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Obsolete_ExplicitWarning_WithMessage(Context); - } -} \ No newline at end of file +[Obsolete("Please use Foo.Bar instead.", false)] +public System.Int32 NonCached_Obsolete_ExplicitWarning_WithMessage +#pragma warning disable CS0618 + => Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Obsolete_ExplicitWarning_WithMessage(Context); +#pragma warning restore CS0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ImplicitWarning_NoMessage.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ImplicitWarning_NoMessage.verified.cake index 93e9bb7369..c770e57722 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ImplicitWarning_NoMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ImplicitWarning_NoMessage.verified.cake @@ -1,9 +1,5 @@ -public System.Int32 NonCached_Obsolete_ImplicitWarning_NoMessage -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - Context.Log.Warning("Warning: The alias NonCached_Obsolete_ImplicitWarning_NoMessage has been made obsolete."); - return Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Obsolete_ImplicitWarning_NoMessage(Context); - } -} \ No newline at end of file +[Obsolete] +public System.Int32 NonCached_Obsolete_ImplicitWarning_NoMessage +#pragma warning disable CS0618 + => Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Obsolete_ImplicitWarning_NoMessage(Context); +#pragma warning restore CS0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ImplicitWarning_WithMessage.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ImplicitWarning_WithMessage.verified.cake index f6def61039..cc739cad85 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ImplicitWarning_WithMessage.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Obsolete_Properties_name=NonCached_Obsolete_ImplicitWarning_WithMessage.verified.cake @@ -1,9 +1,5 @@ -public System.Int32 NonCached_Obsolete_ImplicitWarning_WithMessage -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - Context.Log.Warning("Warning: The alias NonCached_Obsolete_ImplicitWarning_WithMessage has been made obsolete. Please use Foo.Bar instead."); - return Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Obsolete_ImplicitWarning_WithMessage(Context); - } -} \ No newline at end of file +[Obsolete("Please use Foo.Bar instead.", false)] +public System.Int32 NonCached_Obsolete_ImplicitWarning_WithMessage +#pragma warning disable CS0618 + => Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Obsolete_ImplicitWarning_WithMessage(Context); +#pragma warning restore CS0618 \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Properties_name=NonCached_Dynamic_Type.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Properties_name=NonCached_Dynamic_Type.verified.cake index 8afeee8917..2d9c520175 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Properties_name=NonCached_Dynamic_Type.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Properties_name=NonCached_Dynamic_Type.verified.cake @@ -1,8 +1,2 @@ public dynamic NonCached_Dynamic_Type -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - return Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Dynamic_Type(Context); - } -} \ No newline at end of file + => Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Dynamic_Type(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Properties_name=NonCached_Value_Type.verified.cake b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Properties_name=NonCached_Value_Type.verified.cake index 877caa66bf..3a339fd775 100644 --- a/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Properties_name=NonCached_Value_Type.verified.cake +++ b/src/Cake.Core.Tests/Expectations/PropertyAliasGeneratorTests.TheGenerateMethod.Should_Return_Correct_Generated_Code_For_Non_Cached_Properties_name=NonCached_Value_Type.verified.cake @@ -1,8 +1,2 @@ public System.Int32 NonCached_Value_Type -{ - [System.Diagnostics.DebuggerStepThrough] - get - { - return Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Value_Type(Context); - } -} \ No newline at end of file + => Cake.Core.Tests.Data.PropertyAliasGeneratorData.NonCached_Value_Type(Context); \ No newline at end of file diff --git a/src/Cake.Core.Tests/Unit/Scripting/CodeGen/MethodAliasGeneratorTests.cs b/src/Cake.Core.Tests/Unit/Scripting/CodeGen/MethodAliasGeneratorTests.cs index ebcf9a5614..743efb534c 100644 --- a/src/Cake.Core.Tests/Unit/Scripting/CodeGen/MethodAliasGeneratorTests.cs +++ b/src/Cake.Core.Tests/Unit/Scripting/CodeGen/MethodAliasGeneratorTests.cs @@ -61,6 +61,8 @@ public void Should_Throw_If_Method_Is_Null() [InlineData("ExtensionMethodWithGenericCollectionOfNestedType")] [InlineData("ExtensionMethodWithParameterAttributes")] [InlineData("ExtensionMethodWithDynamicReturnValue")] + [InlineData("ExtensionMethodWithNullableParameter")] + [InlineData("ExtensionMethodWithNullableReturnValue")] public Task Should_Return_Correct_Generated_Code_For_Non_Generic_Methods(string name) { // Given / When diff --git a/src/Cake.Core.Tests/Unit/Scripting/CodeGen/PropertyAliasGeneratorTests.cs b/src/Cake.Core.Tests/Unit/Scripting/CodeGen/PropertyAliasGeneratorTests.cs index c6595a8e15..77082d52d3 100644 --- a/src/Cake.Core.Tests/Unit/Scripting/CodeGen/PropertyAliasGeneratorTests.cs +++ b/src/Cake.Core.Tests/Unit/Scripting/CodeGen/PropertyAliasGeneratorTests.cs @@ -132,6 +132,7 @@ public Task Should_Return_Correct_Generated_Code_For_Non_Cached_Properties(strin [InlineData("Cached_Reference_Type")] [InlineData("Cached_Value_Type")] [InlineData("Cached_Dynamic_Type")] + [InlineData("Cached_Nullable_Type")] public Task Should_Return_Correct_Generated_Code_For_Cached_Properties(string name) { // Given / When diff --git a/src/Cake.Core/Scripting/CodeGen/MethodAliasGenerator.cs b/src/Cake.Core/Scripting/CodeGen/MethodAliasGenerator.cs index 570d52b097..6dba303853 100644 --- a/src/Cake.Core/Scripting/CodeGen/MethodAliasGenerator.cs +++ b/src/Cake.Core/Scripting/CodeGen/MethodAliasGenerator.cs @@ -44,15 +44,18 @@ public static string Generate(MethodInfo method, out string hash) throw new ArgumentNullException(nameof(method)); } - var isFunction = method.ReturnType != typeof(void); var builder = new StringBuilder(); - var parameters = method.GetParameters().Skip(1).ToArray(); + var parameters = method.GetParameters()[1..]; + + // Method is obsolete? + var obsolete = method.GetCustomAttribute(); + var isObsolete = obsolete != null; // Generate method signature. builder.AppendLine("[System.Diagnostics.DebuggerStepThrough]"); builder.Append("public "); builder.Append(GetReturnType(method)); - builder.Append(" "); + builder.Append(' '); builder.Append(method.Name); if (method.IsGenericMethod) @@ -61,9 +64,9 @@ public static string Generate(MethodInfo method, out string hash) BuildGenericArguments(method, builder); } - builder.Append("("); + builder.Append('('); builder.Append(string.Concat(GetProxyParameters(parameters, true))); - builder.Append(")"); + builder.Append(')'); // if the method is generic, emit any constraints that might exist. if (method.IsGenericMethod) @@ -71,19 +74,16 @@ public static string Generate(MethodInfo method, out string hash) GenericParameterConstraintEmitter.BuildGenericConstraints(method, builder); } - hash = _hasher - .ComputeHash(Encoding.UTF8.GetBytes(builder.ToString())) - .Aggregate(new StringBuilder(), - (sb, b) => sb.AppendFormat("{0:x2}", b), - sb => sb.ToString()); + hash = Convert.ToHexString( + _hasher.ComputeHash(Encoding.UTF8.GetBytes(builder.ToString()))); builder.AppendLine(); - builder.Append("{"); - builder.AppendLine(); - // Method is obsolete? - var obsolete = method.GetCustomAttribute(); - var isObsolete = obsolete != null; + if (isObsolete && !obsolete.IsError) + { + builder.AppendLine("#pragma warning disable 0618"); + } + builder.Append(" => "); if (isObsolete) { var message = GetObsoleteMessage(method, obsolete); @@ -93,32 +93,13 @@ public static string Generate(MethodInfo method, out string hash) // Throw an exception. var exception = string.Format( CultureInfo.InvariantCulture, - " throw new Cake.Core.CakeException(\"{0}\");", message); + "throw new Cake.Core.CakeException(\"{0}\");", message); builder.AppendLine(exception); // End method. - builder.Append("}"); - builder.AppendLine(); builder.AppendLine(); return builder.ToString(); } - - builder.AppendLine(string.Format( - CultureInfo.InvariantCulture, - " Context.Log.Warning(\"Warning: {0}\");", message)); - } - - if (isObsolete) - { - builder.AppendLine("#pragma warning disable 0618"); - } - - builder.Append(" "); - - if (isFunction) - { - // Add return keyword. - builder.Append("return "); } // Call extension method. @@ -130,10 +111,9 @@ public static string Generate(MethodInfo method, out string hash) BuildGenericArguments(method, builder); } - builder.Append("("); + builder.Append('('); builder.Append(string.Concat(GetProxyParameters(parameters, false))); - builder.Append(");"); - builder.AppendLine(); + builder.AppendLine(");"); if (isObsolete) { @@ -141,8 +121,6 @@ public static string Generate(MethodInfo method, out string hash) } // End method. - builder.Append("}"); - builder.AppendLine(); builder.AppendLine(); return builder.ToString(); @@ -156,7 +134,10 @@ private static string GetReturnType(MethodInfo method) } var isDynamic = method.ReturnTypeCustomAttributes.GetCustomAttributes(typeof(DynamicAttribute), true).Any(); - return isDynamic ? "dynamic" : method.ReturnType.GetFullName(); + var isNullable = method.ReturnTypeCustomAttributes.GetCustomAttributes(true).Any(attr => attr.GetType().FullName == "System.Runtime.CompilerServices.NullableAttribute"); + return string.Concat( + isDynamic ? "dynamic" : method.ReturnType.GetFullName(), + isNullable ? "?" : string.Empty); } private static IEnumerable GetProxyParameters(IEnumerable parameters, bool includeType) @@ -183,14 +164,14 @@ private static IEnumerable GetProxyParameters(IEnumerable private static void BuildGenericArguments(MethodInfo method, StringBuilder builder) { - builder.Append("<"); + builder.Append('<'); var genericArguments = new List(); foreach (var argument in method.GetGenericArguments()) { genericArguments.Add(argument.Name); } builder.Append(string.Join(", ", genericArguments)); - builder.Append(">"); + builder.Append('>'); } private static string GetObsoleteMessage(MethodInfo method, ObsoleteAttribute attribute) diff --git a/src/Cake.Core/Scripting/CodeGen/ParameterEmitter.cs b/src/Cake.Core/Scripting/CodeGen/ParameterEmitter.cs index 68481b63d0..ff08343413 100644 --- a/src/Cake.Core/Scripting/CodeGen/ParameterEmitter.cs +++ b/src/Cake.Core/Scripting/CodeGen/ParameterEmitter.cs @@ -17,6 +17,15 @@ namespace Cake.Core.Scripting.CodeGen /// internal sealed class ParameterEmitter { + // filter out the any custom parameter attributes that will be emitted by other means. + private static readonly Type[] Exclusions = new[] + { + typeof(OptionalAttribute), + typeof(OutAttribute), + typeof(ParamArrayAttribute), + typeof(DecimalConstantAttribute), + }; + private static readonly ParameterFormatter _parameterFormatter = new ParameterFormatter(); internal static string Emit(ParameterInfo parameter, bool includeType) @@ -36,6 +45,7 @@ private static IEnumerable BuildParameterTokens(ParameterInfo parameter, } if (includeType) { + var isNullable = false; if (parameter.IsDefined(typeof(ParamArrayAttribute))) { yield return "params "; @@ -45,21 +55,17 @@ private static IEnumerable BuildParameterTokens(ParameterInfo parameter, var customAttrs = parameter.GetCustomAttributesData(); if (customAttrs.Count > 0) { - // filter out the any custom parameter attributes that will be emitted by other means. - var exclusions = new[] - { - typeof(OptionalAttribute), - typeof(OutAttribute), - typeof(ParamArrayAttribute), - typeof(DecimalConstantAttribute) - }; - - foreach (var item in customAttrs.Where(p => !exclusions.Contains(p.AttributeType))) + foreach (var item in customAttrs.Where(p => !Exclusions.Contains(p.AttributeType))) { var attributeType = item.AttributeType.GetFullName(); + if (item.AttributeType.FullName == "System.Runtime.CompilerServices.NullableAttribute") + { + isNullable = true; + continue; + } if (item.AttributeType.Name.EndsWith("Attribute", StringComparison.OrdinalIgnoreCase)) { - attributeType = attributeType.Substring(0, attributeType.LastIndexOf("Attribute", StringComparison.OrdinalIgnoreCase)); + attributeType = attributeType[..attributeType.LastIndexOf("Attribute", StringComparison.OrdinalIgnoreCase)]; } if (item.ConstructorArguments.Count < 1 && item.NamedArguments.Count < 1) @@ -101,6 +107,11 @@ private static IEnumerable BuildParameterTokens(ParameterInfo parameter, { yield return parameter.ParameterType.GetFullName(); } + + if (isNullable) + { + yield return "?"; + } yield return " "; } diff --git a/src/Cake.Core/Scripting/CodeGen/PropertyAliasGenerator.cs b/src/Cake.Core/Scripting/CodeGen/PropertyAliasGenerator.cs index 3df7afb01d..1b4ac99473 100644 --- a/src/Cake.Core/Scripting/CodeGen/PropertyAliasGenerator.cs +++ b/src/Cake.Core/Scripting/CodeGen/PropertyAliasGenerator.cs @@ -115,48 +115,27 @@ private static string GenerateCode(MethodInfo method, out string hash) { var builder = new StringBuilder(); - hash = GenerateCommonInitalCode(method, ref builder); - - builder.Append("{"); - builder.AppendLine(); - builder.AppendLine(" [System.Diagnostics.DebuggerStepThrough]"); - builder.Append(" get"); - builder.AppendLine(); - builder.AppendLine(" {"); - // Property is obsolete? var obsolete = method.GetCustomAttribute(); if (obsolete != null) { - var message = GetObsoleteMessage(method, obsolete); - - if (obsolete.IsError) - { - builder.Append(" throw new Cake.Core.CakeException(\""); - builder.Append(message); - builder.Append("\");"); - builder.AppendLine(); - builder.AppendLine(" }"); - builder.AppendLine("}"); - builder.AppendLine(); - builder.AppendLine(); - - return builder.ToString(); - } + AddObsoleteAttribute(builder, obsolete); + } - builder.AppendLine(string.Format( - CultureInfo.InvariantCulture, - " Context.Log.Warning(\"Warning: {0}\");", message)); + hash = GenerateCommonInitalCode(method, ref builder); + if (obsolete != null) + { + builder.AppendLine("#pragma warning disable CS0618"); } - builder.Append(" return "); + builder.AppendFormat(" => ", method.Name); builder.Append(method.GetFullName()); - builder.Append("(Context);"); - builder.AppendLine(); - builder.AppendLine(" }"); - builder.AppendLine("}"); - builder.AppendLine(); - builder.AppendLine(); + builder.AppendLine("(Context);"); + + if (obsolete != null) + { + builder.AppendLine("#pragma warning restore CS0618"); + } return builder.ToString(); } @@ -167,15 +146,14 @@ private static string GenerateCommonInitalCode(MethodInfo method, ref StringBuil var curPos = builder.Length; builder.Append("public "); builder.Append(GetReturnType(method)); - builder.Append(" "); + builder.Append(' '); builder.Append(method.Name); builder.AppendLine(); - hash = SHA256 - .ComputeHash(Encoding.UTF8.GetBytes(builder.ToString(curPos, builder.Length - curPos))) - .Aggregate(new StringBuilder(), - (sb, b) => sb.AppendFormat("{0:x2}", b), - sb => sb.ToString()); + hash = Convert.ToHexString( + SHA256 + .ComputeHash(Encoding.UTF8.GetBytes(builder.ToString(curPos, builder.Length - curPos)))); + return hash; } @@ -195,97 +173,59 @@ private static string GenerateCachedCode(MethodInfo method, out string hash) builder.Append(GetReturnType(method)); if (method.ReturnType.GetTypeInfo().IsValueType) { - builder.Append("?"); + builder.Append('?'); } builder.Append(" _"); builder.Append(method.Name); - builder.Append(";"); + builder.Append(';'); builder.AppendLine(); // Property if (obsolete != null) { - if (string.IsNullOrEmpty(obsolete.Message)) - { - builder.Append("[Obsolete]"); - } - else - { - builder.AppendFormat("[Obsolete(\"{0}\")]", obsolete.Message); - } - - builder.AppendLine(); + AddObsoleteAttribute(builder, obsolete); } hash = GenerateCommonInitalCode(method, ref builder); - builder.Append("{"); - builder.AppendLine(); - builder.AppendLine(" [System.Diagnostics.DebuggerStepThrough]"); - builder.AppendLine(" get"); - builder.Append(" {"); - builder.AppendLine(); - - // Property is obsolete? - if (obsolete != null) - { - var message = GetObsoleteMessage(method, obsolete); - builder.AppendLine(string.Format( - CultureInfo.InvariantCulture, - " Context.Log.Warning(\"Warning: {0}\");", message)); - } - - builder.AppendLine(string.Format( - CultureInfo.InvariantCulture, - " if (_{0}==null)", method.Name)); - - builder.Append(" {"); - builder.AppendLine(); if (obsolete != null) { builder.AppendLine("#pragma warning disable CS0618"); } - builder.AppendFormat(" _{0} = ", method.Name); + builder.AppendFormat(" => _{0} ??= ", method.Name); builder.Append(method.GetFullName()); - builder.Append("(Context);"); - builder.AppendLine(); + builder.AppendLine("(Context);"); if (obsolete != null) { builder.AppendLine("#pragma warning restore CS0618"); } - builder.Append(" }"); - builder.AppendLine(); - builder.AppendFormat(" return _{0}", method.Name); - if (method.ReturnType.GetTypeInfo().IsValueType) + return builder.ToString(); + } + + private static void AddObsoleteAttribute(StringBuilder builder, ObsoleteAttribute obsolete) + { + builder.Append("[Obsolete"); + + if (!string.IsNullOrEmpty(obsolete.Message)) { - builder.Append(".Value"); + builder.AppendFormat( + "(\"{0}\", {1})", + obsolete.Message, + obsolete.IsError ? "true" : "false"); } - builder.Append(";"); - builder.AppendLine(); - builder.Append(" }"); - builder.AppendLine(); - builder.Append("}"); - builder.AppendLine(); - builder.AppendLine(); - return builder.ToString(); + builder.AppendLine("]"); } private static string GetReturnType(MethodInfo method) { var isDynamic = method.ReturnTypeCustomAttributes.GetCustomAttributes(typeof(DynamicAttribute), true).Any(); - return isDynamic ? "dynamic" : method.ReturnType.GetFullName(); - } - - private static string GetObsoleteMessage(MethodInfo method, ObsoleteAttribute attribute) - { - const string format = "The alias {0} has been made obsolete. {1}"; - var message = string.Format( - CultureInfo.InvariantCulture, - format, method.Name, attribute.Message); - return message.Trim(); + var isNullable = method.ReturnTypeCustomAttributes.GetCustomAttributes(true).Any(attr => attr.GetType().FullName == "System.Runtime.CompilerServices.NullableAttribute"); + return string.Concat( + isDynamic ? "dynamic" : method.ReturnType.GetFullName(), + isNullable ? "?" : string.Empty); } } } \ No newline at end of file