From 5ce3a59b81352fec6121320e0ba02809f6291ef1 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Mon, 12 Nov 2018 09:09:58 -0800 Subject: [PATCH] Remove test that sets static readonly field after type initialization (#33413) dotnet/coreclr#20866 extends the jit to incorporate the type of readonly ref class typed static fields into jitted code when jitting happens after class initialization. For instance, the jit may optimize type tests or devirtualize calls. With the advent of type based jit optimizations we are also blocking reflection based updates to all readonly static fields after class initialization. --- .../tests/MemberInit/BindTests.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/System.Linq.Expressions/tests/MemberInit/BindTests.cs b/src/System.Linq.Expressions/tests/MemberInit/BindTests.cs index 00267bcbc8ba..4a1111eb5ad5 100644 --- a/src/System.Linq.Expressions/tests/MemberInit/BindTests.cs +++ b/src/System.Linq.Expressions/tests/MemberInit/BindTests.cs @@ -223,21 +223,6 @@ public void StaticField(bool useInterpreter) Assert.Equal("ABC", PropertyAndFields.StaticStringField); } - [Theory, ClassData(typeof(CompilationTypes))] - public void StaticReadonlyField(bool useInterpreter) - { - MemberInfo member = typeof(PropertyAndFields).GetMember(nameof(PropertyAndFields.StaticReadonlyStringField))[0]; - Expression> assignToReadonly = Expression.Lambda>( - Expression.MemberInit( - Expression.New(typeof(PropertyAndFields)), - Expression.Bind(member, Expression.Constant("ABC" + useInterpreter)) - ) - ); - Func func = assignToReadonly.Compile(useInterpreter); - func(); - Assert.Equal("ABC" + useInterpreter, PropertyAndFields.StaticReadonlyStringField); - } - [Theory, ClassData(typeof(CompilationTypes))] public void StaticProperty(bool useInterpreter) {