diff --git a/.vscode/launch.json b/.vscode/launch.json index 8853be0a138..965a1b47fc3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -21,7 +21,7 @@ "type": "coreclr", "request": "launch", // TODO: Shall we assume that it's already been built, or build it every time we debug? - // "preLaunchTask": "Build (Debug)", + "preLaunchTask": "Build (Debug)", // If you have changed target frameworks, make sure to update the program p "program": "${workspaceFolder}/artifacts/bin/fsi/Debug/net8.0/fsi.dll", "args": [ @@ -50,7 +50,7 @@ "type": "coreclr", "request": "launch", // TODO: Shall we assume that it's already been built, or build it every time we debug? - // "preLaunchTask": "Build (Debug)", + "preLaunchTask": "Build (Debug)", // If you have changed target frameworks, make sure to update the program path. "program": "${workspaceFolder}/artifacts/bin/fsc/Debug/net8.0/fsc.dll", "args": [ diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7ec6813a99c..1728f4efc97 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -31,10 +31,18 @@ "-c", "Debug", "FSharp.Compiler.Service.sln" - ], + ] + }, + "options": { + "env": { + "UpdateXlfOnBuild": "true" + } }, "problemMatcher": "$msCompile", - "group": "build", + "group": { + "kind": "build", + "isDefault": true + } }, { "label": "Build (Release)", @@ -53,10 +61,15 @@ "-c", "Release", "FSharp.Compiler.Service.sln" - ], + ] + }, + "options": { + "env": { + "UpdateXlfOnBuild": "true" + } }, "problemMatcher": "$msCompile", - "group": "build", + "group": "build" }, { "label": "Update xlf files", diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 411de0b07dd..dd9fab43504 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -4418,7 +4418,7 @@ module TcDeclarations = let isAtOriginalTyconDefn = true let core = MutRecDefnsPhase1DataForTycon(synTyconInfo, SynTypeDefnSimpleRepr.Exception r, implements1, false, false, isAtOriginalTyconDefn) core, extra_vals_Inherits_Abstractslots @ extraMembers - + //------------------------------------------------------------------------- /// Bind a collection of mutually recursive definitions in an implementation file diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index b2469920e69..302a338ccdf 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -7022,7 +7022,7 @@ and TcObjectExpr (cenv: cenv) env tpenv (objTy, realObjTy, argopt, binds, extraI let overrides' = [ for overrideMeth in overrides do let overrideInfo, (_, thisVal, methodVars, bindingAttribs, bindingBody) = overrideMeth - let (Override(_, _, id, mtps, _, _, _, isFakeEventProperty, _)) = overrideInfo + let (Override(_, _, id, mtps, _, _, _, isFakeEventProperty, _, _)) = overrideInfo if not isFakeEventProperty then let searchForOverride = @@ -11241,7 +11241,11 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (_: Val option) (a let uniqueAbstractMethSigs = match dispatchSlots with | [] -> - errorR(Error(FSComp.SR.tcNoMemberFoundForOverride(), memberId.idRange)) + let instanceExpected = memberFlags.IsInstance + if instanceExpected then + errorR(Error(FSComp.SR.tcNoMemberFoundForOverride(), memberId.idRange)) + else + errorR (Error(FSComp.SR.tcNoStaticMemberFoundForOverride (), memberId.idRange)) [] | slot :: _ as slots -> @@ -11300,7 +11304,7 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (_: Val option) (a | SynMemberKind.PropertyGet | SynMemberKind.PropertySet as k -> - let dispatchSlots = GetAbstractPropInfosForSynPropertyDecl(cenv.infoReader, ad, memberId, m, typToSearchForAbstractMembers) + let dispatchSlots = GetAbstractPropInfosForSynPropertyDecl(cenv.infoReader, ad, memberId, m, typToSearchForAbstractMembers, memberFlags) // Only consider those abstract slots where the get/set flags match the value we're defining let dispatchSlots = @@ -11313,7 +11317,11 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (_: Val option) (a let uniqueAbstractPropSigs = match dispatchSlots with | [] when not (CompileAsEvent g attribs) -> - errorR(Error(FSComp.SR.tcNoPropertyFoundForOverride(), memberId.idRange)) + let instanceExpected = memberFlags.IsInstance + if instanceExpected then + errorR(Error(FSComp.SR.tcNoPropertyFoundForOverride(), memberId.idRange)) + else + errorR (Error(FSComp.SR.tcNoStaticPropertyFoundForOverride (), memberId.idRange)) [] | [uniqueAbstractProp] -> [uniqueAbstractProp] | _ -> diff --git a/src/Compiler/Checking/MethodOverrides.fs b/src/Compiler/Checking/MethodOverrides.fs index bfa11de4c02..080e790374e 100644 --- a/src/Compiler/Checking/MethodOverrides.fs +++ b/src/Compiler/Checking/MethodOverrides.fs @@ -44,7 +44,9 @@ type OverrideInfo = argTypes: TType list list * returnType: TType option * isFakeEventProperty: bool * - isCompilerGenerated: bool + isCompilerGenerated: bool * + isInstance: bool + member x.CanImplement = let (Override(canImplement=a)) = x in a @@ -61,6 +63,9 @@ type OverrideInfo = member x.ReturnType = let (Override(returnType=b)) = x in b member x.IsCompilerGenerated = let (Override(isCompilerGenerated=b)) = x in b + + member x.IsInstance = let (Override(isInstance=b)) = x in b + type RequiredSlot = | RequiredSlot of methodInfo: MethInfo * isOptional: bool @@ -104,7 +109,7 @@ exception OverrideDoesntOverride of DisplayEnv * OverrideInfo * MethInfo option module DispatchSlotChecking = /// Print the signature of an override to a buffer as part of an error message - let PrintOverrideToBuffer denv os (Override(_, _, id, methTypars, memberToParentInst, argTys, retTy, _, _)) = + let PrintOverrideToBuffer denv os (Override(_, _, id, methTypars, memberToParentInst, argTys, retTy, _, _, _)) = let denv = { denv with showTyparBinding = true } let retTy = (retTy |> GetFSharpViewOfReturnType denv.g) let argInfos = @@ -136,7 +141,7 @@ module DispatchSlotChecking = let (CompiledSig (argTys, retTy, fmethTypars, ttpinst)) = CompiledSigOfMeth g amap m minfo let isFakeEventProperty = minfo.IsFSharpEventPropertyMethod - Override(parentType, minfo.ApparentEnclosingTyconRef, mkSynId m nm, fmethTypars, ttpinst, argTys, retTy, isFakeEventProperty, false) + Override(parentType, minfo.ApparentEnclosingTyconRef, mkSynId m nm, fmethTypars, ttpinst, argTys, retTy, isFakeEventProperty, false, minfo.IsInstance) /// Get the override info for a value being used to implement a dispatch slot. let GetTypeMemberOverrideInfo g reqdTy (overrideBy: ValRef) = @@ -175,7 +180,7 @@ module DispatchSlotChecking = //CanImplementAnySlot <<----- Change to this to enable implicit interface implementation let isFakeEventProperty = overrideBy.IsFSharpEventProperty(g) - Override(implKind, overrideBy.MemberApparentEntity, mkSynId overrideBy.Range nm, memberMethodTypars, memberToParentInst, argTys, retTy, isFakeEventProperty, overrideBy.IsCompilerGenerated) + Override(implKind, overrideBy.MemberApparentEntity, mkSynId overrideBy.Range nm, memberMethodTypars, memberToParentInst, argTys, retTy, isFakeEventProperty, overrideBy.IsCompilerGenerated, overrideBy.IsInstanceMember) /// Get the override information for an object expression method being used to implement dispatch slots let GetObjectExprOverrideInfo g amap (implTy, id: Ident, memberFlags, ty, arityInfo, bindingAttribs, rhsExpr) = @@ -200,7 +205,7 @@ module DispatchSlotChecking = CanImplementAnyClassHierarchySlot //CanImplementAnySlot <<----- Change to this to enable implicit interface implementation let isFakeEventProperty = CompileAsEvent g bindingAttribs - let overrideByInfo = Override(implKind, tcrefOfAppTy g implTy, id, tps, [], argTys, retTy, isFakeEventProperty, false) + let overrideByInfo = Override(implKind, tcrefOfAppTy g implTy, id, tps, [], argTys, retTy, isFakeEventProperty, false, memberFlags.IsInstance) overrideByInfo, (baseValOpt, thisv, vs, bindingAttribs, rhsExpr) | _ -> error(InternalError("Unexpected shape for object expression override", id.idRange)) @@ -227,7 +232,7 @@ module DispatchSlotChecking = /// Check if an override is a partial match for the requirements for a dispatch slot except for the name. let IsSigPartialMatch g (dispatchSlot: MethInfo) compiledSig overrideBy = - let (Override(_, _, _, methTypars, _, argTys, _retTy, _, _)) = overrideBy + let (Override(_, _, _, methTypars, _, argTys, _retTy, _, _, _)) = overrideBy let (CompiledSig (vargTys, _, fvmethTypars, _)) = compiledSig methTypars.Length = fvmethTypars.Length && IsTyparKindMatch compiledSig overrideBy && @@ -249,7 +254,7 @@ module DispatchSlotChecking = /// Check if an override exactly matches the requirements for a dispatch slot except for the name. let IsSigExactMatch g amap m dispatchSlot overrideBy = - let (Override(_, _, _, methTypars, memberToParentInst, argTys, retTy, _, _)) = overrideBy + let (Override(_, _, _, methTypars, memberToParentInst, argTys, retTy, _, _, _)) = overrideBy let compiledSig = CompiledSigOfMeth g amap m dispatchSlot IsSigPartialMatch g dispatchSlot compiledSig overrideBy && let (CompiledSig (vargTys, vrty, fvmethTypars, ttpinst)) = compiledSig @@ -300,7 +305,8 @@ module DispatchSlotChecking = /// Check if an override exactly matches the requirements for a dispatch slot. let IsExactMatch g amap m dispatchSlot overrideBy = IsNameMatch dispatchSlot overrideBy && - IsSigExactMatch g amap m dispatchSlot overrideBy + IsSigExactMatch g amap m dispatchSlot overrideBy && + dispatchSlot.IsInstance = overrideBy.IsInstance /// Check if an override implements a dispatch slot let OverrideImplementsDispatchSlot g amap m dispatchSlot availPriorOverride = @@ -321,7 +327,7 @@ module DispatchSlotChecking = reqdTy, dispatchSlots: RequiredSlot list, availPriorOverrides: OverrideInfo list, - overrides: OverrideInfo list) = + overrides: OverrideInfo list) = let g = infoReader.g let amap = infoReader.amap @@ -353,8 +359,8 @@ module DispatchSlotChecking = |> List.filter (OverrideImplementsDispatchSlot g amap m dispatchSlot) match maybeResolvedSlot with - | [ovd] -> - if not ovd.IsCompilerGenerated then + | [ovd] -> + if not ovd.IsCompilerGenerated then let item = Item.MethodGroup(ovd.LogicalName, [dispatchSlot],None) CallNameResolutionSink sink (ovd.Range, nenv, item, dispatchSlot.FormalMethodTyparInst, ItemOccurence.Implemented, AccessorDomain.AccessibleFromSomewhere) | [] -> @@ -386,7 +392,7 @@ module DispatchSlotChecking = noimpl() | [ overrideBy ] -> - let (Override(_, _, _, methTypars, _, argTys, _, _, _)) = overrideBy + let (Override(_, _, _, methTypars, _, argTys, _, _, _, _)) = overrideBy let moreThanOnePossibleDispatchSlot = dispatchSlots @@ -612,7 +618,8 @@ module DispatchSlotChecking = if dispatchSlot.IsFinal && (isObjExpr || not (typeEquiv g reqdTy dispatchSlot.ApparentEnclosingType)) then errorR(Error(FSComp.SR.typrelMethodIsSealed(NicePrint.stringOfMethInfo infoReader m denv dispatchSlot), m)) | dispatchSlots -> - match dispatchSlots |> List.filter (fun dispatchSlot -> + match dispatchSlots |> List.filter (fun dispatchSlot -> + (dispatchSlot.IsInstance = overrideBy.IsInstance) && isInterfaceTy g dispatchSlot.ApparentEnclosingType || not (DispatchSlotIsAlreadyImplemented g amap m availPriorOverridesKeyed dispatchSlot)) with | h1 :: h2 :: _ -> @@ -812,7 +819,7 @@ module DispatchSlotChecking = // We don't give missing method errors for abstract classes if isImplementation && not (isInterfaceTy g overallTy) then - let overrides = allImmediateMembersThatMightImplementDispatchSlots |> List.map snd + let overrides = allImmediateMembersThatMightImplementDispatchSlots |> List.map snd let allCorrect = CheckDispatchSlotsAreImplemented (denv, infoReader, m, nenv, sink, tcaug.tcaug_abstract, reqdTy, dispatchSlots, availPriorOverrides, overrides) // Tell the user to mark the thing abstract if it was missing implementations @@ -940,7 +947,7 @@ let GetAbstractMethInfosForSynMethodDecl(infoReader: InfoReader, ad, memberName: NameMultiMap.find memberName.idText dispatchSlotsKeyed |> List.map (fun reqdSlot -> reqdSlot.MethodInfo) | ty, None -> GetIntrinsicMethInfosOfType infoReader (Some memberName.idText) ad AllowMultiIntfInstantiations.Yes findFlag bindm ty - let dispatchSlots = minfos |> List.filter (fun minfo -> minfo.IsDispatchSlot) + let dispatchSlots = minfos |> List.filter (fun minfo -> minfo.IsDispatchSlot && minfo.IsInstance = memberFlags.IsInstance) let valReprSynArities = SynInfo.AritiesOfArgs valSynData // We only return everything if it's empty or if it's a non-instance member. @@ -955,7 +962,7 @@ let GetAbstractMethInfosForSynMethodDecl(infoReader: InfoReader, ad, memberName: /// Get the properties relevant to determining if a uniquely-identified-override exists based on the syntactic information /// at the member signature prior to type inference. This is used to pre-assign type information if it does -let GetAbstractPropInfosForSynPropertyDecl(infoReader: InfoReader, ad, memberName: Ident, bindm, typToSearchForAbstractMembers) = +let GetAbstractPropInfosForSynPropertyDecl(infoReader: InfoReader, ad, memberName: Ident, bindm, typToSearchForAbstractMembers, memberFlags: SynMemberFlags) = let pinfos = match typToSearchForAbstractMembers with | _, Some(SlotImplSet(_, _, _, reqdProps)) -> @@ -963,6 +970,5 @@ let GetAbstractPropInfosForSynPropertyDecl(infoReader: InfoReader, ad, memberNam | ty, None -> GetIntrinsicPropInfosOfType infoReader (Some memberName.idText) ad AllowMultiIntfInstantiations.Yes IgnoreOverrides bindm ty - let dispatchSlots = pinfos |> List.filter (fun pinfo -> pinfo.IsVirtualProperty) + let dispatchSlots = pinfos |> List.filter (fun pinfo -> pinfo.IsVirtualProperty && (not pinfo.IsStatic) = memberFlags.IsInstance) dispatchSlots - diff --git a/src/Compiler/Checking/MethodOverrides.fsi b/src/Compiler/Checking/MethodOverrides.fsi index d18a8cdc6f1..6468c03e8b1 100644 --- a/src/Compiler/Checking/MethodOverrides.fsi +++ b/src/Compiler/Checking/MethodOverrides.fsi @@ -32,7 +32,8 @@ type OverrideInfo = argTypes: TType list list * returnType: TType option * isFakeEventProperty: bool * - isCompilerGenerated: bool + isCompilerGenerated: bool * + isInstance: bool member ArgTypes: TType list list @@ -42,6 +43,8 @@ type OverrideInfo = member IsCompilerGenerated: bool + member IsInstance: bool + member IsFakeEventProperty: bool member LogicalName: string @@ -167,5 +170,6 @@ val GetAbstractPropInfosForSynPropertyDecl: ad: AccessorDomain * memberName: Ident * bindm: range * - typToSearchForAbstractMembers: (TType * SlotImplSet option) -> + typToSearchForAbstractMembers: (TType * SlotImplSet option) * + memberFlags: SynMemberFlags -> PropInfo list diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index 0eb0a647ce8..62c56d83e84 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -533,6 +533,8 @@ module OldStyleMessages = let OverrideDoesntOverride2E () = Message("OverrideDoesntOverride2", "%s") let OverrideDoesntOverride3E () = Message("OverrideDoesntOverride3", "%s") let OverrideDoesntOverride4E () = Message("OverrideDoesntOverride4", "%s") + let OverrideShouldBeStatic () = Message("OverrideShouldBeStatic", "") + let OverrideShouldBeInstance () = Message("OverrideShouldBeInstance", "") let UnionCaseWrongArgumentsE () = Message("UnionCaseWrongArguments", "%d%d") let UnionPatternsBindDifferentNamesE () = Message("UnionPatternsBindDifferentNames", "") let RequiredButNotSpecifiedE () = Message("RequiredButNotSpecified", "%s%s%s") @@ -1548,6 +1550,14 @@ type Exception with if sig1 <> sig2 then os.AppendString(OverrideDoesntOverride3E().Format sig2) + // If implementation and required slot doesn't have same "instance-ness", then tell user that. + if impl.IsInstance <> minfoVirt.IsInstance then + // Requried slot is instance, meaning implementation is static, tell user that we expect instance. + if minfoVirt.IsInstance then + os.AppendString(OverrideShouldBeStatic().Format) + else + os.AppendString(OverrideShouldBeInstance().Format) + | UnionCaseWrongArguments (_, n1, n2, _) -> os.AppendString(UnionCaseWrongArgumentsE().Format n2 n1) | UnionPatternsBindDifferentNames _ -> os.AppendString(UnionPatternsBindDifferentNamesE().Format) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 23ebc9e4c7c..8c732b6edbb 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1729,3 +1729,5 @@ featureUnmanagedConstraintCsharpInterop,"Interop between C#'s and F#'s unmanaged 3582,tcInfoIfFunctionShadowsUnionCase,"This is a function definition that shadows a union case. If this is what you want, ignore or suppress this warning. If you want it to be a union case deconstruction, add parentheses." 3583,unnecessaryParentheses,"Parentheses can be removed." 3584,tcDotLambdaAtNotSupportedExpression,"Shorthand lambda syntax is only supported for atomic expressions, such as method, property, field or indexer on the implied '_' argument. For example: 'let f = _.Length'." +3855,tcNoStaticMemberFoundForOverride,"No static abstract member was found that corresponds to this override" +3859,tcNoStaticPropertyFoundForOverride,"No static abstract property was found that corresponds to this override" diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx index 04946671a84..251f626c63e 100644 --- a/src/Compiler/FSStrings.resx +++ b/src/Compiler/FSStrings.resx @@ -882,6 +882,12 @@ The member '{0}' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type. + + Static member is expected. + + + Non-static member is expected. + This constructor is applied to {0} argument(s) but expects {1} diff --git a/src/Compiler/Service/ServiceAnalysis.fs b/src/Compiler/Service/ServiceAnalysis.fs index f168884644c..3bc2eeb973e 100644 --- a/src/Compiler/Service/ServiceAnalysis.fs +++ b/src/Compiler/Service/ServiceAnalysis.fs @@ -1103,6 +1103,14 @@ module UnnecessaryParentheses = // let inline f x = (^a : (static member Parse : string -> ^a) x) | SynExpr.Paren(expr = SynExpr.TraitCall _), _ -> ValueNone + // Don't touch library-only stuff: + // + // (# "ldlen.multi 2 0" array : int #) + | SynExpr.Paren(expr = SynExpr.LibraryOnlyILAssembly _), _ + | SynExpr.Paren(expr = SynExpr.LibraryOnlyStaticOptimization _), _ + | SynExpr.Paren(expr = SynExpr.LibraryOnlyUnionCaseFieldGet _), _ + | SynExpr.Paren(expr = SynExpr.LibraryOnlyUnionCaseFieldSet _), _ -> ValueNone + // Parens are required around the body expresion of a binding // if the parenthesized expression would be invalid without its parentheses, e.g., // diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index f101b4c9151..e3ab47ab86e 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -1262,6 +1262,16 @@ Použití metod s atributem NoEagerConstraintApplicationAttribute vyžaduje /langversion:6.0 nebo novější. + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. Tento výraz podporuje indexování, třeba expr.[index]. Syntaxe expr[index] vyžaduje /langversion:preview. Více informací: https://aka.ms/fsharp-index-notation diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 3697859d684..74eb118d29c 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -1262,6 +1262,16 @@ Die Verwendung von Methoden mit "NoEagerConstraintApplicationAttribute" erfordert /langversion:6.0 oder höher. + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. Dieser Ausdruck unterstützt die Indizierung, z. B. "expr.[index]". Die Syntax "expr[index]" erfordert /langversion:preview. Siehe https://aka.ms/fsharp-index-notation. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 0d6054100c1..e9cac9515a3 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -1262,6 +1262,16 @@ El uso de métodos con "NoEagerConstraintApplicationAttribute" requiere /langversion:6.0 o posteriores + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. Esta expresión admite indexación, por ejemplo "expr.[index]". La sintaxis "expr[index]" requiere /langversion:preview. Ver https://aka.ms/fsharp-index-notation. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 14306dddc9e..d4f47923abb 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -1262,6 +1262,16 @@ L’utilisation de méthodes avec « NoEagerConstraintApplicationAttribute » requiert/langversion:6.0 ou ultérieur + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. Cette expression prend en charge l’indexation, par exemple « expr.[index] ». La syntaxe « expr[index] » requiert /langversion:preview. Voir https://aka.ms/fsharp-index-notation. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index cab10c51095..7c45b565dc4 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -1262,6 +1262,16 @@ L'utilizzo di metodi con 'NoEagerConstraintApplicationAttribute' richiede /langversion: 6.0 o versione successiva + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. Questa espressione supporta l'indicizzazione, ad esempio 'expr.[index]'. La sintassi 'expr[index]' richiede/langversion:preview. Vedere https://aka.ms/fsharp-index-notation.. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 8aab74f4e4f..0e707fca19d 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -1262,6 +1262,16 @@ 'NoEagerConstraintApplicationAttribute' を指定してメソッドを使用するには、/langversion:6.0 以降が必要です + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. この式は、'expr. [index]' などのインデックスをサポートしています。構文 'expr[index]' には /langversion:preview が必要です。https://aka.ms/fsharp-index-notation を参照してください。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 9b3582eb4f8..2c8b3a8d206 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -1262,6 +1262,16 @@ 'NoEagerConstraintApplicationAttribute'와 함께 메서드를 사용하려면 /langversion:6.0 이상이 필요합니다. + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. 이 식은 인덱싱을 지원합니다. 'expr.[index]'. 'expr[index]' 구문에는 /langversion:preview가 필요합니다. https://aka.ms/fsharp-index-notation을 참조하세요. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 89867c0f85d..30cea28b6bb 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -1262,6 +1262,16 @@ Używanie metod z atrybutem "NoEagerConstraintApplicationAttribute" wymaga parametru /langversion:6.0 lub nowszego + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. To wyrażenie obsługuje indeksowanie, np. „expr.[index]”. Składnia wyrażenia „expr[index]” wymaga parametru /langversion:preview. Zobacz: https://aka.ms/fsharp-index-notation. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index cff08b64683..a4654f80c85 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -1262,6 +1262,16 @@ Usar métodos com 'NoEagerConstraintApplicationAttribute' requer /langversion:6.0 ou posterior + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. Essa expressão oferece suporte à indexação, por exemplo, 'expr. [index]'. A sintaxe 'expr[index]' requer /langversion:preview. Consulte https://aka.ms/fsharp-index-notation. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 3349417fdf5..cf3004de36a 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -1262,6 +1262,16 @@ Для использования методов с "NoEagerConstraintApplicationAttribute" требуется /langversion:6.0 или более поздняя версия + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. Это выражение поддерживает индексирование, например, "expr. [index]". Для синтаксиса "expr[index]" требуется /langversion:preview. См. https://aka.ms/fsharp-index-notation. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 53aa7e0df1b..db76b1a5de8 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -1262,6 +1262,16 @@ 'NoEagerConstraintApplicationAttribute' içeren yöntemlerin kullanılması /langversion:6.0 veya üstünü gerektiriyor + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. Bu ifade dizin oluşturmayı destekler, örn. “expr.[index]”. Söz dizimi “expr.[index]” /langversion:preview gerektirir. https://aka.ms/fsharp-index-notation'a bakın. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 097bc9c2e0b..241ffe580d4 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -1262,6 +1262,16 @@ 将方法与 “NoEagerConstraintApplicationAttribute” 配合使用需要 /langversion:6.0 或更高版本 + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. 此表达式支持索引,例如“expr.[index]”。语法“expr[index]”需要 /langversion:preview。请参阅 https://aka.ms/fsharp-index-notation。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index f9e2e228c79..4d5140432b0 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -1262,6 +1262,16 @@ 使用具有 'NoEagerConstraintApplicationAttribute' 的方法需要 /langversion:6.0 或更新版本 + + No static abstract member was found that corresponds to this override + No static abstract member was found that corresponds to this override + + + + No static abstract property was found that corresponds to this override + No static abstract property was found that corresponds to this override + + This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation. 此運算式支援編製索引,例如 'expr.[index]'。語法 'expr[index]' 需要 /langversion:preview。請參閱 https://aka.ms/fsharp-index-notation。 diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index 7fb003f52d8..318ea1464ff 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -22,6 +22,16 @@ Případy sjednocení s malými písmeny jsou povolené jenom při použití atributu RequireQualifiedAccess. + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' symbol ..^ diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 91366947a2a..430b308631e 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -22,6 +22,16 @@ Diskriminierte Union-Fälle in Kleinbuchstaben sind nur zulässig, wenn das RequireQualifiedAccess-Attribut verwendet wird. + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' Symbol "..^" diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index 12117838fdf..9a94fe0bfca 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -22,6 +22,16 @@ Los casos de unión discriminada en minúsculas solo se permiten cuando se usa el atributo RequireQualifiedAccess + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' símbolo "..^" diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index 555adcfef64..0d5bfd687ae 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -22,6 +22,16 @@ Les cas d’union discriminée en minuscules sont uniquement autorisés lors de l’utilisation de l’attribut RequireQualifiedAccess. + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' symbole '..^' diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 54a69b1b768..465456a085d 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -22,6 +22,16 @@ I casi di unione discriminati minuscoli sono consentiti solo quando si usa l'attributo RequireQualifiedAccess + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' simbolo '..^' diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index cf0302da1c2..c895e7a6a1e 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -22,6 +22,16 @@ 小文字で区別される和集合のケースは、RequireQualifiedAccess 属性を使用する場合にのみ許可されます + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' シンボル '..^' diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index b43d666d0b6..82dbc42e072 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -22,6 +22,16 @@ 소문자로 구분된 공용 구조체 케이스는 RequireQualifiedAccess 특성을 사용하는 경우에만 허용됩니다. + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' 기호 '..^' diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index 0040f91cbcf..e2bc31e3fb9 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -22,6 +22,16 @@ Przypadki unii z dyskryminatorem z małymi literami są dozwolone tylko w przypadku używania atrybutu RequireQualifiedAccess + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' symbol „..^” diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index 4c01cb03d6e..b4d1f7ba70d 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -22,6 +22,16 @@ Os casos de união discriminados em letras minúsculas só são permitidos ao usar o atributo RequireQualifiedAccess + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' símbolo '..^' diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 1f43d4d03f8..5149ef4d9f0 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -22,6 +22,16 @@ Размеченные в нижнем регистре случаи объединения разрешены только при использовании атрибута RequireQualifiedAccess + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' символ "..^" diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index 96203f5ae96..dde4f9ee022 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -22,6 +22,16 @@ Küçük harf ayrımlı birleşim durumlarına yalnızca RequireQualifiedAccess özniteliği kullanılırken izin verilir + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' '..^' sembolü diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index 6b0e8f8a303..89e54bb26c5 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -22,6 +22,16 @@ 仅当使用 RequireQualifiedAccess 属性时才允许区分小写的联合事例 + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' 符号 "..^" diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index 721818d7dd5..71c045b02fa 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -22,6 +22,16 @@ 只有在使用 RequireQualifiedAccess 屬性時,才允許小寫區分聯結案例 + + Non-static member is expected. + Non-static member is expected. + + + + Static member is expected. + Static member is expected. + + symbol '..^' 符號 '..^' diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs index 77787d5a256..3363bbfb961 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs @@ -922,3 +922,244 @@ let main _ = |> withLangVersion70 |> compile |> shouldSucceed + + [] + let ``Produce an error when one leaves out keyword "static" in an implementation of IWSAM`` () = + Fsx """ +module StaticAbstractBug = + type IOperation = + static abstract member Execute: unit -> unit + abstract member Execute2: unit -> unit + static abstract member Property: int + abstract member Property2: int + static abstract Property3 : int with get, set + + type FaultyOperation() = + interface IOperation with + member _.Execute() = () + member _.Execute2() = () + member this.Property = 0 + member this.Property2 = 0 + member this.Property3 = 0 + member this.Property3 with set value = () + """ + |> withOptions [ "--nowarn:3535" ] + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 855, Line 12, Col 22, Line 12, Col 29, "No abstract or interface member was found that corresponds to this override") + (Error 859, Line 14, Col 25, Line 14, Col 33, "No abstract property was found that corresponds to this override") + (Error 859, Line 16, Col 25, Line 16, Col 34, "No abstract property was found that corresponds to this override") + (Error 859, Line 17, Col 25, Line 17, Col 34, "No abstract property was found that corresponds to this override") + ] + + [] + let ``Produce an error when one leaves out keyword "static" in an implementation of IWSAM with multiple overloads`` () = + Fsx """ +module StaticAbstractBug = + type IOperation = + static abstract member Execute: unit -> unit + abstract member Execute: unit -> bool + static abstract member Property: int + abstract member Property: int + + type FaultyOperation() = + interface IOperation with + member _.Execute() = () + member _.Execute() = false + member this.Property = 0 + member this.Property = false + """ + |> withOptions [ "--nowarn:3535" ] + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 11, Col 34, Line 11, Col 36, "This expression was expected to have type + 'bool' +but here has type + 'unit' ") + (Error 1, Line 14, Col 36, Line 14, Col 41, "This expression was expected to have type + 'int' +but here has type + 'bool' ") + ] + + [] + let ``Produce an error for interface with static abstract member that is implemented as instance member`` () = + Fsx """ +module StaticAbstractBug = + type IFoo<'T> = + abstract DoIt: unit -> string + static abstract Other : int -> int + static abstract member Property: int + abstract member Property2: int + static abstract Property3 : int with get, set + type MyFoo = { + Value : int + } with + interface IFoo with + member me.DoIt() = string me.Value + member _.Other(value) = value + 1 + member this.Property = 0 + member this.Property2 = 0 + member this.Property3 = 0 + member this.Property3 with set value = () + """ + |> withOptions [ "--nowarn:3535" ] + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 855, Line 14, Col 18, Line 14, Col 23, "No abstract or interface member was found that corresponds to this override"); + (Error 859, Line 15, Col 21, Line 15, Col 29, "No abstract property was found that corresponds to this override"); + (Error 859, Line 17, Col 21, Line 17, Col 30, "No abstract property was found that corresponds to this override"); + (Error 859, Line 18, Col 21, Line 18, Col 30, "No abstract property was found that corresponds to this override") + ] + + [] + let ``Produce an error for interface with static abstract member that is implemented as instance member with multiple overloads`` () = + Fsx """ +module StaticAbstractBug = + type IFoo<'T> = + abstract DoIt: unit -> string + static abstract Other : int -> int + abstract Other : int -> bool + static abstract member Property: int + abstract member Property: bool + type MyFoo = { + Value : int + } with + interface IFoo with + member me.DoIt() = string me.Value + member _.Other(value) = value + 1 + member _.Other(value) = value = 1 + member this.Property = 0 + member this.Property = false + """ + |> withOptions [ "--nowarn:3535" ] + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 14, Col 41, Line 14, Col 42, "The type 'bool' does not match the type 'int'") + (Error 1, Line 16, Col 32, Line 16, Col 33, "This expression was expected to have type + 'bool' +but here has type + 'int' ") + ] + + [] + let ``Produce an error when one leaves out keyword "static" in multiple IWSAM implementations`` () = + Fsx """ +module StaticAbstractBug = + type IOperation = + static abstract member Execute: unit -> int + abstract member Execute2: unit -> unit + + type IOperation2 = + static abstract member Execute: unit -> int + abstract member Execute2: unit -> unit + + type FaultyOperation() = + interface IOperation with + member this.Execute() = 0 + member _.Execute2() = () + + interface IOperation2 with + member this.Execute() = 0 + member this.Execute2() = () + """ + |> withOptions [ "--nowarn:3535" ] + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ + (Error 855, Line 13, Col 25, Line 13, Col 32, "No abstract or interface member was found that corresponds to this override") + (Error 855, Line 17, Col 25, Line 17, Col 32, "No abstract or interface member was found that corresponds to this override") + ] + + [] + let ``Produce an error when one leaves out keyword "static" when implementing IWSAM in an object expression`` () = + Fsx """ +module StaticAbstractBug = + type IOperation = + static abstract member Execute: unit -> unit + abstract member Execute2: unit -> unit + + let objExpr = + { new IOperation with + member _.Execute() = () + member _.Execute2() = () } + """ + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 17, Line 9, Col 22, Line 9, Col 29, "The member 'Execute: unit -> unit' does not have the correct type to override the corresponding abstract method. Non-static member is expected.") + (Error 783, Line 8, Col 15, Line 8, Col 25, "At least one override did not correctly implement its corresponding abstract member") + ] + + [] + let ``Produces errors when includes keyword "static" when implementing a generic interface in a type`` () = + Fsx """ +module StaticAbstractBug = + type IFoo<'T> = + abstract DoIt: unit -> string + abstract Other : int -> int + abstract member Property: int + abstract member Property2: int + abstract Property3 : int with get, set + type MyFoo = { + Value : int + } with + interface IFoo with + static member DoIt() = "" + static member Other(value) = value + 1 + static member Property = 0 + static member Property2 = 0 + static member Property3 = 0 + static member Property3 with set value = () + """ + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3855, Line 13, Col 23, Line 13, Col 27, "No static abstract member was found that corresponds to this override") + (Error 3855, Line 14, Col 23, Line 14, Col 28, "No static abstract member was found that corresponds to this override") + (Error 3859, Line 15, Col 23, Line 15, Col 31, "No static abstract property was found that corresponds to this override") + (Error 3859, Line 16, Col 23, Line 16, Col 32, "No static abstract property was found that corresponds to this override") + (Error 3859, Line 17, Col 23, Line 17, Col 32, "No static abstract property was found that corresponds to this override") + (Error 3859, Line 18, Col 23, Line 18, Col 32, "No static abstract property was found that corresponds to this override") + ] + + [] + let ``Produces errors when includes keyword "static" when implementing an interface in a type`` () = + Fsx """ +module StaticAbstractBug = + type IOperation = + abstract member Execute: unit -> unit + abstract member Execute: unit -> bool + abstract member Property: int + abstract member Property: int + + type FaultyOperation() = + interface IOperation with + static member Execute() = () + static member Execute() = false + static member Property = 0 + static member Property = false + """ + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3855, Line 11, Col 27, Line 11, Col 34, "No static abstract member was found that corresponds to this override") + (Error 3855, Line 12, Col 27, Line 12, Col 34, "No static abstract member was found that corresponds to this override") + (Error 3859, Line 13, Col 27, Line 13, Col 35, "No static abstract property was found that corresponds to this override") + (Error 3859, Line 14, Col 27, Line 14, Col 35, "No static abstract property was found that corresponds to this override") + ] \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg02.vsbsl b/tests/fsharp/typecheck/sigs/neg02.vsbsl index 46e4ce5cb46..b979ec4b36b 100644 --- a/tests/fsharp/typecheck/sigs/neg02.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg02.vsbsl @@ -7,4 +7,4 @@ neg02.fs(17,21,17,26): typecheck error FS3351: Feature 'static abstract interfac neg02.fs(17,21,17,26): typecheck error FS3350: Feature 'static abstract interface members' is not available in F# 6.0. Please use language version 7.0 or greater. -neg02.fs(17,21,17,24): typecheck error FS0855: No abstract or interface member was found that corresponds to this override +neg02.fs(17,21,17,24): typecheck error FS3855: No static abstract member was found that corresponds to this override diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs index 551cfef9f68..a5bd9d67d45 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs @@ -668,6 +668,9 @@ let _ = """ $"{3 + LanguagePrimitives.GenericZero :N0}" """ + + // LibraryOnlyILAssembly + """(# "ldlen.multi 2 0" array : int #)""", """(# "ldlen.multi 2 0" array : int #)""" } [] diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs index b62f508c919..3c3c452b0c3 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs @@ -377,7 +377,7 @@ type staticInInterface = CheckErrorList fileContent (function | err1 :: _ -> - Assert.IsTrue(err1.Message.Contains("No abstract or interface member was found that corresponds to this override")) + Assert.IsTrue(err1.Message.Contains("No static abstract member was found that corresponds to this override")) | x -> Assert.Fail(sprintf "Unexpected errors: %A" x))