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

Merge main to release/dev17.8 #15556

Merged
merged 2 commits into from
Jul 5, 2023
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
2 changes: 1 addition & 1 deletion src/Compiler/Checking/CheckDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ module TcExceptionDeclarations =

let TcExnDefnCore_Phase1A cenv env parent (SynExceptionDefnRepr(Attributes synAttrs, SynUnionCase(ident= SynIdent(id,_)), _, xmlDoc, vis, m)) =
let attrs = TcAttributes cenv env AttributeTargets.ExnDecl synAttrs
if not (String.isLeadingIdentifierCharacterUpperCase id.idText) then errorR(NotUpperCaseConstructor m)
if not (String.isLeadingIdentifierCharacterUpperCase id.idText) then errorR(NotUpperCaseConstructor id.idRange)
let vis, cpath = ComputeAccessAndCompPath env None m vis None parent
let vis = TcRecdUnionAndEnumDeclarations.CombineReprAccess parent vis
CheckForDuplicateConcreteType env (id.idText + "Exception") id.idRange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ module ExceptionDefinition =
|> compile
|> shouldFail
|> withDiagnostics [
(Error 53, Line 9, Col 1, Line 9, Col 19, "Discriminated union cases and exception labels must be uppercase identifiers")
(Error 53, Line 10, Col 1, Line 10, Col 19, "Discriminated union cases and exception labels must be uppercase identifiers")
(Error 53, Line 9, Col 11, Line 9, Col 12, "Discriminated union cases and exception labels must be uppercase identifiers")
(Error 53, Line 10, Col 11, Line 10, Col 12, "Discriminated union cases and exception labels must be uppercase identifiers")
]

// SOURCE=E_BeginWithUppercase02.fsx SCFLAGS="--test:ErrorRanges" # E_BeginWithUppercase02.fsx
Expand Down Expand Up @@ -310,7 +310,7 @@ module ExceptionDefinition =
|> compile
|> shouldFail
|> withDiagnostics [
(Error 53, Line 8, Col 1, Line 8, Col 39, "Discriminated union cases and exception labels must be uppercase identifiers")
(Error 53, Line 8, Col 11, Line 8, Col 29, "Discriminated union cases and exception labels must be uppercase identifiers")
]

// SOURCE=E_Undefined.fsx SCFLAGS=--test:ErrorRanges # E_Undefined.fsx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ type MyNumber = Number of int
Assert.Equal(expected, actual)

[<Fact>]
let ``Doesn't fix FS0053 for exceptions`` () =
let ``Fix FS0053 for exceptions`` () =
let code =
"""
exception lowException of string
"""

let expected = None
let expected =
Some
{
Message = "Replace with 'LowException'"
FixedCode =
"""
exception LowException of string
"""
}

let actual = codeFix |> tryFix code diagnostic

Expand Down