diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index bbd5183842..e0a5bb576a 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -4629,7 +4629,7 @@ let rec encodeCustomAttrElemTypeForObject x = | ILAttribElem.UInt64 _ -> [| et_U8 |] | ILAttribElem.Type _ -> [| 0x50uy |] | ILAttribElem.TypeRef _ -> [| 0x50uy |] - | ILAttribElem.Null _ -> [| et_STRING |] // yes, the 0xe prefix is used when passing a "null" to a property or argument of type "object" here + | ILAttribElem.Null -> [| et_STRING |] // yes, the 0xe prefix is used when passing a "null" to a property or argument of type "object" here | ILAttribElem.Single _ -> [| et_R4 |] | ILAttribElem.Double _ -> [| et_R8 |] | ILAttribElem.Array (elemTy, _) -> [| yield et_SZARRAY; yield! encodeCustomAttrElemType elemTy |] diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 1b30f20529..0fc3e73e24 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -505,7 +505,7 @@ let convTypeRefAux (cenv: cenv) (tref: ILTypeRef) = match tref.Scope with | ILScopeRef.Assembly asmref -> convResolveAssemblyRef cenv asmref qualifiedName | ILScopeRef.Module _ - | ILScopeRef.Local _ -> + | ILScopeRef.Local -> let typT = Type.GetType qualifiedName match typT with diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index bd675aba27..9e21c43427 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -9905,7 +9905,7 @@ and TcMethodArg cenv env (lambdaPropagationInfo, tpenv) (lambdaPropagationInfoFo let lambdaPropagationInfo = [| for info, argInfo in Array.zip lambdaPropagationInfo lambdaPropagationInfoForArg do match argInfo with - | ArgDoesNotMatch _ -> () + | ArgDoesNotMatch -> () | NoInfo | CallerLambdaHasArgTypes _ -> yield info | CalledArgMatchesType (adjustedCalledArgTy, noEagerConstraintApplication) -> diff --git a/src/Compiler/Checking/CheckPatterns.fs b/src/Compiler/Checking/CheckPatterns.fs index 70382723f9..87b0678b69 100644 --- a/src/Compiler/Checking/CheckPatterns.fs +++ b/src/Compiler/Checking/CheckPatterns.fs @@ -604,7 +604,15 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m let args, extraPatternsFromNames = match args with - | SynArgPats.Pats args -> args, [] + | SynArgPats.Pats args -> + if g.langVersion.SupportsFeature(LanguageFeature.MatchNotAllowedForUnionCaseWithNoData) then + match args with + | [ SynPat.Wild _ ] | [ SynPat.Named _ ] when argNames.IsEmpty -> + warning(Error(FSComp.SR.matchNotAllowedForUnionCaseWithNoData(), m)) + args, [] + | _ -> args, [] + else + args, [] | SynArgPats.NamePatPairs (pairs, m, _) -> // rewrite patterns from the form (name-N = pat-N; ...) to (..._, pat-N, _...) // so type T = Case of name: int * value: int @@ -661,10 +669,12 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m // note: we allow both 'C _' and 'C (_)' regardless of number of argument of the pattern | [SynPatErrorSkip(SynPat.Wild _ as e) | SynPatErrorSkip(SynPat.Paren(SynPatErrorSkip(SynPat.Wild _ as e), _))] -> List.replicate numArgTys e, [] - | args when numArgTys = 0 -> - errorR (Error (FSComp.SR.tcUnionCaseDoesNotTakeArguments (), m)) - [], args + if g.langVersion.SupportsFeature(LanguageFeature.MatchNotAllowedForUnionCaseWithNoData) then + [], args + else + errorR (Error (FSComp.SR.tcUnionCaseDoesNotTakeArguments (), m)) + [], args | arg :: rest when numArgTys = 1 -> if numArgTys = 1 && not (List.isEmpty rest) then diff --git a/src/Compiler/Checking/PatternMatchCompilation.fs b/src/Compiler/Checking/PatternMatchCompilation.fs index 2c53c73202..8d59e3301d 100644 --- a/src/Compiler/Checking/PatternMatchCompilation.fs +++ b/src/Compiler/Checking/PatternMatchCompilation.fs @@ -648,9 +648,9 @@ let isDiscrimSubsumedBy g amap m discrim taken = match taken, discrim with | DecisionTreeTest.IsInst (_, tgtTy1), DecisionTreeTest.IsInst (_, tgtTy2) -> computeWhatFailingTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 = Implication.Fails - | DecisionTreeTest.IsNull _, DecisionTreeTest.IsInst (_, tgtTy2) -> + | DecisionTreeTest.IsNull, DecisionTreeTest.IsInst (_, tgtTy2) -> computeWhatFailingNullTestImpliesAboutTypeTest g tgtTy2 = Implication.Fails - | DecisionTreeTest.IsInst (_, tgtTy1), DecisionTreeTest.IsNull _ -> + | DecisionTreeTest.IsInst (_, tgtTy1), DecisionTreeTest.IsNull -> computeWhatFailingTypeTestImpliesAboutNullTest g tgtTy1 = Implication.Fails | _ -> false @@ -690,7 +690,7 @@ let discrimWithinSimultaneousClass g amap m discrim prev = // Check that each previous test in the set, if successful, gives some information about this test prev |> List.forall (fun edge -> match edge with - | DecisionTreeTest.IsNull _ -> true + | DecisionTreeTest.IsNull -> true | DecisionTreeTest.IsInst (_, tgtTy1) -> computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy1 <> Implication.Nothing | _ -> false) @@ -698,7 +698,7 @@ let discrimWithinSimultaneousClass g amap m discrim prev = // Check that each previous test in the set, if successful, gives some information about this test prev |> List.forall (fun edge -> match edge with - | DecisionTreeTest.IsNull _ -> true + | DecisionTreeTest.IsNull -> true | DecisionTreeTest.IsInst (_, tgtTy1) -> computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 <> Implication.Nothing | _ -> false) @@ -1501,7 +1501,7 @@ let CompilePatternBasic // F# exception definitions are sealed. [] - | DecisionTreeTest.IsNull _ -> + | DecisionTreeTest.IsNull -> match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy1 with | Implication.Succeeds -> [Frontier (i, newActives, valMap)] | Implication.Fails -> [] @@ -1537,7 +1537,7 @@ let CompilePatternBasic | Implication.Nothing -> [frontier] - | DecisionTreeTest.IsNull _ -> + | DecisionTreeTest.IsNull -> match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy1 with | Implication.Succeeds -> [Frontier (i, newActives, valMap)] | Implication.Fails -> [] diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index b4d9acf83f..9338abd28f 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -685,7 +685,7 @@ let CheckTypeInstNoInnerByrefs cenv env m tyargs = /// Applied functions get wrapped in coerce nodes for subsumption coercions let (|OptionalCoerce|) expr = match stripDebugPoints expr with - | Expr.Op (TOp.Coerce _, _, [DebugPoints(Expr.App (f, _, _, [], _), _)], _) -> f + | Expr.Op (TOp.Coerce, _, [DebugPoints(Expr.App (f, _, _, [], _), _)], _) -> f | _ -> expr /// Check an expression doesn't contain a 'reraise' @@ -1539,7 +1539,7 @@ and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr = else { scope = 1; flags = LimitFlags.None } - | TOp.LValueOp (LSet _, vref), _, [arg] -> + | TOp.LValueOp (LSet, vref), _, [arg] -> let isVrefLimited = not (HasLimitFlag LimitFlags.StackReferringSpanLike (GetLimitVal cenv env m vref.Deref)) let isArgLimited = HasLimitFlag LimitFlags.StackReferringSpanLike (CheckExprPermitByRefLike cenv env arg) if isVrefLimited && isArgLimited then @@ -1901,7 +1901,7 @@ and CheckAttribArgExpr cenv env expr = | Const.Double _ | Const.Single _ | Const.Char _ - | Const.Zero _ + | Const.Zero | Const.String _ -> () | _ -> if cenv.reportErrors then diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 829b7e03d2..382a66e387 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -4150,7 +4150,7 @@ and GenApp (cenv: cenv) cgbuf eenv (f, fty, tyargs, curriedArgs, m) sequel = | Expr.Val (v, _, m), _, [ arg ] when valRefEq g v g.methodhandleof_vref -> let (|OptionalCoerce|) x = match stripDebugPoints x with - | Expr.Op (TOp.Coerce _, _, [ arg ], _) -> arg + | Expr.Op (TOp.Coerce, _, [ arg ], _) -> arg | x -> x let (|OptionalTyapp|) x = @@ -4695,7 +4695,7 @@ and eligibleForFilter (cenv: cenv) expr = | Expr.Op (TOp.UnionCaseFieldGet _, _, _, _) -> true | Expr.Op (TOp.ValFieldGet _, _, _, _) -> true | Expr.Op (TOp.TupleFieldGet _, _, _, _) -> true - | Expr.Op (TOp.Coerce _, _, _, _) -> true + | Expr.Op (TOp.Coerce, _, _, _) -> true | Expr.Val _ -> true | _ -> false @@ -7587,7 +7587,7 @@ and GenDecisionTreeSwitch // Use GenDecisionTreeTest to generate a single test for null (when no box required) where the success // is going to the immediate first node in the tree - | TCase (DecisionTreeTest.IsNull _, (TDSuccess ([], 0) as successTree)) :: rest when + | TCase (DecisionTreeTest.IsNull, (TDSuccess ([], 0) as successTree)) :: rest when rest.Length = (match defaultTargetOpt with | None -> 1 | Some _ -> 0) diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index a2fd68372c..6314212327 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -240,6 +240,7 @@ type Exception with // 24 cannot be reused | PatternMatchCompilation.MatchIncomplete _ -> 25 | PatternMatchCompilation.RuleNeverMatched _ -> 26 + | ValNotMutable _ -> 27 | ValNotLocal _ -> 28 | MissingFields _ -> 29 @@ -1083,7 +1084,7 @@ type Exception with | Parser.TOKEN_BAR_RBRACK -> SR.GetString("Parser.TOKEN.BAR.RBRACK") | Parser.TOKEN_BAR_RBRACE -> SR.GetString("Parser.TOKEN.BAR.RBRACE") | Parser.TOKEN_GREATER_RBRACK -> SR.GetString("Parser.TOKEN.GREATER.RBRACK") - | Parser.TOKEN_RQUOTE_DOT _ + | Parser.TOKEN_RQUOTE_DOT | Parser.TOKEN_RQUOTE -> SR.GetString("Parser.TOKEN.RQUOTE") | Parser.TOKEN_RBRACK -> SR.GetString("Parser.TOKEN.RBRACK") | Parser.TOKEN_RBRACE @@ -1110,8 +1111,8 @@ type Exception with | Parser.TOKEN_OTHEN -> SR.GetString("Parser.TOKEN.OTHEN") | Parser.TOKEN_ELSE | Parser.TOKEN_OELSE -> SR.GetString("Parser.TOKEN.OELSE") - | Parser.TOKEN_LET _ - | Parser.TOKEN_OLET _ -> SR.GetString("Parser.TOKEN.OLET") + | Parser.TOKEN_LET + | Parser.TOKEN_OLET -> SR.GetString("Parser.TOKEN.OLET") | Parser.TOKEN_OBINDER | Parser.TOKEN_BINDER -> SR.GetString("Parser.TOKEN.BINDER") | Parser.TOKEN_OAND_BANG diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index a298af5490..80c356d31d 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1554,6 +1554,7 @@ featureSelfTypeConstraints,"self type constraints" featureRequiredProperties,"support for required properties" featureInitProperties,"support for consuming init properties" featureLowercaseDUWhenRequireQualifiedAccess,"Allow lowercase DU when RequireQualifiedAccess attribute" +featureMatchNotAllowedForUnionCaseWithNoData,"Pattern match discard is not allowed for union case that takes no data." 3353,fsiInvalidDirective,"Invalid directive '#%s %s'" 3354,tcNotAFunctionButIndexerNamedIndexingNotYetEnabled,"This value supports indexing, e.g. '%s.[index]'. The syntax '%s[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3354,tcNotAFunctionButIndexerIndexingNotYetEnabled,"This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." @@ -1654,3 +1655,4 @@ reprStateMachineInvalidForm,"The state machine has an unexpected form" 3545,tcMissingRequiredMembers,"The following required properties have to be initalized:%s" 3546,parsExpectingPatternInTuple,"Expecting pattern" 3547,parsExpectedPatternAfterToken,"Expected a pattern after this point" +3548,matchNotAllowedForUnionCaseWithNoData,"Pattern discard is not allowed for union case that takes no data." diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index 07bcca5787..8644fbe997 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -54,6 +54,7 @@ type LanguageFeature = | LowercaseDUWhenRequireQualifiedAccess | InterfacesWithAbstractStaticMembers | SelfTypeConstraints + | MatchNotAllowedForUnionCaseWithNoData /// LanguageVersion management type LanguageVersion(versionText) = @@ -124,6 +125,7 @@ type LanguageVersion(versionText) = // F# preview LanguageFeature.FromEndSlicing, previewVersion + LanguageFeature.MatchNotAllowedForUnionCaseWithNoData, previewVersion ] static let defaultLanguageVersion = LanguageVersion("default") @@ -230,6 +232,7 @@ type LanguageVersion(versionText) = | LanguageFeature.LowercaseDUWhenRequireQualifiedAccess -> FSComp.SR.featureLowercaseDUWhenRequireQualifiedAccess () | LanguageFeature.InterfacesWithAbstractStaticMembers -> FSComp.SR.featureInterfacesWithAbstractStaticMembers () | LanguageFeature.SelfTypeConstraints -> FSComp.SR.featureSelfTypeConstraints () + | LanguageFeature.MatchNotAllowedForUnionCaseWithNoData -> FSComp.SR.featureMatchNotAllowedForUnionCaseWithNoData () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index cb7991392c..694a6ae73f 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -44,6 +44,7 @@ type LanguageFeature = | LowercaseDUWhenRequireQualifiedAccess | InterfacesWithAbstractStaticMembers | SelfTypeConstraints + | MatchNotAllowedForUnionCaseWithNoData /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index f4ee6685a1..898f15d884 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -279,7 +279,7 @@ type ILMultiInMemoryAssemblyEmitEnv( | ILScopeRef.Assembly asmref -> convResolveAssemblyRef asmref qualifiedName | ILScopeRef.Module _ - | ILScopeRef.Local _ -> + | ILScopeRef.Local -> let typT = Type.GetType qualifiedName match typT with | null -> error(Error(FSComp.SR.itemNotFoundDuringDynamicCodeGen ("type", qualifiedName, ""), range0)) diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index fa96506920..54665570cc 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -1575,7 +1575,7 @@ let IsKnownOnlyMutableBeforeUse (vref: ValRef) = let IsDiscardableEffectExpr expr = match stripDebugPoints expr with - | Expr.Op (TOp.LValueOp (LByrefGet _, _), [], [], _) -> true + | Expr.Op (TOp.LValueOp (LByrefGet, _), [], [], _) -> true | _ -> false /// Checks is a value binding is non-discardable diff --git a/src/Compiler/Service/SemanticClassification.fs b/src/Compiler/Service/SemanticClassification.fs index 5da02e3209..03e9ce2f67 100644 --- a/src/Compiler/Service/SemanticClassification.fs +++ b/src/Compiler/Service/SemanticClassification.fs @@ -107,7 +107,7 @@ module TcResolutionsExtensions = | TFSharpInterface -> SemanticClassificationType.Interface | TFSharpStruct -> SemanticClassificationType.ValueType | TFSharpDelegate _ -> SemanticClassificationType.Delegate - | TFSharpEnum _ -> SemanticClassificationType.Enumeration + | TFSharpEnum -> SemanticClassificationType.Enumeration | TFSharpRecdRepr _ | TFSharpUnionRepr _ -> if isStructTyconRef g tcref then @@ -149,9 +149,9 @@ module TcResolutionsExtensions = match occ with | ItemOccurence.UseInType | ItemOccurence.UseInAttribute - | ItemOccurence.Use _ - | ItemOccurence.Binding _ - | ItemOccurence.Pattern _ + | ItemOccurence.Use + | ItemOccurence.Binding + | ItemOccurence.Pattern | ItemOccurence.Open -> Some() | _ -> None diff --git a/src/Compiler/Service/ServiceDeclarationLists.fs b/src/Compiler/Service/ServiceDeclarationLists.fs index 399a3037ea..06cf656b07 100644 --- a/src/Compiler/Service/ServiceDeclarationLists.fs +++ b/src/Compiler/Service/ServiceDeclarationLists.fs @@ -862,7 +862,7 @@ module internal DescriptionListsImpl = | TFSharpInterface -> FSharpGlyph.Interface | TFSharpStruct -> FSharpGlyph.Struct | TFSharpDelegate _ -> FSharpGlyph.Delegate - | TFSharpEnum _ -> FSharpGlyph.Enum + | TFSharpEnum -> FSharpGlyph.Enum | TFSharpRecdRepr _ -> FSharpGlyph.Type | TFSharpUnionRepr _ -> FSharpGlyph.Union | TILObjectRepr (TILObjectReprData (_, _, td)) -> diff --git a/src/Compiler/Symbols/Symbols.fs b/src/Compiler/Symbols/Symbols.fs index 9adb5ffb1f..4b8f8c4684 100644 --- a/src/Compiler/Symbols/Symbols.fs +++ b/src/Compiler/Symbols/Symbols.fs @@ -2383,7 +2383,7 @@ type FSharpType(cenv, ty:TType) = isResolved() && protect <| fun () -> match stripTyparEqns ty with - | TType_app _ | TType_measure (Measure.Const _ | Measure.Prod _ | Measure.Inv _ | Measure.One _) -> true + | TType_app _ | TType_measure (Measure.Const _ | Measure.Prod _ | Measure.Inv _ | Measure.One) -> true | _ -> false member _.IsTupleType = diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index c166230e71..f57954f7bf 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -6049,7 +6049,7 @@ and remapTyconRepr ctxt tmenv repr = let ctxt = st.Context.RemapTyconRefs(unbox >> remapTyconRef tmenv.tyconRefRemap >> box) ProvidedType.ApplyContext (st, ctxt)) } #endif - | TNoRepr _ -> repr + | TNoRepr -> repr | TAsmRepr _ -> repr | TMeasureableRepr x -> TMeasureableRepr (remapType tmenv x) @@ -9684,10 +9684,10 @@ let rec EvalAttribArgExpr g x = | Const.Double _ | Const.Single _ | Const.Char _ - | Const.Zero _ + | Const.Zero | Const.String _ -> x - | Const.Decimal _ | Const.IntPtr _ | Const.UIntPtr _ | Const.Unit _ -> + | Const.Decimal _ | Const.IntPtr _ | Const.UIntPtr _ | Const.Unit -> errorR (Error ( FSComp.SR.tastNotAConstantExpression(), m)) x diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 1d56df844c..cd3a34b921 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -212,6 +212,11 @@ Revize kompatibility ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Neplatný interpolovaný řetězec. V interpolovaných výrazech se nedají použít řetězcové literály s trojitými uvozovkami. Zvažte možnost použít pro interpolovaný výraz explicitní vazbu let. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Tento konstruktor je zastaralý. {0}. Tuto funkci můžete povolit pomocí parametrů --langversion:5.0 a --mlcompatibility. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 0756782570..01a5cade73 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -212,6 +212,11 @@ ML-Kompatibilitätsrevisionen + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Ungültige interpolierte Zeichenfolge. Zeichenfolgenliterale mit dreifachen Anführungszeichen dürfen in interpolierten Ausdrücken nicht verwendet werden. Erwägen Sie die Verwendung einer expliziten let-Bindung für den Interpolationsausdruck. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Dieses Konstrukt ist veraltet. {0}. Sie können dieses Feature mithilfe von „--langversion:5.0“ und „--mlcompatibility“ aktivieren. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index b627eaf231..81faedb0e9 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -212,6 +212,11 @@ Revisiones de compatibilidad de ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Cadena interpolada no válida. No se pueden usar literales de cadena de comillas triples en las expresiones interpoladas. Puede usar un enlace "let" explícito para la expresión de interpolación. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Esta construcción está en desuso. {0}. Puede habilitar esta característica usando '--langversion:5.0' y '--mlcompatibility'. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 8ff78e1d34..366890f756 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -212,6 +212,11 @@ Réviseurs de compatibilité ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Chaîne interpolée non valide. Les littéraux de chaîne à guillemets triples ne peuvent pas être utilisés dans des expressions interpolées. Utilisez une liaison 'let' explicite pour l'expression d'interpolation. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Cette construction est déconseillée. {0}. Vous pouvez activer cette fonctionnalité à l’aide de'--langversion : 5.0 'et'--mlcompatibility'. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 4f1344f084..b9922d1694 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -212,6 +212,11 @@ Revisioni della compatibilità di Ml + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ La stringa interpolata non è valida. Non è possibile usare valori letterali stringa tra virgolette triple in espressioni interpolate. Provare a usare un binding 'let' esplicito per l'espressione di interpolazione. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Questo costrutto è deprecato. {0}. È possibile abilitare questa funzionalità usando '--langversion:5.0' and '--mlcompatibility'. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 3be4cc8799..b711c9d9f3 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -212,6 +212,11 @@ ML 互換性のリビジョン + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ 補間された文字列が無効です。三重引用符文字列リテラルは、補間された式では使用できません。補間式に対して明示的な 'let' バインドを使用することをご検討ください。 + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. このコンストラクトは使用されなくなりました。{0}。'--langversion:5.0' と '--mlcompatibility' を使用することで、この機能を有効にすることができます。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 728c94688d..40d1b9c30b 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -212,6 +212,11 @@ ML 호환성 개정 + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ 잘못된 보간 문자열. 삼중 따옴표 문자열 리터럴은 보간 식에 사용할 수 없습니다. 보간 식에 명시적 'let' 바인딩을 사용해 보세요. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. 이 구성은 더 이상 사용되지 않습니다. {0}. '--langversion:5.0' 및 '--mlcompatibility'를 사용하여 이 기능을 활성화할 수 있습니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 284aef3e01..23d950d189 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -212,6 +212,11 @@ Poprawki dotyczące zgodności Machine Learning + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Nieprawidłowy ciąg interpolowany. Literały ciągów z potrójnymi cudzysłowami nie mogą być używane w wyrażeniach interpolowanych. Rozważ użycie jawnego powiązania „let” dla wyrażenia interpolacji. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Ta konstrukcja jest przestarzała. {0}. Tę funkcję można włączyć przy użyciu poleceń"--langversion:5.0" i "--mlcompatibility". diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index a5b2b95436..2a6eb368be 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -212,6 +212,11 @@ Revisões de compatibilidade de ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Cadeia de caracteres interpolada inválida. Literais de cadeia de caracteres de aspas triplas não podem ser usados em expressões interpoladas. Considere usar uma associação 'let' explícita para a expressão de interpolação. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Esta construção foi preterida. {0} Você pode habilitar este recurso usando '--langversion:5.0' e '--mlcompatibility'. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 545decc436..3b4cafe834 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -212,6 +212,11 @@ Редакции совместимости ML + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Недопустимая интерполированная строка. Строковые литералы с тройными кавычками запрещено использовать в интерполированных выражениях. Рекомендуется использовать явную привязку "let" для выражения интерполяции. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Эта конструкция не рекомендуется к использованию. {0}. Вы можете включить эту функцию с помощью команд "--langversion:5.0" и "--mlcompatibility". diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 1c0cfc9042..e0e4df0357 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -212,6 +212,11 @@ ML uyumluluk düzeltmeleri + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ Geçersiz düz metin arasına kod eklenmiş dize. Üç tırnaklı dize sabitleri, düz metin arasına kod eklenmiş ifadelerde kullanılamaz. Düz metin arasına kod ekleme ifadesi için açık bir 'let' bağlaması kullanmayı düşünün. + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. Bu yapı kullanım dışı. {0}. Bu özelliği '--langversion:5.0' ve '--mlcompatibility' kullanarak etkinleştirebilirsiniz. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index bf7eeca1f7..10dc4f098c 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -212,6 +212,11 @@ ML 兼容性修订 + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ 内插字符串无效。在内插表达式中不能使用三重引号字符串文字。请考虑对内插表达式使用显式的 "let" 绑定。 + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. 此构造已弃用。{0}。可以通过使用 “--langversion:5.0” 和 “--mlcompatibility” 启用此功能。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index f2d4f429c8..59f1848505 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -212,6 +212,11 @@ ML 相容性修訂 + + Pattern match discard is not allowed for union case that takes no data. + Pattern match discard is not allowed for union case that takes no data. + + nameof nameof @@ -402,6 +407,11 @@ 插補字串無效。三引號字串常值不可用於插補運算式。請考慮為內插補點運算式使用明確的 'let' 繫結。 + + Pattern discard is not allowed for union case that takes no data. + Pattern discard is not allowed for union case that takes no data. + + This construct is deprecated. {0}. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'. 此建構已被取代。{0}。您可以使用 '--langversion:5.0' and '--mlcompatibility' 來啟用此功能。 diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs index b64dff5176..63973ea991 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnionCasePatternMatchingErrors.fs @@ -69,4 +69,247 @@ let myVal = |> typecheck |> shouldFail |> withSingleDiagnostic (Error 727, Line 10, Col 7, Line 10, Col 15, "This union case expects 3 arguments in tupled form, but was given 2. The missing field arguments may be any of: -\tint") \ No newline at end of file +\tint") + +[] +let ``Union Pattern discard not allowed for union case that takes no data with Lang preview`` () = + FSharp """ +module Tests +type X = X + +let x: X = X + +let myVal = + match x with + | X _ -> ()""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") + + +[] +let ``Union Pattern discard allowed for union case that takes no data with Lang version 7`` () = + FSharp """ +module Tests +type X = X + +let x: X = X + +let myVal = + match x with + | X _ -> ()""" + |> withLangVersion70 + |> typecheck + |> shouldSucceed + +[] +let ``Union function Pattern discard allowed for union case that takes no data with Lang version 7`` () = + FSharp """ +module Tests +type X = X + +let x: X = X + +let myVal = + function + | X _ -> ()""" + |> withLangVersion70 + |> typecheck + |> shouldSucceed + +[] +let ``Union function Pattern discard not allowed for union case that takes no data with Lang version preview`` () = + FSharp """ +module Tests +type X = X + +let x: X = X + +let myVal = + function + | X _ -> ()""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 9, Col 7, Line 9, Col 10, "Pattern discard is not allowed for union case that takes no data.") + +[] +let ``Pattern discard not allowed for union case that takes no data with Lang preview`` () = + FSharp """ +module Tests +type U = + | A + | B of int * int * int + | C of int * int * int + +let a : U = A + +let myVal = + match a with + | A _ -> 15 + | B (x, _, _) -> 16 + | C _ -> 17""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") + +[] +let ``Pattern function discard not allowed for union case that takes no data with Lang preview`` () = + FSharp """ +module Tests +type U = + | A + | B of int * int * int + | C of int * int * int + +let a : U = A + +let myVal = + function + | A _ -> 15 + | B (x, _, _) -> 16 + | C _ -> 17""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") + +[] +let ``Pattern discard allowed for union case that takes no data with Lang version 7`` () = + FSharp """ +module Tests +type U = + | A + | B of int * int * int + | C of int * int * int + +let a : U = A + +let myVal = + match a with + | A _ -> 15 + | B (x, _, _) -> 16 + | C _ -> 17""" + |> withLangVersion70 + |> typecheck + |> shouldSucceed + +[] +let ``Grouped Pattern discard not allowed for union case that takes no data with Lang preview`` () = + FSharp """ +module Tests +type U = + | A + | B of int * int * int + | C of int * int * int + +let a : U = A + +let myVal = + match a with + | A _ + | B _ + | C _ -> 17""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 3548, Line 12, Col 7, Line 12, Col 10, "Pattern discard is not allowed for union case that takes no data.") + +[] +let ``Multiple pattern discards not allowed for union case that takes no data with Lang preview`` () = + FSharp """ +module Tests +type U = + | A + | B of int * int * int + | C of int * int * int + +type V = + | D + +let a : U = A +let d : V = D + +let myVal = + match a, d with + | A _, D -> 15 + | B (x, _, _), D _ -> 16 + | C _, _ -> 17""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") + (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") + ] + +[] +let ``Multiple function pattern discards is not allowed for union case that takes no data with Lang preview`` () = + FSharp """ +module Tests +type U = + | A + | B of int * int * int + | C of int * int * int + +type V = + | D + +let a : U = A +let d : V = D + +let myVal = + function + | A _, D -> 15 + | B (x, _, _), D _ -> 16 + | C _, _ -> 17""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 3548, Line 16, Col 7, Line 16, Col 10, "Pattern discard is not allowed for union case that takes no data.") + (Warning 3548, Line 17, Col 20, Line 17, Col 23, "Pattern discard is not allowed for union case that takes no data.") + ] + +[] +let ``Pattern discard allowed for single-case unions when using them as a deconstruct syntax in functions with Lang 7`` () = + FSharp """ +module Tests +type MyWrapper = A + +let myDiscardedArgFunc(A _) = 5+5""" + |> withLangVersion70 + |> typecheck + |> shouldSucceed + +[] +let ``Pattern named not allowed for single-case unions when using them as a deconstruct syntax in functions with Lang 7`` () = + FSharp """ +module Tests +type MyWrapper = A + +let myFunc(A a) = 5+5""" + |> withLangVersion70 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 725, Line 5, Col 12, Line 5, Col 15, "This union case does not take arguments") + ] + +[] +let ``Pattern discard or named are not allowed for single-case union case that takes no data with Lang preview`` () = + FSharp """ +module Tests +type MyWrapper = A + +let myFunc(A a) = 5+5 +let myDiscardedArgFunc(A _) = 5+5""" + |> withLangVersionPreview + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Warning 3548, Line 5, Col 12, Line 5, Col 15, "Pattern discard is not allowed for union case that takes no data.") + (Warning 3548, Line 6, Col 24, Line 6, Col 27, "Pattern discard is not allowed for union case that takes no data.") + ] \ No newline at end of file diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index 1679a74a33..c526d83da7 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -691,7 +691,7 @@ Updated automatically, please check diffs in your pull request, changes must be Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) match fileAnswer with - | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted") + | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> Assert.IsEmpty(typeCheckResults.Diagnostics, sprintf "Type Check errors: %A" typeCheckResults.Diagnostics) @@ -704,7 +704,7 @@ Updated automatically, please check diffs in your pull request, changes must be Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) match fileAnswer with - | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted") + | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> Assert.IsEmpty(typeCheckResults.Diagnostics, sprintf "Type Check errors: %A" typeCheckResults.Diagnostics) @@ -722,7 +722,7 @@ Updated automatically, please check diffs in your pull request, changes must be Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) match fileAnswer with - | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted") + | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> let errorsExpectedBaseLine = @@ -754,7 +754,7 @@ Updated automatically, please check diffs in your pull request, changes must be else match fileAnswer with - | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted"); [| |] + | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted"); [| |] | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> typeCheckResults.Diagnostics errors @@ -774,7 +774,7 @@ Updated automatically, please check diffs in your pull request, changes must be else match fileAnswer with - | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted"); [| |] + | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted"); [| |] | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> typeCheckResults.Diagnostics errors @@ -790,7 +790,7 @@ Updated automatically, please check diffs in your pull request, changes must be |> Async.RunImmediate match fileAnswer with - | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted"); failwith "Type Checker Aborted" + | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted"); failwith "Type Checker Aborted" | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> parseResults, typeCheckResults /// Parses and type checks the given source. Fails if the type checker is aborted or the parser returns any diagnostics. @@ -816,7 +816,7 @@ Updated automatically, please check diffs in your pull request, changes must be else match fileAnswer with - | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted"); [| |] + | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted"); [| |] | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> typeCheckResults.Diagnostics assertErrors libAdjust false errors expectedTypeErrors diff --git a/tests/service/data/TestTP/ProvidedTypes.fs b/tests/service/data/TestTP/ProvidedTypes.fs index e12c6f843d..c13961cbc2 100644 --- a/tests/service/data/TestTP/ProvidedTypes.fs +++ b/tests/service/data/TestTP/ProvidedTypes.fs @@ -629,8 +629,8 @@ type ProvidedTypeSymbol(kind: ProvidedTypeSymbolKind, typeArgs: Type list, typeB override __.GetArrayRank() = (match kind with ProvidedTypeSymbolKind.Array n -> n | ProvidedTypeSymbolKind.SDArray -> 1 | _ -> failwithf "non-array type '%O'" this) override __.IsValueTypeImpl() = (match kind with ProvidedTypeSymbolKind.Generic gtd -> gtd.IsValueType | _ -> false) override __.IsArrayImpl() = (match kind with ProvidedTypeSymbolKind.Array _ | ProvidedTypeSymbolKind.SDArray -> true | _ -> false) - override __.IsByRefImpl() = (match kind with ProvidedTypeSymbolKind.ByRef _ -> true | _ -> false) - override __.IsPointerImpl() = (match kind with ProvidedTypeSymbolKind.Pointer _ -> true | _ -> false) + override __.IsByRefImpl() = (match kind with ProvidedTypeSymbolKind.ByRef -> true | _ -> false) + override __.IsPointerImpl() = (match kind with ProvidedTypeSymbolKind.Pointer -> true | _ -> false) override __.IsPrimitiveImpl() = false override __.IsGenericType = (match kind with ProvidedTypeSymbolKind.Generic _ -> true | _ -> false) override this.GetGenericArguments() = (match kind with ProvidedTypeSymbolKind.Generic _ -> typeArgs | _ -> failwithf "non-generic type '%O'" this) @@ -7335,8 +7335,8 @@ namespace ProviderImplementation.ProvidedTypes override __.GetArrayRank() = (match kind with TypeSymbolKind.Array n -> n | TypeSymbolKind.SDArray -> 1 | _ -> failwithf "non-array type") override __.IsValueTypeImpl() = this.IsGenericType && this.GetGenericTypeDefinition().IsValueType override __.IsArrayImpl() = (match kind with TypeSymbolKind.Array _ | TypeSymbolKind.SDArray -> true | _ -> false) - override __.IsByRefImpl() = (match kind with TypeSymbolKind.ByRef _ -> true | _ -> false) - override __.IsPointerImpl() = (match kind with TypeSymbolKind.Pointer _ -> true | _ -> false) + override __.IsByRefImpl() = (match kind with TypeSymbolKind.ByRef -> true | _ -> false) + override __.IsPointerImpl() = (match kind with TypeSymbolKind.Pointer -> true | _ -> false) override __.IsPrimitiveImpl() = false override __.IsGenericType = (match kind with TypeSymbolKind.TargetGeneric _ | TypeSymbolKind.OtherGeneric _ -> true | _ -> false) override __.GetGenericArguments() = (match kind with TypeSymbolKind.TargetGeneric _ | TypeSymbolKind.OtherGeneric _ -> typeArgs | _ -> [| |]) diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs index ee27b6103b..4a7bc2764f 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/ProvidedTypes.fs @@ -546,8 +546,8 @@ namespace ProviderImplementation.ProvidedTypes override _.GetArrayRank() = (match kind with ProvidedTypeSymbolKind.Array n -> n | ProvidedTypeSymbolKind.SDArray -> 1 | _ -> failwithf "non-array type '%O'" this) override _.IsValueTypeImpl() = (match kind with ProvidedTypeSymbolKind.Generic gtd -> gtd.IsValueType | _ -> false) override _.IsArrayImpl() = (match kind with ProvidedTypeSymbolKind.Array _ | ProvidedTypeSymbolKind.SDArray -> true | _ -> false) - override _.IsByRefImpl() = (match kind with ProvidedTypeSymbolKind.ByRef _ -> true | _ -> false) - override _.IsPointerImpl() = (match kind with ProvidedTypeSymbolKind.Pointer _ -> true | _ -> false) + override _.IsByRefImpl() = (match kind with ProvidedTypeSymbolKind.ByRef -> true | _ -> false) + override _.IsPointerImpl() = (match kind with ProvidedTypeSymbolKind.Pointer -> true | _ -> false) override _.IsPrimitiveImpl() = false override _.IsGenericType = (match kind with ProvidedTypeSymbolKind.Generic _ -> true | _ -> false) override this.GetGenericArguments() = (match kind with ProvidedTypeSymbolKind.Generic _ -> typeArgs | _ -> failwithf "non-generic type '%O'" this) @@ -6993,8 +6993,8 @@ namespace ProviderImplementation.ProvidedTypes override _.GetArrayRank() = (match kind with TypeSymbolKind.Array n -> n | TypeSymbolKind.SDArray -> 1 | _ -> failwithf "non-array type") override _.IsValueTypeImpl() = this.IsGenericType && this.GetGenericTypeDefinition().IsValueType override _.IsArrayImpl() = (match kind with TypeSymbolKind.Array _ | TypeSymbolKind.SDArray -> true | _ -> false) - override _.IsByRefImpl() = (match kind with TypeSymbolKind.ByRef _ -> true | _ -> false) - override _.IsPointerImpl() = (match kind with TypeSymbolKind.Pointer _ -> true | _ -> false) + override _.IsByRefImpl() = (match kind with TypeSymbolKind.ByRef -> true | _ -> false) + override _.IsPointerImpl() = (match kind with TypeSymbolKind.Pointer -> true | _ -> false) override _.IsPrimitiveImpl() = false override _.IsGenericType = (match kind with TypeSymbolKind.TargetGeneric _ | TypeSymbolKind.OtherGeneric _ -> true | _ -> false) override _.GetGenericArguments() = (match kind with TypeSymbolKind.TargetGeneric _ | TypeSymbolKind.OtherGeneric _ -> typeArgs | _ -> [| |])