Skip to content

Commit 22ddba5

Browse files
committed
Fix decimal literal
1 parent ce4c03a commit 22ddba5

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/MemoryPack.Generator/MemoryPackGenerator.Emitter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ string EmitConstantValue(object? constantValue)
13761376
string x => $"\"{x}\"",
13771377
char x => $"'{x}'",
13781378
float x => $"{x}f",
1379-
decimal x => $"{x}D",
1379+
decimal x => $"{x}M",
13801380
bool x => x ? "true" : "false",
13811381
_ => constantValue.ToString()
13821382
};

tests/MemoryPack.Tests/Models/DefaultValues.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ partial class CtorParamDefaultValue
4646
public bool B;
4747

4848
[MemoryPackConstructor]
49-
public CtorParamDefaultValue(int x, int y = 12345, float z = 678.9f, string s = "aaaaaa", bool b = true)
49+
public CtorParamDefaultValue(int x, int y = 12345, float z = 678.9f, string s = "aaaaaa", bool b = true, decimal d = 99M)
5050
{
5151
X = x;
5252
Y = y;

0 commit comments

Comments
 (0)