Uh oh!
There was an error while loading. Please reload this page.
Allow decimal constants - #17769
Conversation
❗ Release notes required
|
esbenbjerre
commented
Sep 20, 2024
@dotnet-policy-service agree |
Uh oh!
There was an error while loading. Please reload this page.
T-Gro
commented
Sep 23, 2024
Hi @esbenbjerre , thanks for this contribution.
|
esbenbjerre
commented
Sep 23, 2024
Thanks @T-Gro. I'm still trying to codegen the cctor code. Would you prefer I convert it to draft until it's ready? |
vzarytovskii
commented
Sep 23, 2024
Yeah, let's convert it to draft so it doesn't pop up on our triage radar |
@T-Gro I have a couple of questions regarding the test requirements.
|
T-Gro
commented
Sep 30, 2024
For the C# interop, the test framework in "ComponentTests" suite can handle CsharpSource as well. (or if curious, just look at more usages of the "CSharp" function. For pattern matching a decimal literal, the IL should contain:
For inspiration, look at tests which use the "verifyIL" function in the "ComponentTests" suite. I start such tests by writing a minimal F# sample, let the verification fail, and then copy relevant snippets of IL from the test output into the assertion list (that is assuming the IL looks good) |
3935cda to
4ad236cCompare@T-Gro I'm getting namespaceInteropopenXunitopenFSharp.Test.Compilermodule``TestDeleteMe`` =[<Fact>]let``Instantiate F# decimal literal from C#`` ()=letFSLib=
FSharp """namespace Interop.FSmodule DecimalLiteral = [<Literal>] let x = 7m"""|> withName "FSLib"letapp=
CSharp """using System;using Interop.FS;public class C { public Decimal y = DecimalLiteral.x;}"""|> withReferences [FSLib]
app
|> compile
|> shouldSucceedresults in |
esbenbjerre
commented
Oct 1, 2024
I managed to solve it by adding |
99ce53c to
8812aafCompareedgarfgp
commented
Oct 3, 2024
I think this is worth a small RFC so we can track this later in the language spec. |
vzarytovskii
commented
Oct 3, 2024
Yes, this will need an rfc |
esbenbjerre
commented
Oct 4, 2024
Created RFC PR here fsharp/fslang-design#790 |
Uh oh!
There was an error while loading. Please reload this page.
The intention of this PR is to add support for the use of the literal attribute on decimals.
Related fsharp/fslang-suggestions#847