Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/ReactiveUI.Fody.Tests/Issues/Issue47Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI.Fody.Helpers;

namespace ReactiveUI.Fody.Tests.Issues
{
public static class Issue47Tests
{
/// <summary>
/// The "test" here is simply for these to compile
/// Tests ObservableAsPropertyWeaver.EmitDefaultValue.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1812: Avoid uninstantiated internal classes", Justification = "Purpose is just to be compiled.")]
private class TestModel : ReactiveObject
{
[ObservableAsProperty]
public int IntProperty { get; }

[ObservableAsProperty]
public double DoubleProperty { get; }

[ObservableAsProperty]
public float FloatProperty { get; }

[ObservableAsProperty]
public long LongProperty { get; }
}
}
}
2 changes: 1 addition & 1 deletion src/ReactiveUI.Fody/ObservableAsPropertyWeaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void EmitDefaultValue(MethodBody methodBody, ILProcessor il, TypeReferenc
}
else if (type.CompareTo(ModuleDefinition.TypeSystem.Int64))
{
il.Emit(OpCodes.Ldc_I8);
il.Emit(OpCodes.Ldc_I8, 0L);
}
else if (type.CompareTo(ModuleDefinition.TypeSystem.Double))
{
Expand Down