Skip to content

Commit

Permalink
Remove test that sets static readonly field after type initialization (
Browse files Browse the repository at this point in the history
…dotnet/corefx#33413)

dotnet/coreclrdotnet/corefx#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.

Commit migrated from dotnet/corefx@4914440
  • Loading branch information
AndyAyersMS authored and stephentoub committed Nov 12, 2018
1 parent f09a054 commit 8883f59
Showing 1 changed file with 0 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Func<PropertyAndFields>> assignToReadonly = Expression.Lambda<Func<PropertyAndFields>>(
Expression.MemberInit(
Expression.New(typeof(PropertyAndFields)),
Expression.Bind(member, Expression.Constant("ABC" + useInterpreter))
)
);
Func<PropertyAndFields> func = assignToReadonly.Compile(useInterpreter);
func();
Assert.Equal("ABC" + useInterpreter, PropertyAndFields.StaticReadonlyStringField);
}

[Theory, ClassData(typeof(CompilationTypes))]
public void StaticProperty(bool useInterpreter)
{
Expand Down

0 comments on commit 8883f59

Please sign in to comment.