From c458208ef213596adf150d99f3cf3b6951809568 Mon Sep 17 00:00:00 2001 From: kerams Date: Fri, 9 Dec 2022 20:56:44 +0100 Subject: [PATCH 1/6] Allow arithmetic in enum definitions --- src/Compiler/Checking/CheckDeclarations.fs | 43 ++++++++++++------- src/Compiler/SyntaxTree/SyntaxTree.fs | 3 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 3 +- src/Compiler/pars.fsy | 12 +++--- .../EmittedIL/Enums.fs | 29 +++++++++++++ .../FSharp.Compiler.ComponentTests.fsproj | 1 + ...erService.SurfaceArea.netstandard.expected | 14 +++--- tests/service/SyntaxTreeTests/TypeTests.fs | 12 +++--- tests/service/TreeVisitorTests.fs | 2 +- 9 files changed, 78 insertions(+), 41 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 7ea1c4b3429..19b08ce4e2a 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -563,26 +563,37 @@ module TcRecdUnionAndEnumDeclarations = let unionCasesR = unionCases |> List.map (TcUnionCaseDecl cenv env parent thisTy thisTyInst tpenv hasRQAAttribute) unionCasesR |> CheckDuplicates (fun uc -> uc.Id) "union case" - let TcEnumDecl cenv env parent thisTy fieldTy (SynEnumCase(attributes=Attributes synAttrs; ident= SynIdent(id,_); value=v; xmlDoc=xmldoc; range=m)) = + let TcEnumCaseConstDecl cenv env parent attrs thisTy caseRange (caseIdent: Ident) (xmldoc: PreXmlDoc) value = + let vis, _ = ComputeAccessAndCompPath env None caseRange None None parent + let vis = CombineReprAccess parent vis + if caseIdent.idText = "value__" then errorR(Error(FSComp.SR.tcNotValidEnumCaseName(), caseIdent.idRange)) + let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs + let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some []) + Construct.NewRecdField true (Some value) caseIdent false thisTy false false [] attrs xmlDoc vis false + + let TcEnumDecl cenv env tpenv parent thisTy fieldTy (SynEnumCase(attributes=Attributes synAttrs; ident= SynIdent(id,_); value=v; xmlDoc=xmldoc; range=m)) = let attrs = TcAttributes cenv env AttributeTargets.Field synAttrs - + match v with - | SynConst.Bytes _ - | SynConst.UInt16s _ - | SynConst.UserNum _ -> error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) - | _ -> + | SynExpr.Const (constant = SynConst.Bytes _ | SynConst.UInt16s _ | SynConst.UserNum _) -> + error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) + | SynExpr.Const (v, _) -> let v = TcConst cenv fieldTy m env v - let vis, _ = ComputeAccessAndCompPath env None m None None parent - let vis = CombineReprAccess parent vis - if id.idText = "value__" then errorR(Error(FSComp.SR.tcNotValidEnumCaseName(), id.idRange)) - let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs - let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some []) - Construct.NewRecdField true (Some v) id false thisTy false false [] attrs xmlDoc vis false - - let TcEnumDecls (cenv: cenv) env parent thisTy enumCases = + TcEnumCaseConstDecl cenv env parent attrs thisTy m id xmldoc v + | _ -> + if cenv.g.langVersion.SupportsFeature LanguageFeature.ArithmeticInLiterals then + let expr, _ = TcExpr cenv (MustEqual fieldTy) env tpenv v + + match EvalLiteralExprOrAttribArg cenv.g expr with + | Expr.Const (v, _, _) -> TcEnumCaseConstDecl cenv env parent attrs thisTy m id xmldoc v + | _ -> error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) + else + error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) + + let TcEnumDecls (cenv: cenv) env tpenv parent thisTy enumCases = let g = cenv.g let fieldTy = NewInferenceType g - let enumCases' = enumCases |> List.map (TcEnumDecl cenv env parent thisTy fieldTy) |> CheckDuplicates (fun f -> f.Id) "enum element" + let enumCases' = enumCases |> List.map (TcEnumDecl cenv env tpenv parent thisTy fieldTy) |> CheckDuplicates (fun f -> f.Id) "enum element" fieldTy, enumCases' //------------------------------------------------------------------------- @@ -3449,7 +3460,7 @@ module EstablishTypeDefinitionCores = repr, baseValOpt, safeInitInfo | SynTypeDefnSimpleRepr.Enum (decls, m) -> - let fieldTy, fields' = TcRecdUnionAndEnumDeclarations.TcEnumDecls cenv envinner innerParent thisTy decls + let fieldTy, fields' = TcRecdUnionAndEnumDeclarations.TcEnumDecls cenv envinner tpenv innerParent thisTy decls let kind = TFSharpEnum structLayoutAttributeCheck false noCLIMutableAttributeCheck() diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 30a864946a5..c3cf3c9d5f6 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -1197,8 +1197,7 @@ type SynEnumCase = | SynEnumCase of attributes: SynAttributes * ident: SynIdent * - value: SynConst * - valueRange: range * + value: SynExpr * xmlDoc: PreXmlDoc * range: range * trivia: SynEnumCaseTrivia diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index f878e5fa21f..93ac0e139db 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1349,8 +1349,7 @@ type SynEnumCase = | SynEnumCase of attributes: SynAttributes * ident: SynIdent * - value: SynConst * - valueRange: range * + value: SynExpr * xmlDoc: PreXmlDoc * range: range * trivia: SynEnumCaseTrivia diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index a18fb02fbb1..501613d0ac4 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2381,14 +2381,14 @@ attrUnionCaseDecl: let mDecl = unionRangeWithXmlDoc xmlDoc mDecl Choice2Of2 (SynUnionCase ( $1, $3, SynUnionCaseKind.FullType $5, xmlDoc, None, mDecl, trivia))) } - | opt_attributes opt_access unionCaseName EQUALS constant + | opt_attributes opt_access unionCaseName EQUALS atomicExpr { if Option.isSome $2 then errorR(Error(FSComp.SR.parsEnumFieldsCannotHaveVisibilityDeclarations(), rhs parseState 2)) let mEquals = rhs parseState 4 let mDecl = rhs2 parseState 1 5 (fun (xmlDoc, mBar) -> let trivia: SynEnumCaseTrivia = { BarRange = Some mBar; EqualsRange = mEquals } let mDecl = unionRangeWithXmlDoc xmlDoc mDecl - Choice1Of2 (SynEnumCase ( $1, $3, fst $5, snd $5, xmlDoc, mDecl, trivia))) } + Choice1Of2 (SynEnumCase ( $1, $3, fst $5, xmlDoc, mDecl, trivia))) } /* The name of a union case */ unionCaseName: @@ -2412,12 +2412,12 @@ firstUnionCaseDeclOfMany: let mDecl = (rhs parseState 1) |> unionRangeWithXmlDoc xmlDoc Choice2Of2 (SynUnionCase ( [], (SynIdent($1, None)), SynUnionCaseKind.Fields [], xmlDoc, None, mDecl, trivia)) } - | ident EQUALS constant opt_OBLOCKSEP + | ident EQUALS atomicExpr opt_OBLOCKSEP { let mEquals = rhs parseState 2 let trivia: SynEnumCaseTrivia = { BarRange = None; EqualsRange = mEquals } let xmlDoc = grabXmlDoc(parseState, [], 1) let mDecl = (rhs2 parseState 1 3) |> unionRangeWithXmlDoc xmlDoc - Choice1Of2 (SynEnumCase ([], SynIdent($1, None), fst $3, snd $3, xmlDoc, mDecl, trivia)) } + Choice1Of2 (SynEnumCase ([], SynIdent($1, None), fst $3, xmlDoc, mDecl, trivia)) } | firstUnionCaseDecl opt_OBLOCKSEP { $1 } @@ -2429,12 +2429,12 @@ firstUnionCaseDecl: let mDecl = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc Choice2Of2 (SynUnionCase ( [], SynIdent($1, None), SynUnionCaseKind.Fields $3, xmlDoc, None, mDecl, trivia)) } - | ident EQUALS constant opt_OBLOCKSEP + | ident EQUALS atomicExpr opt_OBLOCKSEP { let mEquals = rhs parseState 2 let trivia: SynEnumCaseTrivia = { BarRange = None; EqualsRange = mEquals } let xmlDoc = grabXmlDoc(parseState, [], 1) let mDecl = rhs2 parseState 1 3 |> unionRangeWithXmlDoc xmlDoc - Choice1Of2 (SynEnumCase ([], SynIdent($1, None), fst $3, snd $3, xmlDoc, mDecl, trivia)) } + Choice1Of2 (SynEnumCase ([], SynIdent($1, None), fst $3, xmlDoc, mDecl, trivia)) } unionCaseReprElements: | unionCaseReprElement STAR unionCaseReprElements diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs new file mode 100644 index 00000000000..e8f1b99c611 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.ComponentTests.EmittedIL + +open Xunit +open FSharp.Test.Compiler + +module Enums = + + [] + let ``Arithmetic in enum definition works``() = + FSharp """ +module Enums + +let [] one = 1 + +type Flags = + | A = 1 + | B = (one <<< 1) + | C = (one <<< (one * 2)) + """ + |> withLangVersionPreview + |> compile + |> shouldSucceed + |> verifyIL [ + """.field public static literal valuetype Enums/Flags A = int32(0x00000001)""" + """.field public static literal valuetype Enums/Flags B = int32(0x00000002)""" + """.field public static literal valuetype Enums/Flags C = int32(0x00000004)""" + ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 7627368cc57..f1bcb43a3b6 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -101,6 +101,7 @@ + diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected index 65f6aa81b24..7339ffa31fb 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -2162,8 +2162,8 @@ FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsFromDispatchSlotImplemen FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsFromOpenStatement FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsFromPattern FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsFromType -FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsPrivateToFile FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsFromUse +FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean IsPrivateToFile FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsFromAttribute() FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsFromComputationExpression() FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsFromDefinition() @@ -2171,8 +2171,8 @@ FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsFromDispatchSlotImpl FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsFromOpenStatement() FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsFromPattern() FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsFromType() -FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsPrivateToFile() FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsFromUse() +FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: Boolean get_IsPrivateToFile() FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: FSharp.Compiler.Symbols.FSharpDisplayContext DisplayContext FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: FSharp.Compiler.Symbols.FSharpDisplayContext get_DisplayContext() FSharp.Compiler.CodeAnalysis.FSharpSymbolUse: FSharp.Compiler.Symbols.FSharpSymbol Symbol @@ -5170,10 +5170,10 @@ FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpGenericParamet FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpGenericParameter get_GenericParameter() FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpParameter Prettify(FSharp.Compiler.Symbols.FSharpParameter) FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpType AbbreviatedType +FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpType ErasedType FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpType Instantiate(Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.Symbols.FSharpGenericParameter,FSharp.Compiler.Symbols.FSharpType]]) FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpType Prettify(FSharp.Compiler.Symbols.FSharpType) FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpType StripAbbreviations() -FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpType ErasedType FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpType get_AbbreviatedType() FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Symbols.FSharpType get_ErasedType() FSharp.Compiler.Symbols.FSharpType: FSharp.Compiler.Text.TaggedText[] FormatLayout(FSharp.Compiler.Symbols.FSharpDisplayContext) @@ -6232,9 +6232,9 @@ FSharp.Compiler.Syntax.SynConst: Int32 Tag FSharp.Compiler.Syntax.SynConst: Int32 get_Tag() FSharp.Compiler.Syntax.SynConst: System.String ToString() FSharp.Compiler.Syntax.SynEnumCase -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynConst get_value() -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynConst value -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynEnumCase NewSynEnumCase(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynConst, FSharp.Compiler.Text.Range, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia) +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynEnumCase NewSynEnumCase(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia) +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr get_value() +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr value FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynIdent get_ident() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynIdent ident FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia get_trivia() @@ -6242,9 +6242,7 @@ FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.SyntaxTrivia.SynEnumCaseTriv FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range get_range() -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range get_valueRange() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range valueRange FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Xml.PreXmlDoc get_xmlDoc() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Xml.PreXmlDoc xmlDoc FSharp.Compiler.Syntax.SynEnumCase: Int32 Tag diff --git a/tests/service/SyntaxTreeTests/TypeTests.fs b/tests/service/SyntaxTreeTests/TypeTests.fs index 22df4ec8806..5f30de934f4 100644 --- a/tests/service/SyntaxTreeTests/TypeTests.fs +++ b/tests/service/SyntaxTreeTests/TypeTests.fs @@ -17,9 +17,9 @@ type Foo = One = 0x00000001 | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ SynModuleDecl.Types(typeDefns = [ SynTypeDefn.SynTypeDefn(typeRepr = - SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.Enum(cases = [ SynEnumCase.SynEnumCase(valueRange = r) ])))]) + SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.Enum(cases = [ SynEnumCase.SynEnumCase(value = e) ])))]) ]) ])) -> - assertRange (2, 17) (2, 27) r + assertRange (2, 17) (2, 27) e.Range | _ -> Assert.Fail "Could not get valid AST" [] @@ -36,11 +36,11 @@ type Foo = | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ SynModuleDecl.Types(typeDefns = [ SynTypeDefn.SynTypeDefn(typeRepr = - SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.Enum(cases = [ SynEnumCase.SynEnumCase(valueRange = r1) - SynEnumCase.SynEnumCase(valueRange = r2) ])))]) + SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.Enum(cases = [ SynEnumCase.SynEnumCase(value = e1) + SynEnumCase.SynEnumCase(value = e2) ])))]) ]) ])) -> - assertRange (3, 13) (3, 23) r1 - assertRange (4, 12) (4, 13) r2 + assertRange (3, 13) (3, 23) e1.Range + assertRange (4, 12) (4, 13) e2.Range | _ -> Assert.Fail "Could not get valid AST" [] diff --git a/tests/service/TreeVisitorTests.fs b/tests/service/TreeVisitorTests.fs index 9bcfa47796a..0d41abd3c1e 100644 --- a/tests/service/TreeVisitorTests.fs +++ b/tests/service/TreeVisitorTests.fs @@ -57,5 +57,5 @@ let ``Visit enum definition test`` () = let parseTree = parseSourceCode("C:\\test.fs", source) match SyntaxTraversal.Traverse(pos0, parseTree, visitor) with - | Some [ SynEnumCase (_, SynIdent(id1,_), _, _, _, _, _); SynEnumCase (_, SynIdent(id2,_), _, _, _, _, _) ] when id1.idText = "A" && id2.idText = "B" -> () + | Some [ SynEnumCase (_, SynIdent(id1,_), _, _, _, _); SynEnumCase (_, SynIdent(id2,_), _, _, _, _) ] when id1.idText = "A" && id2.idText = "B" -> () | _ -> failwith "Did not visit enum definition" \ No newline at end of file From 67560dec3fcc78c83c0588eb771f325f0889997d Mon Sep 17 00:00:00 2001 From: kerams Date: Fri, 9 Dec 2022 23:47:23 +0100 Subject: [PATCH 2/6] Fix enum case checking --- src/Compiler/Checking/CheckDeclarations.fs | 5 ++-- .../EmittedIL/Enums.fs | 26 ++++++++++++++++++- .../EnumTypes/E_BoolUnderlyingType.fs | 2 +- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 19b08ce4e2a..fbd355359a2 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -582,7 +582,8 @@ module TcRecdUnionAndEnumDeclarations = TcEnumCaseConstDecl cenv env parent attrs thisTy m id xmldoc v | _ -> if cenv.g.langVersion.SupportsFeature LanguageFeature.ArithmeticInLiterals then - let expr, _ = TcExpr cenv (MustEqual fieldTy) env tpenv v + let expr, actualTy, _ = TcExprOfUnknownType cenv env tpenv v + UnifyTypes cenv env m fieldTy actualTy match EvalLiteralExprOrAttribArg cenv.g expr with | Expr.Const (v, _, _) -> TcEnumCaseConstDecl cenv env parent attrs thisTy m id xmldoc v @@ -3469,7 +3470,7 @@ module EstablishTypeDefinitionCores = let vid = ident("value__", m) let vfld = Construct.NewRecdField false None vid false fieldTy false false [] [] XmlDoc.Empty taccessPublic true - let legitEnumTypes = [ g.int32_ty; g.int16_ty; g.sbyte_ty; g.int64_ty; g.char_ty; g.bool_ty; g.uint32_ty; g.uint16_ty; g.byte_ty; g.uint64_ty ] + let legitEnumTypes = [ g.int32_ty; g.int16_ty; g.sbyte_ty; g.int64_ty; g.char_ty; g.uint32_ty; g.uint16_ty; g.byte_ty; g.uint64_ty ] if not (ListSet.contains (typeEquiv g) fieldTy legitEnumTypes) then errorR(Error(FSComp.SR.tcInvalidTypeForLiteralEnumeration(), m)) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs index e8f1b99c611..a0928eda38b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs @@ -26,4 +26,28 @@ type Flags = """.field public static literal valuetype Enums/Flags A = int32(0x00000001)""" """.field public static literal valuetype Enums/Flags B = int32(0x00000002)""" """.field public static literal valuetype Enums/Flags C = int32(0x00000004)""" - ] \ No newline at end of file + ] + + [] + let ``Enum with inconsistent case types errors with the right message``() = + FSharp """ +module Enums + +type E = + | A = (1L <<< 0) + | B = (1 <<< 1) + """ + |> withLangVersionPreview + |> compile + |> shouldFail + |> withResult { + Error = Error 1 + Range = { StartLine = 6 + StartColumn = 7 + EndLine = 6 + EndColumn = 20 } + Message = "This expression was expected to have type + 'int64' +but here has type + 'int' " + } \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_BoolUnderlyingType.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_BoolUnderlyingType.fs index 3ac06c6252b..72ca7f38a43 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_BoolUnderlyingType.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_BoolUnderlyingType.fs @@ -3,7 +3,7 @@ // Test errors related to enums of invalid primitive/built-in types -//Unexpected keyword 'true' in union case +//Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char type EnumOfBool = | A = true From 20f263d088228fdfce9d06073243c68dd8f26d34 Mon Sep 17 00:00:00 2001 From: kerams Date: Sat, 10 Dec 2022 11:52:23 +0100 Subject: [PATCH 3/6] Refactor --- src/Compiler/Checking/CheckDeclarations.fs | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index fbd355359a2..22e54c2d46b 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -563,7 +563,7 @@ module TcRecdUnionAndEnumDeclarations = let unionCasesR = unionCases |> List.map (TcUnionCaseDecl cenv env parent thisTy thisTyInst tpenv hasRQAAttribute) unionCasesR |> CheckDuplicates (fun uc -> uc.Id) "union case" - let TcEnumCaseConstDecl cenv env parent attrs thisTy caseRange (caseIdent: Ident) (xmldoc: PreXmlDoc) value = + let MakeEnumCaseSpec cenv env parent attrs thisTy caseRange (caseIdent: Ident) (xmldoc: PreXmlDoc) value = let vis, _ = ComputeAccessAndCompPath env None caseRange None None parent let vis = CombineReprAccess parent vis if caseIdent.idText = "value__" then errorR(Error(FSComp.SR.tcNotValidEnumCaseName(), caseIdent.idRange)) @@ -571,25 +571,24 @@ module TcRecdUnionAndEnumDeclarations = let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some []) Construct.NewRecdField true (Some value) caseIdent false thisTy false false [] attrs xmlDoc vis false - let TcEnumDecl cenv env tpenv parent thisTy fieldTy (SynEnumCase(attributes=Attributes synAttrs; ident= SynIdent(id,_); value=v; xmlDoc=xmldoc; range=m)) = + let TcEnumDecl cenv env tpenv parent thisTy fieldTy (SynEnumCase (attributes = Attributes synAttrs; ident = SynIdent (id, _); value = v; xmlDoc = xmldoc; range = m)) = let attrs = TcAttributes cenv env AttributeTargets.Field synAttrs - match v with + match v with | SynExpr.Const (constant = SynConst.Bytes _ | SynConst.UInt16s _ | SynConst.UserNum _) -> error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) | SynExpr.Const (v, _) -> let v = TcConst cenv fieldTy m env v - TcEnumCaseConstDecl cenv env parent attrs thisTy m id xmldoc v + MakeEnumCaseSpec cenv env parent attrs thisTy m id xmldoc v + | _ when cenv.g.langVersion.SupportsFeature LanguageFeature.ArithmeticInLiterals -> + let expr, actualTy, _ = TcExprOfUnknownType cenv env tpenv v + UnifyTypes cenv env m fieldTy actualTy + + match EvalLiteralExprOrAttribArg cenv.g expr with + | Expr.Const (v, _, _) -> MakeEnumCaseSpec cenv env parent attrs thisTy m id xmldoc v + | _ -> error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) | _ -> - if cenv.g.langVersion.SupportsFeature LanguageFeature.ArithmeticInLiterals then - let expr, actualTy, _ = TcExprOfUnknownType cenv env tpenv v - UnifyTypes cenv env m fieldTy actualTy - - match EvalLiteralExprOrAttribArg cenv.g expr with - | Expr.Const (v, _, _) -> TcEnumCaseConstDecl cenv env parent attrs thisTy m id xmldoc v - | _ -> error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) - else - error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) + error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) let TcEnumDecls (cenv: cenv) env tpenv parent thisTy enumCases = let g = cenv.g From cb25a74d3e8c064f85307dc610d1ad95ce3f195b Mon Sep 17 00:00:00 2001 From: kerams Date: Mon, 12 Dec 2022 12:55:17 +0100 Subject: [PATCH 4/6] Fix up error ranges, address comments --- src/Compiler/Checking/CheckDeclarations.fs | 23 ++++++++++--------- src/Compiler/SyntaxTree/SyntaxTree.fs | 2 +- src/Compiler/SyntaxTree/SyntaxTree.fsi | 2 +- .../EmittedIL/Enums.fs | 2 +- ...erService.SurfaceArea.netstandard.expected | 4 ++-- tests/service/SyntaxTreeTests/TypeTests.fs | 6 ++--- tests/service/TreeVisitorTests.fs | 2 +- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 22e54c2d46b..c9169ae6440 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -571,24 +571,25 @@ module TcRecdUnionAndEnumDeclarations = let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some []) Construct.NewRecdField true (Some value) caseIdent false thisTy false false [] attrs xmlDoc vis false - let TcEnumDecl cenv env tpenv parent thisTy fieldTy (SynEnumCase (attributes = Attributes synAttrs; ident = SynIdent (id, _); value = v; xmlDoc = xmldoc; range = m)) = + let TcEnumDecl cenv env tpenv parent thisTy fieldTy (SynEnumCase (attributes = Attributes synAttrs; ident = SynIdent (id, _); valueExpr = valueExpr; xmlDoc = xmldoc; range = caseRange)) = let attrs = TcAttributes cenv env AttributeTargets.Field synAttrs + let valueRange = valueExpr.Range - match v with + match valueExpr with | SynExpr.Const (constant = SynConst.Bytes _ | SynConst.UInt16s _ | SynConst.UserNum _) -> - error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) - | SynExpr.Const (v, _) -> - let v = TcConst cenv fieldTy m env v - MakeEnumCaseSpec cenv env parent attrs thisTy m id xmldoc v + error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), valueRange)) + | SynExpr.Const (synConst, _) -> + let konst = TcConst cenv fieldTy valueRange env synConst + MakeEnumCaseSpec cenv env parent attrs thisTy caseRange id xmldoc konst | _ when cenv.g.langVersion.SupportsFeature LanguageFeature.ArithmeticInLiterals -> - let expr, actualTy, _ = TcExprOfUnknownType cenv env tpenv v - UnifyTypes cenv env m fieldTy actualTy + let expr, actualTy, _ = TcExprOfUnknownType cenv env tpenv valueExpr + UnifyTypes cenv env valueRange fieldTy actualTy match EvalLiteralExprOrAttribArg cenv.g expr with - | Expr.Const (v, _, _) -> MakeEnumCaseSpec cenv env parent attrs thisTy m id xmldoc v - | _ -> error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) + | Expr.Const (konst, _, _) -> MakeEnumCaseSpec cenv env parent attrs thisTy caseRange id xmldoc konst + | _ -> error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), valueRange)) | _ -> - error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), m)) + error(Error(FSComp.SR.tcInvalidEnumerationLiteral(), valueRange)) let TcEnumDecls (cenv: cenv) env tpenv parent thisTy enumCases = let g = cenv.g diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index c3cf3c9d5f6..aa5535914d5 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -1197,7 +1197,7 @@ type SynEnumCase = | SynEnumCase of attributes: SynAttributes * ident: SynIdent * - value: SynExpr * + valueExpr: SynExpr * xmlDoc: PreXmlDoc * range: range * trivia: SynEnumCaseTrivia diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index 93ac0e139db..5542bf5f584 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -1349,7 +1349,7 @@ type SynEnumCase = | SynEnumCase of attributes: SynAttributes * ident: SynIdent * - value: SynExpr * + valueExpr: SynExpr * xmlDoc: PreXmlDoc * range: range * trivia: SynEnumCaseTrivia diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs index a0928eda38b..33217909d2a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Enums.fs @@ -43,7 +43,7 @@ type E = |> withResult { Error = Error 1 Range = { StartLine = 6 - StartColumn = 7 + StartColumn = 11 EndLine = 6 EndColumn = 20 } Message = "This expression was expected to have type diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected index 7339ffa31fb..06f7395ff5b 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected @@ -6233,8 +6233,8 @@ FSharp.Compiler.Syntax.SynConst: Int32 get_Tag() FSharp.Compiler.Syntax.SynConst: System.String ToString() FSharp.Compiler.Syntax.SynEnumCase FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynEnumCase NewSynEnumCase(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia) -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr get_value() -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr value +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr get_valueExpr() +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr valueExpr FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynIdent get_ident() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynIdent ident FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia get_trivia() diff --git a/tests/service/SyntaxTreeTests/TypeTests.fs b/tests/service/SyntaxTreeTests/TypeTests.fs index 5f30de934f4..37fe10678fc 100644 --- a/tests/service/SyntaxTreeTests/TypeTests.fs +++ b/tests/service/SyntaxTreeTests/TypeTests.fs @@ -17,7 +17,7 @@ type Foo = One = 0x00000001 | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ SynModuleDecl.Types(typeDefns = [ SynTypeDefn.SynTypeDefn(typeRepr = - SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.Enum(cases = [ SynEnumCase.SynEnumCase(value = e) ])))]) + SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.Enum(cases = [ SynEnumCase.SynEnumCase(valueExpr = e) ])))]) ]) ])) -> assertRange (2, 17) (2, 27) e.Range | _ -> Assert.Fail "Could not get valid AST" @@ -36,8 +36,8 @@ type Foo = | ParsedInput.ImplFile (ParsedImplFileInput (contents = [ SynModuleOrNamespace.SynModuleOrNamespace(decls = [ SynModuleDecl.Types(typeDefns = [ SynTypeDefn.SynTypeDefn(typeRepr = - SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.Enum(cases = [ SynEnumCase.SynEnumCase(value = e1) - SynEnumCase.SynEnumCase(value = e2) ])))]) + SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.Enum(cases = [ SynEnumCase.SynEnumCase(valueExpr = e1) + SynEnumCase.SynEnumCase(valueExpr = e2) ])))]) ]) ])) -> assertRange (3, 13) (3, 23) e1.Range assertRange (4, 12) (4, 13) e2.Range diff --git a/tests/service/TreeVisitorTests.fs b/tests/service/TreeVisitorTests.fs index 0d41abd3c1e..534f487a48f 100644 --- a/tests/service/TreeVisitorTests.fs +++ b/tests/service/TreeVisitorTests.fs @@ -57,5 +57,5 @@ let ``Visit enum definition test`` () = let parseTree = parseSourceCode("C:\\test.fs", source) match SyntaxTraversal.Traverse(pos0, parseTree, visitor) with - | Some [ SynEnumCase (_, SynIdent(id1,_), _, _, _, _); SynEnumCase (_, SynIdent(id2,_), _, _, _, _) ] when id1.idText = "A" && id2.idText = "B" -> () + | Some [ SynEnumCase (ident = SynIdent (id1, _)); SynEnumCase (ident = SynIdent (id2, _)) ] when id1.idText = "A" && id2.idText = "B" -> () | _ -> failwith "Did not visit enum definition" \ No newline at end of file From 2c6d666e258bf85f5cc3cc8a76445f7f5c6f39bb Mon Sep 17 00:00:00 2001 From: kerams Date: Mon, 12 Dec 2022 13:53:30 +0100 Subject: [PATCH 5/6] Fix fsharpqa tests --- .../EnumTypes/E_DiscrimnantOfDifferentTypes.fs | 2 +- .../EnumTypes/E_NonInt32Enums01.fs | 4 ++-- .../Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_DiscrimnantOfDifferentTypes.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_DiscrimnantOfDifferentTypes.fs index 5b5f674afeb..4d4220df500 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_DiscrimnantOfDifferentTypes.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_DiscrimnantOfDifferentTypes.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #ObjectOrientedTypes #Enums // Verify that you cannot mix underlying types -//This expression was expected to have type. 'int' .but here has type. 'int64' +//This expression was expected to have type. 'int' .but here has type. 'int64' type EnumType = | D = 3 diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NonInt32Enums01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NonInt32Enums01.fs index a2633f7bafb..1fe862f08c0 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NonInt32Enums01.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/EnumTypes/E_NonInt32Enums01.fs @@ -4,8 +4,8 @@ //Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char -//This is not a valid value for an enumeration literal -//This is not a valid value for an enumeration literal +//This is not a valid value for an enumeration literal +//This is not a valid value for an enumeration literal //Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char //Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char //Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char diff --git a/tests/fsharpqa/Source/Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs b/tests/fsharpqa/Source/Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs index 19e941aa0d8..4de07d35eb2 100644 --- a/tests/fsharpqa/Source/Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs +++ b/tests/fsharpqa/Source/Diagnostics/General/E_LiteralEnumerationMustHaveType01.fs @@ -1,8 +1,8 @@ // #Regression #Diagnostics // Regression test for FSHARP1.0:1729 // Notice that the bug was in the IDE, but a compiler test is equally useful. -//This is not a valid value for an enumeration literal -//This is not a valid value for an enumeration literal +//This is not a valid value for an enumeration literal +//This is not a valid value for an enumeration literal #light // Shouldn't work From fb90e2487708d950544c7b9d1e1c806407c109fc Mon Sep 17 00:00:00 2001 From: kerams Date: Sat, 21 Jan 2023 11:13:46 +0100 Subject: [PATCH 6/6] Fix merge conflicts --- ...p.Compiler.Service.SurfaceArea.netstandard20.debug.bsl | 6 +++--- ...Compiler.Service.SurfaceArea.netstandard20.release.bsl | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index cf887236198..60bee303ae7 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -6067,9 +6067,9 @@ FSharp.Compiler.Syntax.SynConst: FSharp.Compiler.Text.Range Range(FSharp.Compile FSharp.Compiler.Syntax.SynConst: Int32 Tag FSharp.Compiler.Syntax.SynConst: Int32 get_Tag() FSharp.Compiler.Syntax.SynConst: System.String ToString() -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynConst get_value() -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynConst value -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynEnumCase NewSynEnumCase(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynConst, FSharp.Compiler.Text.Range, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia) +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynEnumCase NewSynEnumCase(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia) +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr get_valueExpr() +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr valueExpr FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynIdent get_ident() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynIdent ident FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia get_trivia() diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index a968aad5932..60bee303ae7 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -6067,9 +6067,9 @@ FSharp.Compiler.Syntax.SynConst: FSharp.Compiler.Text.Range Range(FSharp.Compile FSharp.Compiler.Syntax.SynConst: Int32 Tag FSharp.Compiler.Syntax.SynConst: Int32 get_Tag() FSharp.Compiler.Syntax.SynConst: System.String ToString() -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynConst get_value() -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynConst value -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynEnumCase NewSynEnumCase(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynConst, FSharp.Compiler.Text.Range, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia) +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynEnumCase NewSynEnumCase(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynAttributeList], FSharp.Compiler.Syntax.SynIdent, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Xml.PreXmlDoc, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia) +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr get_valueExpr() +FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynExpr valueExpr FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynIdent get_ident() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Syntax.SynIdent ident FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.SyntaxTrivia.SynEnumCaseTrivia get_trivia() @@ -6077,9 +6077,7 @@ FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.SyntaxTrivia.SynEnumCaseTriv FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range Range FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range get_Range() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range get_range() -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range get_valueRange() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range range -FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Text.Range valueRange FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Xml.PreXmlDoc get_xmlDoc() FSharp.Compiler.Syntax.SynEnumCase: FSharp.Compiler.Xml.PreXmlDoc xmlDoc FSharp.Compiler.Syntax.SynEnumCase: Int32 Tag