Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support literal attribute on decimals #17769

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

esbenbjerre
Copy link

@esbenbjerre esbenbjerre commented Sep 20, 2024

The intention of this PR is to add support for the use of the literal attribute on decimals.

[<Literal>]
let d = 2.5m
  • Allow decimal constant in PostInferenceChecks
  • Add decimal arithmetic in TypedTreeOps
  • Add DecimalConstantAttribute to TcGlobals
  • Add codegen (initonly field with attribute + cctor) to IlxGen
  • Fix broken tests
  • Add test for pattern matching a value against a decimal literal (IL, compileAndRun)
  • Add test for incomplete pattern matching a value against a decimal literal
  • Add test for usage and evaluation of decimal literal in quotations (compileAndRun)
  • Test C# interop

Related fsharp/fslang-suggestions#847

@esbenbjerre esbenbjerre requested a review from a team as a code owner September 20, 2024 10:27
Copy link
Contributor

github-actions bot commented Sep 20, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.200.md

@esbenbjerre
Copy link
Author

@dotnet-policy-service agree

@T-Gro
Copy link
Member

T-Gro commented Sep 23, 2024

Hi @esbenbjerre , thanks for this contribution.
Here are a few test areas I would expect to be covered as part of this PR:

  • Pattern matching a value against a decimal literal (IL test, compileAndRun test)
  • Incomplete Pattern matching with decimal literals
  • Usage and evaluation of decimal literal in quotations (compileAndRun test)
  • Consumption of the literal in C# (multiproject test for interop), tooling support from C# (referencing a .dll with the decimal constant in a C# project from IDE)

@esbenbjerre
Copy link
Author

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
Copy link
Member

Yeah, let's convert it to draft so it doesn't pop up on our triage radar

@vzarytovskii vzarytovskii marked this pull request as draft September 23, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

4 participants