Skip to content

Show obsolete warnings/errors when used with unit of measure - #18182

Merged
vzarytovskii merged 31 commits into
dotnet:mainfrom
edgarfgp:fix-18181
Jan 9, 2025
Merged

Show obsolete warnings/errors when used with unit of measure#18182
vzarytovskii merged 31 commits into
dotnet:mainfrom
edgarfgp:fix-18181

Conversation

@edgarfgp

@edgarfgpedgarfgp commented Dec 29, 2024

Copy link
Copy Markdown
Contributor

Description

Fixes#18181

Before

  • No warnings/errors shown when using UOM marked as Obsolete
openSystem[<Measure; Obsolete("Use kg2",true)>]typekg// Distance, meters.[<Measure; Obsolete("Use m2")>]typem// Time, seconds.[<Measure; Obsolete("Use s2")>]typesletgenericSumUnits(x :float<'u>)(y:float<'u>)= x + y
letgenericSumUnits2(x :float<m>)(y:float<s>)=()letv1=3.1<m/s>letv2=2.7<m/s>letx1=1.2<m>lett1=1.0<s>[<Measure>]typem[<Measure; Obsolete("Use s2",true)>]types// Force, Newtons.[<Measure>]typeN= kg m / s^2

After

  • Warnings/Errors shown when using UOM marked as Obsolete
openSystem[<Measure; Obsolete("Use kg2",true)>]typekg// Distance, meters.[<Measure; Obsolete("Use m2")>]typem// Time, seconds.[<Measure; Obsolete("Use s2")>]typesletgenericSumUnits(x :float<'u>)(y:float<'u>)= x + y
letgenericSumUnits2(x :float<m>)(y:float<s>)=()// raises obsolete warningsletv1=3.1<m/s>// raises obsolete warningsletv2=2.7<m/s>// raises obsolete warningsletx1=1.2<m>// raises obsolete warningslett1=1.0<s>// raises obsolete warnings// Force, Newtons.[<Measure>]typeN= kg m / s^2// raises obsolete warnings

Checklist

  • Test cases added
  • Release notes entry updated

@github-actions

github-actionsBot commented Dec 29, 2024

Copy link
Copy Markdown
Contributor

❗ Release notes required


✅ Found changes and release notes in following paths:

Change pathRelease notes pathDescription
src/Compilerdocs/release-notes/.FSharp.Compiler.Service/9.0.200.md

@edgarfgpedgarfgp reopened this Dec 29, 2024
@edgarfgp
edgarfgp marked this pull request as ready for review December 30, 2024 14:28
@edgarfgp
edgarfgp requested a review from a team as a code ownerDecember 30, 2024 14:28
Comment threadsrc/Compiler/Checking/PostInferenceChecks.fs Outdated
Comment threadsrc/Compiler/Checking/PostInferenceChecks.fs
Comment threadsrc/Compiler/Checking/PostInferenceChecks.fs Outdated
Comment threadsrc/Compiler/TypedTree/TypedTree.fs Outdated
Comment threadsrc/Compiler/TypedTree/TypedTree.fs
Comment threadsrc/Compiler/TypedTree/TypedTree.fs Outdated
@T-Gro

T-Gro commented Jan 6, 2025

Copy link
Copy Markdown
Member

Thanks Edgar for following up on the feedback!
I will re-review this soon 👍

Comment threadsrc/Compiler/Checking/CheckDeclarations.fs Outdated
Comment threadsrc/Compiler/Checking/Expressions/CheckExpressions.fs Outdated
Comment threadsrc/Compiler/Checking/Expressions/CheckExpressions.fs Outdated
@vzarytovskii
vzarytovskii enabled auto-merge (squash) January 9, 2025 11:38

@psfinakipsfinaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff, good testing - thanks Edgar!

Comment threadsrc/Compiler/Checking/Expressions/CheckExpressions.fsi
@vzarytovskii
vzarytovskii merged commit 9ac324d into dotnet:mainJan 9, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Obsolete attribute warning/error is not taken into account when used with a unit of measure

4 participants

@edgarfgp@T-Gro@psfinaki@vzarytovskii