From 4dc1f3a40cb389a359c23f1043c269af49415454 Mon Sep 17 00:00:00 2001 From: Alex Berezhnykh Date: Wed, 13 Sep 2023 22:45:56 +0300 Subject: [PATCH 1/2] Add ExtendedData to FSharpDiagnostic (#15840) Add ExtendedData to FSharpDiagnostic --- src/Compiler/Checking/SignatureConformance.fs | 85 ++++---- .../Checking/SignatureConformance.fsi | 12 +- src/Compiler/Driver/CompilerDiagnostics.fs | 10 +- src/Compiler/FSComp.txt | 1 - src/Compiler/FSStrings.resx | 3 + src/Compiler/FSharp.Compiler.Service.fsproj | 4 +- src/Compiler/Interactive/fsi.fs | 2 +- src/Compiler/Service/FSharpCheckerResults.fs | 85 ++++---- src/Compiler/Service/IncrementalBuild.fs | 4 +- src/Compiler/Service/service.fs | 24 ++- src/Compiler/Symbols/FSharpDiagnostic.fs | 158 ++++++++++++-- src/Compiler/Symbols/FSharpDiagnostic.fsi | 109 +++++++++- src/Compiler/xlf/FSComp.txt.cs.xlf | 5 - src/Compiler/xlf/FSComp.txt.de.xlf | 5 - src/Compiler/xlf/FSComp.txt.es.xlf | 5 - src/Compiler/xlf/FSComp.txt.fr.xlf | 5 - src/Compiler/xlf/FSComp.txt.it.xlf | 5 - src/Compiler/xlf/FSComp.txt.ja.xlf | 5 - src/Compiler/xlf/FSComp.txt.ko.xlf | 5 - src/Compiler/xlf/FSComp.txt.pl.xlf | 5 - src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 - src/Compiler/xlf/FSComp.txt.ru.xlf | 5 - src/Compiler/xlf/FSComp.txt.tr.xlf | 5 - src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 - src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 - src/Compiler/xlf/FSStrings.cs.xlf | 5 + src/Compiler/xlf/FSStrings.de.xlf | 5 + src/Compiler/xlf/FSStrings.es.xlf | 5 + src/Compiler/xlf/FSStrings.fr.xlf | 5 + src/Compiler/xlf/FSStrings.it.xlf | 5 + src/Compiler/xlf/FSStrings.ja.xlf | 5 + src/Compiler/xlf/FSStrings.ko.xlf | 5 + src/Compiler/xlf/FSStrings.pl.xlf | 5 + src/Compiler/xlf/FSStrings.pt-BR.xlf | 5 + src/Compiler/xlf/FSStrings.ru.xlf | 5 + src/Compiler/xlf/FSStrings.tr.xlf | 5 + src/Compiler/xlf/FSStrings.zh-Hans.xlf | 5 + src/Compiler/xlf/FSStrings.zh-Hant.xlf | 5 + .../ExtendedDiagnosticDataTests.fs | 203 ++++++++++++++++++ .../FSharp.Compiler.ComponentTests.fsproj | 1 + ...ervice.SurfaceArea.netstandard20.debug.bsl | 117 ++++++++++ ...vice.SurfaceArea.netstandard20.release.bsl | 117 ++++++++++ 42 files changed, 885 insertions(+), 180 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/ErrorMessages/ExtendedDiagnosticDataTests.fs diff --git a/src/Compiler/Checking/SignatureConformance.fs b/src/Compiler/Checking/SignatureConformance.fs index 6ea987ac890..27cbe35a13c 100644 --- a/src/Compiler/Checking/SignatureConformance.fs +++ b/src/Compiler/Checking/SignatureConformance.fs @@ -7,12 +7,11 @@ module internal FSharp.Compiler.SignatureConformance open System.Text open Internal.Utilities.Collections -open Internal.Utilities.Library +open Internal.Utilities.Library open Internal.Utilities.Library.Extras -open FSharp.Compiler +open FSharp.Compiler open FSharp.Compiler.DiagnosticsLogger open FSharp.Compiler.Features -open FSharp.Compiler.Infos open FSharp.Compiler.InfoReader open FSharp.Compiler.Syntax open FSharp.Compiler.SyntaxTreeOps @@ -34,10 +33,12 @@ exception UnionCaseNotContained of DisplayEnv * InfoReader * Tycon * UnionCase * exception FSharpExceptionNotContained of DisplayEnv * InfoReader * Tycon * Tycon * (string * string -> string) -exception FieldNotContained of DisplayEnv * InfoReader * Tycon * RecdField * RecdField * (string * string -> string) +exception FieldNotContained of DisplayEnv * InfoReader * Tycon * Tycon * RecdField * RecdField * (string * string -> string) exception InterfaceNotRevealed of DisplayEnv * TType * range +exception ArgumentsInSigAndImplMismatch of sigArg: Ident * implArg: Ident + // Use a type to capture the constant, common parameters type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = @@ -182,7 +183,7 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = false else - checkExnInfo (fun f -> FSharpExceptionNotContained(denv, infoReader, implTycon, sigTycon, f)) aenv infoReader implTycon implTycon.ExceptionInfo sigTycon.ExceptionInfo && + checkExnInfo (fun f -> FSharpExceptionNotContained(denv, infoReader, implTycon, sigTycon, f)) aenv infoReader implTycon sigTycon implTycon.ExceptionInfo sigTycon.ExceptionInfo && let implTypars = implTycon.Typars m let sigTypars = sigTycon.Typars m @@ -263,10 +264,10 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = else checkTypars m aenv implTypars sigTypars && - checkTypeRepr m aenv infoReader implTycon sigTycon.TypeReprInfo && + checkTypeRepr m aenv infoReader implTycon sigTycon && checkTypeAbbrev m aenv implTycon sigTycon && checkAttribs aenv implTycon.Attribs sigTycon.Attribs (fun attribs -> implTycon.entity_attribs <- attribs) && - checkModuleOrNamespaceContents implTycon.Range aenv infoReader (mkLocalEntityRef implTycon) sigTycon.ModuleOrNamespaceType + checkModuleOrNamespaceContents implTycon.Range aenv infoReader (mkLocalEntityRef implTycon) sigTycon.ModuleOrNamespaceType and checkValInfo aenv err (implVal : Val) (sigVal : Val) = let id = implVal.Id @@ -296,8 +297,8 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = (implArgInfos, sigArgInfos) ||> List.forall2 (List.forall2 (fun implArgInfo sigArgInfo -> checkAttribs aenv implArgInfo.Attribs sigArgInfo.Attribs (fun attribs -> match implArgInfo.Name, sigArgInfo.Name with - | Some iname, Some sname when sname.idText <> iname.idText -> - warning(Error (FSComp.SR.ArgumentsInSigAndImplMismatch(sname.idText, iname.idText), iname.idRange)) + | Some iname, Some sname when sname.idText <> iname.idText -> + warning(ArgumentsInSigAndImplMismatch(sname, iname)) | _ -> () let sigHasInlineIfLambda = HasFSharpAttribute g g.attrib_InlineIfLambdaAttribute sigArgInfo.Attribs @@ -353,39 +354,39 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = else checkAttribs aenv implVal.Attribs sigVal.Attribs (fun attribs -> implVal.SetAttribs attribs) - and checkExnInfo err aenv (infoReader: InfoReader) (enclosingTycon: Tycon) implTypeRepr sigTypeRepr = - match implTypeRepr, sigTypeRepr with - | TExnAsmRepr _, TExnFresh _ -> + and checkExnInfo err aenv (infoReader: InfoReader) (enclosingImplTycon: Tycon) (enclosingSigTycon: Tycon) implTypeRepr sigTypeRepr = + match implTypeRepr, sigTypeRepr with + | TExnAsmRepr _, TExnFresh _ -> (errorR (err FSComp.SR.ExceptionDefsNotCompatibleHiddenBySignature); false) - | TExnAsmRepr tcr1, TExnAsmRepr tcr2 -> + | TExnAsmRepr tcr1, TExnAsmRepr tcr2 -> if tcr1 <> tcr2 then (errorR (err FSComp.SR.ExceptionDefsNotCompatibleDotNetRepresentationsDiffer); false) else true - | TExnAbbrevRepr _, TExnFresh _ -> + | TExnAbbrevRepr _, TExnFresh _ -> (errorR (err FSComp.SR.ExceptionDefsNotCompatibleAbbreviationHiddenBySignature); false) - | TExnAbbrevRepr ecr1, TExnAbbrevRepr ecr2 -> - if not (tcrefAEquiv g aenv ecr1 ecr2) then + | TExnAbbrevRepr ecr1, TExnAbbrevRepr ecr2 -> + if not (tcrefAEquiv g aenv ecr1 ecr2) then (errorR (err FSComp.SR.ExceptionDefsNotCompatibleSignaturesDiffer); false) else true - | TExnFresh r1, TExnFresh r2-> checkRecordFieldsForExn g denv err aenv infoReader enclosingTycon r1 r2 + | TExnFresh r1, TExnFresh r2-> checkRecordFieldsForExn g denv err aenv infoReader enclosingImplTycon enclosingSigTycon r1 r2 | TExnNone, TExnNone -> true | _ -> (errorR (err FSComp.SR.ExceptionDefsNotCompatibleExceptionDeclarationsDiffer); false) - and checkUnionCase aenv infoReader (enclosingTycon: Tycon) (implUnionCase: UnionCase) (sigUnionCase: UnionCase) = + and checkUnionCase aenv infoReader (enclosingImplTycon: Tycon) (enclosingSigTycon: Tycon) (implUnionCase: UnionCase) (sigUnionCase: UnionCase) = implUnionCase.SetOtherXmlDoc(sigUnionCase.XmlDoc) - - let err f = errorR(UnionCaseNotContained(denv, infoReader, enclosingTycon, implUnionCase, sigUnionCase, f));false + + let err f = errorR(UnionCaseNotContained(denv, infoReader, enclosingImplTycon, implUnionCase, sigUnionCase, f));false sigUnionCase.OtherRangeOpt <- Some (implUnionCase.Range, true) implUnionCase.OtherRangeOpt <- Some (sigUnionCase.Range, false) if implUnionCase.Id.idText <> sigUnionCase.Id.idText then err FSComp.SR.ModuleContainsConstructorButNamesDiffer elif implUnionCase.RecdFieldsArray.Length <> sigUnionCase.RecdFieldsArray.Length then err FSComp.SR.ModuleContainsConstructorButDataFieldsDiffer - elif not (Array.forall2 (checkField aenv infoReader enclosingTycon) implUnionCase.RecdFieldsArray sigUnionCase.RecdFieldsArray) then err FSComp.SR.ModuleContainsConstructorButTypesOfFieldsDiffer + elif not (Array.forall2 (checkField aenv infoReader enclosingImplTycon enclosingSigTycon) implUnionCase.RecdFieldsArray sigUnionCase.RecdFieldsArray) then err FSComp.SR.ModuleContainsConstructorButTypesOfFieldsDiffer elif isLessAccessible implUnionCase.Accessibility sigUnionCase.Accessibility then err FSComp.SR.ModuleContainsConstructorButAccessibilityDiffers else checkAttribs aenv implUnionCase.Attribs sigUnionCase.Attribs (fun attribs -> implUnionCase.Attribs <- attribs) - and checkField aenv infoReader (enclosingTycon: Tycon) implField sigField = + and checkField aenv infoReader (enclosingImplTycon: Tycon) (enclosingSigTycon: Tycon) implField sigField = implField.SetOtherXmlDoc(sigField.XmlDoc) - - let err f = errorR(FieldNotContained(denv, infoReader, enclosingTycon, implField, sigField, f)); false + + let err f = errorR(FieldNotContained(denv, infoReader, enclosingImplTycon, enclosingSigTycon, implField, sigField, f)); false sigField.rfield_other_range <- Some (implField.Range, true) implField.rfield_other_range <- Some (sigField.Range, false) if implField.rfield_id.idText <> sigField.rfield_id.idText then err FSComp.SR.FieldNotContainedNamesDiffer @@ -433,34 +434,34 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = | _ -> false - and checkRecordFields m aenv infoReader (implTycon: Tycon) (implFields: TyconRecdFields) (sigFields: TyconRecdFields) = + and checkRecordFields m aenv infoReader (implTycon: Tycon) (sigTycon: Tycon) (implFields: TyconRecdFields) (sigFields: TyconRecdFields) = let implFields = implFields.TrueFieldsAsList let sigFields = sigFields.TrueFieldsAsList let m1 = implFields |> NameMap.ofKeyedList (fun rfld -> rfld.LogicalName) let m2 = sigFields |> NameMap.ofKeyedList (fun rfld -> rfld.LogicalName) NameMap.suball2 (fun fieldName _ -> errorR(Error (FSComp.SR.DefinitionsInSigAndImplNotCompatibleFieldRequiredButNotSpecified(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName, fieldName), m)); false) - (checkField aenv infoReader implTycon) m1 m2 && + (checkField aenv infoReader implTycon sigTycon) m1 m2 && NameMap.suball2 (fun fieldName _ -> errorR(Error (FSComp.SR.DefinitionsInSigAndImplNotCompatibleFieldWasPresent(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName, fieldName), m)); false) - (fun x y -> checkField aenv infoReader implTycon y x) m2 m1 && + (fun x y -> checkField aenv infoReader implTycon sigTycon y x) m2 m1 && // This check is required because constructors etc. are externally visible // and thus compiled representations do pick up dependencies on the field order - (if List.forall2 (checkField aenv infoReader implTycon) implFields sigFields + (if List.forall2 (checkField aenv infoReader implTycon sigTycon) implFields sigFields then true else (errorR(Error (FSComp.SR.DefinitionsInSigAndImplNotCompatibleFieldOrderDiffer(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName), m)); false)) - and checkRecordFieldsForExn _g _denv err aenv (infoReader: InfoReader) (enclosingTycon: Tycon) (implFields: TyconRecdFields) (sigFields: TyconRecdFields) = + and checkRecordFieldsForExn _g _denv err aenv (infoReader: InfoReader) (enclosingImplTycon: Tycon) (enclosingSigTycon: Tycon) (implFields: TyconRecdFields) (sigFields: TyconRecdFields) = let implFields = implFields.TrueFieldsAsList let sigFields = sigFields.TrueFieldsAsList let m1 = implFields |> NameMap.ofKeyedList (fun rfld -> rfld.LogicalName) let m2 = sigFields |> NameMap.ofKeyedList (fun rfld -> rfld.LogicalName) - NameMap.suball2 (fun s _ -> errorR(err (fun (x, y) -> FSComp.SR.ExceptionDefsNotCompatibleFieldInSigButNotImpl(s, x, y))); false) (checkField aenv infoReader enclosingTycon) m1 m2 && - NameMap.suball2 (fun s _ -> errorR(err (fun (x, y) -> FSComp.SR.ExceptionDefsNotCompatibleFieldInImplButNotSig(s, x, y))); false) (fun x y -> checkField aenv infoReader enclosingTycon y x) m2 m1 && - // This check is required because constructors etc. are externally visible - // and thus compiled representations do pick up dependencies on the field order - (if List.forall2 (checkField aenv infoReader enclosingTycon) implFields sigFields + NameMap.suball2 (fun s _ -> errorR(err (fun (x, y) -> FSComp.SR.ExceptionDefsNotCompatibleFieldInSigButNotImpl(s, x, y))); false) (checkField aenv infoReader enclosingImplTycon enclosingSigTycon) m1 m2 && + NameMap.suball2 (fun s _ -> errorR(err (fun (x, y) -> FSComp.SR.ExceptionDefsNotCompatibleFieldInImplButNotSig(s, x, y))); false) (fun x y -> checkField aenv infoReader enclosingImplTycon enclosingSigTycon y x) m2 m1 && + // This check is required because constructors etc. are externally visible + // and thus compiled representations do pick up dependencies on the field order + (if List.forall2 (checkField aenv infoReader enclosingImplTycon enclosingSigTycon) implFields sigFields then true else (errorR(err FSComp.SR.ExceptionDefsNotCompatibleFieldOrderDiffers); false)) @@ -477,23 +478,23 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = let valText = NicePrint.stringValOrMember denv infoReader vref errorR(Error (FSComp.SR.DefinitionsInSigAndImplNotCompatibleAbstractMemberMissingInSig(kindText, implTycon.DisplayName, valText), m)); false) (fun _x _y -> true) - and checkClassFields isStruct m aenv infoReader (implTycon: Tycon) (implFields: TyconRecdFields) (sigFields: TyconRecdFields) = + and checkClassFields isStruct m aenv infoReader (implTycon: Tycon) (signTycon: Tycon) (implFields: TyconRecdFields) (sigFields: TyconRecdFields) = let implFields = implFields.TrueFieldsAsList let sigFields = sigFields.TrueFieldsAsList let m1 = implFields |> NameMap.ofKeyedList (fun rfld -> rfld.LogicalName) let m2 = sigFields |> NameMap.ofKeyedList (fun rfld -> rfld.LogicalName) NameMap.suball2 (fun fieldName _ -> errorR(Error (FSComp.SR.DefinitionsInSigAndImplNotCompatibleFieldRequiredButNotSpecified(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName, fieldName), m)); false) - (checkField aenv infoReader implTycon) m1 m2 && + (checkField aenv infoReader implTycon signTycon) m1 m2 && (if isStruct then NameMap.suball2 (fun fieldName _ -> warning(Error (FSComp.SR.DefinitionsInSigAndImplNotCompatibleFieldIsInImplButNotSig(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName, fieldName), m)); true) - (fun x y -> checkField aenv infoReader implTycon y x) m2 m1 + (fun x y -> checkField aenv infoReader implTycon signTycon y x) m2 m1 else true) - and checkTypeRepr m aenv (infoReader: InfoReader) (implTycon: Tycon) sigTypeRepr = + and checkTypeRepr m aenv (infoReader: InfoReader) (implTycon: Tycon) (sigTycon: Tycon) = let reportNiceError k s1 s2 = let aset = NameSet.ofList s1 let fset = NameSet.ofList s2 @@ -504,7 +505,7 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = | l -> (errorR (Error (FSComp.SR.DefinitionsInSigAndImplNotCompatibleSignatureDefinesButImplDoesNot(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName, k, String.concat ";" l), m)); false) | l -> (errorR (Error (FSComp.SR.DefinitionsInSigAndImplNotCompatibleImplDefinesButSignatureDoesNot(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName, k, String.concat ";" l), m)); false) - match implTycon.TypeReprInfo, sigTypeRepr with + match implTycon.TypeReprInfo, sigTycon.TypeReprInfo with | (TILObjectRepr _ #if !NO_TYPEPROVIDERS | TProvidedTypeRepr _ @@ -530,12 +531,12 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = if ucases1.Length <> ucases2.Length then let names (l: UnionCase list) = l |> List.map (fun c -> c.Id.idText) reportNiceError "union case" (names ucases1) (names ucases2) - else List.forall2 (checkUnionCase aenv infoReader implTycon) ucases1 ucases2 + else List.forall2 (checkUnionCase aenv infoReader implTycon sigTycon) ucases1 ucases2 // Record types are compatible with union types in signature | TFSharpTyconRepr { fsobjmodel_kind=TFSharpRecord; fsobjmodel_rfields=implFields}, TFSharpTyconRepr { fsobjmodel_kind=TFSharpRecord; fsobjmodel_rfields=sigFields} -> - checkRecordFields m aenv infoReader implTycon implFields sigFields + checkRecordFields m aenv infoReader implTycon sigTycon implFields sigFields // Record types are compatible with union types in signature | TFSharpTyconRepr r1, TFSharpTyconRepr r2 -> @@ -563,7 +564,7 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) = false else let isStruct = (match r1.fsobjmodel_kind with TFSharpStruct -> true | _ -> false) - checkClassFields isStruct m aenv infoReader implTycon r1.fsobjmodel_rfields r2.fsobjmodel_rfields && + checkClassFields isStruct m aenv infoReader implTycon sigTycon r1.fsobjmodel_rfields r2.fsobjmodel_rfields && checkVirtualSlots denv infoReader m implTycon r1.fsobjmodel_vslots r2.fsobjmodel_vslots | TAsmRepr tcr1, TAsmRepr tcr2 -> if tcr1 <> tcr2 then (errorR (Error(FSComp.SR.DefinitionsInSigAndImplNotCompatibleILDiffer(implTycon.TypeOrMeasureKind.ToString(), implTycon.DisplayName), m)); false) else true diff --git a/src/Compiler/Checking/SignatureConformance.fsi b/src/Compiler/Checking/SignatureConformance.fsi index b5128a05970..c0939f92b35 100644 --- a/src/Compiler/Checking/SignatureConformance.fsi +++ b/src/Compiler/Checking/SignatureConformance.fsi @@ -7,6 +7,7 @@ module internal FSharp.Compiler.SignatureConformance open System.Text open FSharp.Compiler +open FSharp.Compiler.Syntax open FSharp.Compiler.Text open FSharp.Compiler.TypedTree open FSharp.Compiler.TypedTreeOps @@ -26,10 +27,19 @@ exception UnionCaseNotContained of DisplayEnv * InfoReader * Tycon * UnionCase * exception FSharpExceptionNotContained of DisplayEnv * InfoReader * Tycon * Tycon * (string * string -> string) -exception FieldNotContained of DisplayEnv * InfoReader * Tycon * RecdField * RecdField * (string * string -> string) +exception FieldNotContained of + DisplayEnv * + InfoReader * + Tycon * + Tycon * + RecdField * + RecdField * + (string * string -> string) exception InterfaceNotRevealed of DisplayEnv * TType * range +exception ArgumentsInSigAndImplMismatch of sigArg: Ident * implArg: Ident + type Checker = new: diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index a8417dcf146..0ec2a8ce98b 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -79,6 +79,7 @@ type Exception with member exn.DiagnosticRange = match exn with + | ArgumentsInSigAndImplMismatch (_, implArg) -> Some implArg.idRange | ErrorFromAddingConstraint (_, exn2, _) -> exn2.DiagnosticRange #if !NO_TYPEPROVIDERS | TypeProviders.ProvidedTypeResolutionNoRange exn -> exn.DiagnosticRange @@ -157,7 +158,7 @@ type Exception with | IndeterminateType m | TyconBadArgs (_, _, _, m) -> Some m - | FieldNotContained (_, _, _, arf, _, _) -> Some arf.Range + | FieldNotContained (_, _, _, _, arf, _, _) -> Some arf.Range | ValueNotContained (_, _, _, aval, _, _) -> Some aval.Range | UnionCaseNotContained (_, _, _, aval, _, _) -> Some aval.Id.idRange | FSharpExceptionNotContained (_, _, aexnc, _, _) -> Some aexnc.Range @@ -319,6 +320,7 @@ type Exception with | BadEventTransformation _ -> 91 | HashLoadedScriptConsideredSource _ -> 92 | UnresolvedConversionOperator _ -> 93 + | ArgumentsInSigAndImplMismatch _ -> 3218 // avoid 94-100 for safety | ObsoleteError _ -> 101 #if !NO_TYPEPROVIDERS @@ -600,6 +602,7 @@ module OldStyleMessages = let LoadedSourceNotFoundIgnoringE () = Message("LoadedSourceNotFoundIgnoring", "%s") let MSBuildReferenceResolutionErrorE () = Message("MSBuildReferenceResolutionError", "%s%s") let TargetInvocationExceptionWrapperE () = Message("TargetInvocationExceptionWrapper", "%s") + let ArgumentsInSigAndImplMismatchE () = Message("ArgumentsInSigAndImplMismatch", "%s%s") #if DEBUG let mutable showParserStackOnParseError = false @@ -1571,7 +1574,7 @@ type Exception with ) ) - | FieldNotContained (denv, infoReader, enclosingTycon, v1, v2, f) -> + | FieldNotContained (denv, infoReader, enclosingTycon, _, v1, v2, f) -> let enclosingTcref = mkLocalEntityRef enclosingTycon os.AppendString( @@ -1870,6 +1873,9 @@ type Exception with | MSBuildReferenceResolutionError (code, message, _) -> os.AppendString(MSBuildReferenceResolutionErrorE().Format message code) + | ArgumentsInSigAndImplMismatch (sigArg, implArg) -> + os.AppendString(ArgumentsInSigAndImplMismatchE().Format sigArg.idText implArg.idText) + // Strip TargetInvocationException wrappers | :? TargetInvocationException as exn -> exn.InnerException.Output(os, suggestNames) diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index ff3f8ef15db..9f091d07533 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1491,7 +1491,6 @@ notAFunctionButMaybeIndexerWithName2,"This value is not a function and cannot be notAFunctionButMaybeIndexer2,"This expression is not a function and cannot be applied. Did you intend to access the indexer via 'expr[index]'?" 3217,notAFunctionButMaybeIndexerErrorCode,"" notAFunctionButMaybeDeclaration,"This value is not a function and cannot be applied. Did you forget to terminate a declaration?" -3218,ArgumentsInSigAndImplMismatch,"The argument names in the signature '%s' and implementation '%s' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling." 3219,pickleUnexpectedNonZero,"An error occurred while reading the F# metadata of assembly '%s'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct." 3220,tcTupleMemberNotNormallyUsed,"This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead." 3221,implicitlyDiscardedInSequenceExpression,"This expression returns a value of type '%s' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'." diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx index da3829dbc5c..04946671a84 100644 --- a/src/Compiler/FSStrings.resx +++ b/src/Compiler/FSStrings.resx @@ -1113,6 +1113,9 @@ Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + keyword 'while!' diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index 92276d105ec..0fa4172c7d6 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -440,12 +440,12 @@ - - + + diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index 81d7ce5d776..6eaa8a713e5 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -4703,7 +4703,7 @@ type FsiEvaluationSession let errs = diagnosticsLogger.GetDiagnostics() let errorInfos = - DiagnosticHelpers.CreateDiagnostics(errorOptions, true, scriptFile, errs, true, tcConfigB.flatErrors) + DiagnosticHelpers.CreateDiagnostics(errorOptions, true, scriptFile, errs, true, tcConfigB.flatErrors, None) let userRes = match res with diff --git a/src/Compiler/Service/FSharpCheckerResults.fs b/src/Compiler/Service/FSharpCheckerResults.fs index 33840d6c434..8e06873f75e 100644 --- a/src/Compiler/Service/FSharpCheckerResults.fs +++ b/src/Compiler/Service/FSharpCheckerResults.fs @@ -2442,21 +2442,16 @@ module internal ParseAndCheckFile = let fileInfo = sourceText.GetLastCharacterPosition() let collectOne severity diagnostic = - for diagnostic in - DiagnosticHelpers.ReportDiagnostic( - options, - false, - mainInputFileName, - fileInfo, - diagnostic, - severity, - suggestNamesForErrors, - flatErrors - ) do - diagnosticsCollector.Add diagnostic + // 1. Extended diagnostic data should be created after typechecking because it requires a valid SymbolEnv + // 2. Diagnostic message should be created during the diagnostic sink, because after typechecking + // the formatting of types in it may change (for example, 'a to obj) + // + // So we'll create a diagnostic later, but cache the FormatCore message now + diagnostic.Exception.Data[ "CachedFormatCore" ] <- diagnostic.FormatCore(flatErrors, suggestNamesForErrors) + diagnosticsCollector.Add(struct (diagnostic, severity)) - if severity = FSharpDiagnosticSeverity.Error then - errorCount <- errorCount + 1 + if severity = FSharpDiagnosticSeverity.Error then + errorCount <- errorCount + 1 // This function gets called whenever an error happens during parsing or checking let diagnosticSink severity (diagnostic: PhasedDiagnostic) = @@ -2495,8 +2490,6 @@ module internal ParseAndCheckFile = // Public members member _.DiagnosticsLogger = diagnosticsLogger - member _.CollectedDiagnostics = diagnosticsCollector.ToArray() - member _.ErrorCount = errorCount member _.DiagnosticOptions @@ -2504,6 +2497,23 @@ module internal ParseAndCheckFile = member _.AnyErrors = errorCount > 0 + member _.CollectedDiagnostics(symbolEnv: SymbolEnv option) = + [| + for struct (diagnostic, severity) in diagnosticsCollector do + yield! + DiagnosticHelpers.ReportDiagnostic( + options, + false, + mainInputFileName, + fileInfo, + diagnostic, + severity, + suggestNamesForErrors, + flatErrors, + symbolEnv + ) + |] + let getLightSyntaxStatus fileName options = let indentationAwareSyntaxOnByDefault = List.exists (FileSystemUtils.checkSuffix fileName) FSharpIndentationAwareSyntaxFileSuffixes @@ -2713,7 +2723,7 @@ module internal ParseAndCheckFile = errHandler.DiagnosticsLogger.StopProcessingRecovery e range0 // don't re-raise any exceptions, we must return None. EmptyParsedInput(fileName, (isLastCompiland, isExe))) - errHandler.CollectedDiagnostics, parseResult, errHandler.AnyErrors + errHandler.CollectedDiagnostics(None), parseResult, errHandler.AnyErrors let ApplyLoadClosure ( @@ -2915,28 +2925,29 @@ module internal ParseAndCheckFile = return ((tcState.TcEnvFromSignatures, EmptyTopAttrs, [], [ mty ]), tcState) } - let errors = errHandler.CollectedDiagnostics + let (tcEnvAtEnd, _, implFiles, ccuSigsForFiles), tcState = resOpt + + let symbolEnv = SymbolEnv(tcGlobals, tcState.Ccu, Some tcState.CcuSig, tcImports) + let errors = errHandler.CollectedDiagnostics(Some symbolEnv) let res = - match resOpt with - | (tcEnvAtEnd, _, implFiles, ccuSigsForFiles), tcState -> - TypeCheckInfo( - tcConfig, - tcGlobals, - List.head ccuSigsForFiles, - tcState.Ccu, - tcImports, - tcEnvAtEnd.AccessRights, - projectFileName, - mainInputFileName, - projectOptions, - sink.GetResolutions(), - sink.GetSymbolUses(), - tcEnvAtEnd.NameEnv, - loadClosure, - List.tryHead implFiles, - sink.GetOpenDeclarations() - ) + TypeCheckInfo( + tcConfig, + tcGlobals, + List.head ccuSigsForFiles, + tcState.Ccu, + tcImports, + tcEnvAtEnd.AccessRights, + projectFileName, + mainInputFileName, + projectOptions, + sink.GetResolutions(), + sink.GetSymbolUses(), + tcEnvAtEnd.NameEnv, + loadClosure, + List.tryHead implFiles, + sink.GetOpenDeclarations() + ) return errors, res } diff --git a/src/Compiler/Service/IncrementalBuild.fs b/src/Compiler/Service/IncrementalBuild.fs index 3f3d040ae73..646bf2c4396 100644 --- a/src/Compiler/Service/IncrementalBuild.fs +++ b/src/Compiler/Service/IncrementalBuild.fs @@ -1642,7 +1642,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc Array.ofList delayedLogger.Diagnostics, false diagnostics |> Array.map (fun (diagnostic, severity) -> - FSharpDiagnostic.CreateFromException(diagnostic, severity, range.Zero, suggestNamesForErrors, flatErrors)) + FSharpDiagnostic.CreateFromException(diagnostic, severity, range.Zero, suggestNamesForErrors, flatErrors, None)) return builderOpt, diagnostics - } \ No newline at end of file + } diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 6727c11af63..f4ecaad9355 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -106,7 +106,7 @@ module CompileHelpers = { new DiagnosticsLogger("CompileAPI") with member _.DiagnosticSink(diag, isError) = - diagnostics.Add(FSharpDiagnostic.CreateFromException(diag, isError, range0, true, flatErrors)) // Suggest names for errors + diagnostics.Add(FSharpDiagnostic.CreateFromException(diag, isError, range0, true, flatErrors, None)) // Suggest names for errors member _.ErrorCount = diagnostics @@ -556,7 +556,8 @@ type BackgroundCompiler fileName, parseDiagnostics, suggestNamesForErrors, - builder.TcConfig.flatErrors + builder.TcConfig.flatErrors, + None ) let diagnostics = [| yield! creationDiags; yield! parseDiagnostics |] @@ -857,6 +858,10 @@ type BackgroundCompiler let tcDiagnostics = tcInfo.TcDiagnostics let diagnosticsOptions = builder.TcConfig.diagnosticsOptions + let symbolEnv = + SymbolEnv(tcProj.TcGlobals, tcInfo.tcState.Ccu, Some tcInfo.tcState.CcuSig, tcProj.TcImports) + |> Some + let parseDiagnostics = DiagnosticHelpers.CreateDiagnostics( diagnosticsOptions, @@ -864,7 +869,8 @@ type BackgroundCompiler fileName, parseDiagnostics, suggestNamesForErrors, - builder.TcConfig.flatErrors + builder.TcConfig.flatErrors, + None ) let parseDiagnostics = [| yield! creationDiags; yield! parseDiagnostics |] @@ -876,7 +882,8 @@ type BackgroundCompiler fileName, tcDiagnostics, suggestNamesForErrors, - builder.TcConfig.flatErrors + builder.TcConfig.flatErrors, + symbolEnv ) let tcDiagnostics = [| yield! creationDiags; yield! tcDiagnostics |] @@ -1030,6 +1037,10 @@ type BackgroundCompiler let tcDiagnostics = tcInfo.TcDiagnostics let tcDependencyFiles = tcInfo.tcDependencyFiles + let symbolEnv = + SymbolEnv(tcProj.TcGlobals, tcInfo.tcState.Ccu, Some tcInfo.tcState.CcuSig, tcProj.TcImports) + |> Some + let tcDiagnostics = DiagnosticHelpers.CreateDiagnostics( diagnosticsOptions, @@ -1037,7 +1048,8 @@ type BackgroundCompiler fileName, tcDiagnostics, suggestNamesForErrors, - builder.TcConfig.flatErrors + builder.TcConfig.flatErrors, + symbolEnv ) let diagnostics = [| yield! creationDiags; yield! tcDiagnostics |] @@ -1204,7 +1216,7 @@ type BackgroundCompiler let diags = loadClosure.LoadClosureRootFileDiagnostics |> List.map (fun (exn, isError) -> - FSharpDiagnostic.CreateFromException(exn, isError, range.Zero, false, options.OtherOptions |> Array.contains "--flaterrors")) + FSharpDiagnostic.CreateFromException(exn, isError, range.Zero, false, options.OtherOptions |> Array.contains "--flaterrors", None)) return options, (diags @ diagnostics.Diagnostics) } diff --git a/src/Compiler/Symbols/FSharpDiagnostic.fs b/src/Compiler/Symbols/FSharpDiagnostic.fs index f621860d6a1..868868d8591 100644 --- a/src/Compiler/Symbols/FSharpDiagnostic.fs +++ b/src/Compiler/Symbols/FSharpDiagnostic.fs @@ -9,11 +9,19 @@ namespace FSharp.Compiler.Diagnostics open System -open Internal.Utilities.Library +open FSharp.Compiler.CheckExpressions +open FSharp.Compiler.ConstraintSolver +open FSharp.Compiler.SignatureConformance +open FSharp.Compiler.Symbols +open FSharp.Compiler.Syntax +open FSharp.Compiler.TypedTree +open FSharp.Compiler.TypedTreeBasics +open FSharp.Compiler.TypedTreeOps +open Internal.Utilities.Library open Internal.Utilities.Library.Extras open FSharp.Core.Printf -open FSharp.Compiler +open FSharp.Compiler open FSharp.Compiler.CompilerDiagnostics open FSharp.Compiler.Diagnostics open FSharp.Compiler.DiagnosticsLogger @@ -21,7 +29,87 @@ open FSharp.Compiler.Text open FSharp.Compiler.Text.Position open FSharp.Compiler.Text.Range -type FSharpDiagnostic(m: range, severity: FSharpDiagnosticSeverity, message: string, subcategory: string, errorNum: int, numberPrefix: string) = +module ExtendedData = + [] + type DiagnosticContextInfo = + | NoContext + | IfExpression + | OmittedElseBranch + | ElseBranchResult + | RecordFields + | TupleInRecordFields + | CollectionElement + | ReturnInComputationExpression + | YieldInComputationExpression + | RuntimeTypeTest + | DowncastUsedInsteadOfUpcast + | FollowingPatternMatchClause + | PatternMatchGuard + | SequenceExpression + with + static member From(contextInfo: ContextInfo) = + match contextInfo with + | ContextInfo.NoContext -> NoContext + | ContextInfo.IfExpression _ -> IfExpression + | ContextInfo.OmittedElseBranch _ -> OmittedElseBranch + | ContextInfo.ElseBranchResult _ -> ElseBranchResult + | ContextInfo.RecordFields -> RecordFields + | ContextInfo.TupleInRecordFields -> TupleInRecordFields + | ContextInfo.CollectionElement _ -> CollectionElement + | ContextInfo.ReturnInComputationExpression -> ReturnInComputationExpression + | ContextInfo.YieldInComputationExpression -> YieldInComputationExpression + | ContextInfo.RuntimeTypeTest _ -> RuntimeTypeTest + | ContextInfo.DowncastUsedInsteadOfUpcast _ -> DowncastUsedInsteadOfUpcast + | ContextInfo.FollowingPatternMatchClause _ -> FollowingPatternMatchClause + | ContextInfo.PatternMatchGuard _ -> PatternMatchGuard + | ContextInfo.SequenceExpression _ -> SequenceExpression + + [] + type IFSharpDiagnosticExtendedData = interface end + + [] + type TypeMismatchDiagnosticExtendedData + internal (symbolEnv: SymbolEnv, dispEnv: DisplayEnv, expectedType: TType, actualType: TType, context: DiagnosticContextInfo) = + interface IFSharpDiagnosticExtendedData + + member x.ExpectedType = FSharpType(symbolEnv, expectedType) + member x.ActualType = FSharpType(symbolEnv, actualType) + member x.ContextInfo = context + member x.DisplayContext = FSharpDisplayContext(fun _ -> dispEnv) + + [] + type ExpressionIsAFunctionExtendedData + internal (symbolEnv: SymbolEnv, actualType: TType) = + interface IFSharpDiagnosticExtendedData + + member x.ActualType = FSharpType(symbolEnv, actualType) + + [] + type FieldNotContainedDiagnosticExtendedData + internal (symbolEnv: SymbolEnv, implTycon: Tycon, sigTycon: Tycon, signatureField: RecdField, implementationField: RecdField) = + interface IFSharpDiagnosticExtendedData + member x.SignatureField = FSharpField(symbolEnv, RecdFieldRef.RecdFieldRef(mkLocalTyconRef sigTycon, signatureField.Id.idText)) + member x.ImplementationField = FSharpField(symbolEnv, RecdFieldRef.RecdFieldRef(mkLocalTyconRef implTycon, implementationField.Id.idText)) + + [] + type ValueNotContainedDiagnosticExtendedData + internal (symbolEnv: SymbolEnv, signatureValue: Val, implValue: Val) = + interface IFSharpDiagnosticExtendedData + member x.SignatureValue = FSharpMemberOrFunctionOrValue(symbolEnv, mkLocalValRef signatureValue) + member x.ImplementationValue = FSharpMemberOrFunctionOrValue(symbolEnv, mkLocalValRef implValue) + + [] + type ArgumentsInSigAndImplMismatchExtendedData + internal(sigArg: Ident, implArg: Ident) = + interface IFSharpDiagnosticExtendedData + member x.SignatureName = sigArg.idText + member x.ImplementationName = implArg.idText + member x.SignatureRange = sigArg.idRange + member x.ImplementationRange = implArg.idRange + +open ExtendedData + +type FSharpDiagnostic(m: range, severity: FSharpDiagnosticSeverity, message: string, subcategory: string, errorNum: int, numberPrefix: string, extendedData: IFSharpDiagnosticExtendedData option) = member _.Range = m member _.Severity = severity @@ -50,13 +138,16 @@ type FSharpDiagnostic(m: range, severity: FSharpDiagnosticSeverity, message: str member _.FileName = m.FileName + [] + member _.ExtendedData = extendedData + member _.WithStart newStart = let m = mkFileIndexRange m.FileIndex newStart m.End - FSharpDiagnostic(m, severity, message, subcategory, errorNum, numberPrefix) + FSharpDiagnostic(m, severity, message, subcategory, errorNum, numberPrefix, extendedData) member _.WithEnd newEnd = let m = mkFileIndexRange m.FileIndex m.Start newEnd - FSharpDiagnostic(m, severity, message, subcategory, errorNum, numberPrefix) + FSharpDiagnostic(m, severity, message, subcategory, errorNum, numberPrefix, extendedData) override _.ToString() = let fileName = m.FileName @@ -71,15 +162,48 @@ type FSharpDiagnostic(m: range, severity: FSharpDiagnosticSeverity, message: str sprintf "%s (%d,%d)-(%d,%d) %s %s %s" fileName s.Line (s.Column + 1) e.Line (e.Column + 1) subcategory severity message /// Decompose a warning or error into parts: position, severity, message, error number - static member CreateFromException(diagnostic: PhasedDiagnostic, severity, fallbackRange: range, suggestNames: bool, flatErrors: bool) = - let m = match diagnostic.Range with Some m -> m | None -> fallbackRange - let msg = diagnostic.FormatCore(flatErrors, suggestNames) + static member CreateFromException(diagnostic: PhasedDiagnostic, severity, fallbackRange: range, suggestNames: bool, flatErrors: bool, symbolEnv: SymbolEnv option) = + let m = match diagnostic.Range with Some m -> m | None -> fallbackRange + let extendedData: IFSharpDiagnosticExtendedData option = + match symbolEnv with + | None -> None + | Some symbolEnv -> + + match diagnostic.Exception with + | ErrorFromAddingTypeEquation(_, displayEnv, expectedType, actualType, ConstraintSolverTupleDiffLengths(contextInfo = contextInfo), _) + | ErrorFromAddingTypeEquation(_, displayEnv, expectedType, actualType, ConstraintSolverTypesNotInEqualityRelation(_, _, _, _, _, contextInfo), _) + | ErrorsFromAddingSubsumptionConstraint(_, displayEnv, expectedType, actualType, _, contextInfo, _) -> + let context = DiagnosticContextInfo.From(contextInfo) + Some(TypeMismatchDiagnosticExtendedData(symbolEnv, displayEnv, expectedType, actualType, context)) + + | ErrorFromAddingTypeEquation(_, displayEnv, expectedType, actualType, _, _)-> + Some(TypeMismatchDiagnosticExtendedData(symbolEnv, displayEnv, expectedType, actualType, DiagnosticContextInfo.NoContext)) + + | FunctionValueUnexpected(_, actualType, _) -> + Some(ExpressionIsAFunctionExtendedData(symbolEnv, actualType)) + + | FieldNotContained(_, _, implEntity, sigEntity, impl, sign, _) -> + Some(FieldNotContainedDiagnosticExtendedData(symbolEnv, implEntity, sigEntity, sign, impl)) + + | ValueNotContained(_, _, _, implValue, sigValue, _) -> + Some(ValueNotContainedDiagnosticExtendedData(symbolEnv, sigValue, implValue)) + + | ArgumentsInSigAndImplMismatch(sigArg, implArg) -> + Some(ArgumentsInSigAndImplMismatchExtendedData(sigArg, implArg)) + + | _ -> None + + let msg = + match diagnostic.Exception.Data["CachedFormatCore"] with + | :? string as message -> message + | _ -> diagnostic.FormatCore(flatErrors, suggestNames) + let errorNum = diagnostic.Number - FSharpDiagnostic(m, severity, msg, diagnostic.Subcategory(), errorNum, "FS") + FSharpDiagnostic(m, severity, msg, diagnostic.Subcategory(), errorNum, "FS", extendedData) /// Decompose a warning or error into parts: position, severity, message, error number - static member CreateFromExceptionAndAdjustEof(diagnostic, severity, fallbackRange: range, (linesCount: int, lastLength: int), suggestNames: bool, flatErrors: bool) = - let diagnostic = FSharpDiagnostic.CreateFromException(diagnostic, severity, fallbackRange, suggestNames, flatErrors) + static member CreateFromExceptionAndAdjustEof(diagnostic, severity, fallbackRange: range, (linesCount: int, lastLength: int), suggestNames: bool, flatErrors: bool, symbolEnv: SymbolEnv option) = + let diagnostic = FSharpDiagnostic.CreateFromException(diagnostic, severity, fallbackRange, suggestNames, flatErrors, symbolEnv) // Adjust to make sure that diagnostics reported at Eof are shown at the linesCount let startLine, startChanged = min (Line.toZ diagnostic.Range.StartLine, false) (linesCount, true) @@ -98,7 +222,7 @@ type FSharpDiagnostic(m: range, severity: FSharpDiagnosticSeverity, message: str static member Create(severity, message, number, range, ?numberPrefix, ?subcategory) = let subcategory = defaultArg subcategory BuildPhaseSubcategory.TypeCheck let numberPrefix = defaultArg numberPrefix "FS" - FSharpDiagnostic(range, severity, message, subcategory, number, numberPrefix) + FSharpDiagnostic(range, severity, message, subcategory, number, numberPrefix, None) /// Use to reset error and warning handlers [] @@ -110,7 +234,7 @@ type DiagnosticsScope(flatErrors: bool) = { new DiagnosticsLogger("DiagnosticsScope") with member _.DiagnosticSink(diagnostic, severity) = - let diagnostic = FSharpDiagnostic.CreateFromException(diagnostic, severity, range.Zero, false, flatErrors) + let diagnostic = FSharpDiagnostic.CreateFromException(diagnostic, severity, range.Zero, false, flatErrors, None) diags <- diagnostic :: diags member _.ErrorCount = diags.Length } @@ -184,7 +308,7 @@ type internal CompilationDiagnosticLogger (debugName: string, options: FSharpDia module DiagnosticHelpers = - let ReportDiagnostic (options: FSharpDiagnosticOptions, allErrors, mainInputFileName, fileInfo, diagnostic: PhasedDiagnostic, severity, suggestNames, flatErrors) = + let ReportDiagnostic (options: FSharpDiagnosticOptions, allErrors, mainInputFileName, fileInfo, diagnostic: PhasedDiagnostic, severity, suggestNames, flatErrors, symbolEnv) = [ let severity = if diagnostic.ReportAsError (options, severity) then FSharpDiagnosticSeverity.Error @@ -198,12 +322,12 @@ module DiagnosticHelpers = // We use the first line of the file as a fallbackRange for reporting unexpected errors. // Not ideal, but it's hard to see what else to do. let fallbackRange = rangeN mainInputFileName 1 - let diagnostic = FSharpDiagnostic.CreateFromExceptionAndAdjustEof (diagnostic, severity, fallbackRange, fileInfo, suggestNames, flatErrors) + let diagnostic = FSharpDiagnostic.CreateFromExceptionAndAdjustEof (diagnostic, severity, fallbackRange, fileInfo, suggestNames, flatErrors, symbolEnv) let fileName = diagnostic.Range.FileName if allErrors || fileName = mainInputFileName || fileName = TcGlobals.DummyFileNameForRangesWithoutASpecificLocation then yield diagnostic ] - let CreateDiagnostics (options, allErrors, mainInputFileName, diagnostics, suggestNames, flatErrors) = + let CreateDiagnostics (options, allErrors, mainInputFileName, diagnostics, suggestNames, flatErrors, symbolEnv) = let fileInfo = (Int32.MaxValue, Int32.MaxValue) [| for diagnostic, severity in diagnostics do - yield! ReportDiagnostic (options, allErrors, mainInputFileName, fileInfo, diagnostic, severity, suggestNames, flatErrors) |] + yield! ReportDiagnostic (options, allErrors, mainInputFileName, fileInfo, diagnostic, severity, suggestNames, flatErrors, symbolEnv) |] diff --git a/src/Compiler/Symbols/FSharpDiagnostic.fsi b/src/Compiler/Symbols/FSharpDiagnostic.fsi index fca4ad77061..252a15a33c1 100644 --- a/src/Compiler/Symbols/FSharpDiagnostic.fsi +++ b/src/Compiler/Symbols/FSharpDiagnostic.fsi @@ -7,9 +7,102 @@ namespace FSharp.Compiler.Diagnostics open System +open FSharp.Compiler.Symbols open FSharp.Compiler.Text open FSharp.Compiler.DiagnosticsLogger +module public ExtendedData = + /// Information about the context of a type equation in type-mismatch-like diagnostic + [] + type public DiagnosticContextInfo = + /// No context was given + | NoContext + /// The type equation comes from an IF expression + | IfExpression + /// The type equation comes from an omitted else branch + | OmittedElseBranch + /// The type equation comes from a type check of the result of an else branch + | ElseBranchResult + /// The type equation comes from the verification of record fields + | RecordFields + /// The type equation comes from the verification of a tuple in record fields + | TupleInRecordFields + /// The type equation comes from a list or array constructor + | CollectionElement + /// The type equation comes from a return in a computation expression + | ReturnInComputationExpression + /// The type equation comes from a yield in a computation expression + | YieldInComputationExpression + /// The type equation comes from a runtime type test + | RuntimeTypeTest + /// The type equation comes from an downcast where a upcast could be used + | DowncastUsedInsteadOfUpcast + /// The type equation comes from a return type of a pattern match clause (not the first clause) + | FollowingPatternMatchClause + /// The type equation comes from a pattern match guard + | PatternMatchGuard + /// The type equation comes from a sequence expression + | SequenceExpression + + /// Contextually-relevant data to each particular diagnostic + [] + type public IFSharpDiagnosticExtendedData = + interface + end + + /// Additional data for type-mismatch-like (usually with ErrorNumber = 1) diagnostics + [] + type public TypeMismatchDiagnosticExtendedData = + interface IFSharpDiagnosticExtendedData + /// Represents F# type expected in the current context + member ExpectedType: FSharpType + /// Represents F# type type actual in the current context + member ActualType: FSharpType + /// The context in which the type mismatch was found + member ContextInfo: DiagnosticContextInfo + /// Represents the information needed to format types + member DisplayContext: FSharpDisplayContext + + /// Additional data for 'This expression is a function value, i.e. is missing arguments' diagnostic + [] + type public ExpressionIsAFunctionExtendedData = + interface IFSharpDiagnosticExtendedData + /// Represents F# type of the expression + member ActualType: FSharpType + + /// Additional data for diagnostics about a field whose declarations differ in signature and implementation + [] + type public FieldNotContainedDiagnosticExtendedData = + interface IFSharpDiagnosticExtendedData + /// Represents F# field in signature file + member SignatureField: FSharpField + /// Represents F# field in implementation file + member ImplementationField: FSharpField + + /// Additional data for diagnostics about a value whose declarations differ in signature and implementation + [] + type public ValueNotContainedDiagnosticExtendedData = + interface IFSharpDiagnosticExtendedData + /// Represents F# value in signature file + member SignatureValue: FSharpMemberOrFunctionOrValue + /// Represents F# value in implementation file + member ImplementationValue: FSharpMemberOrFunctionOrValue + + /// Additional data for 'argument names in the signature and implementation do not match' diagnostic + [] + type ArgumentsInSigAndImplMismatchExtendedData = + interface IFSharpDiagnosticExtendedData + /// Argument name in signature file + member SignatureName: string + /// Argument name in implementation file + member ImplementationName: string + /// Argument identifier range within signature file + member SignatureRange: range + /// Argument identifier range within implementation file + member ImplementationRange: range + +open ExtendedData + /// Represents a diagnostic produced by the F# compiler [] type public FSharpDiagnostic = @@ -56,6 +149,10 @@ type public FSharpDiagnostic = /// Gets the full error number text e.g "FS0031" member ErrorNumberText: string + /// Gets the contextually-relevant data to each particular diagnostic for things like code fixes + [] + member ExtendedData: IFSharpDiagnosticExtendedData option + /// Creates a diagnostic, e.g. for reporting from an analyzer static member Create: severity: FSharpDiagnosticSeverity * @@ -72,7 +169,8 @@ type public FSharpDiagnostic = range * lastPosInFile: (int * int) * suggestNames: bool * - flatErrors: bool -> + flatErrors: bool * + symbolEnv: SymbolEnv option -> FSharpDiagnostic static member internal CreateFromException: @@ -80,7 +178,8 @@ type public FSharpDiagnostic = severity: FSharpDiagnosticSeverity * range * suggestNames: bool * - flatErrors: bool -> + flatErrors: bool * + symbolEnv: SymbolEnv option -> FSharpDiagnostic /// Newlines are recognized and replaced with (ASCII 29, the 'group separator'), @@ -128,7 +227,8 @@ module internal DiagnosticHelpers = diagnostic: PhasedDiagnostic * severity: FSharpDiagnosticSeverity * suggestNames: bool * - flatErrors: bool -> + flatErrors: bool * + symbolEnv: SymbolEnv option -> FSharpDiagnostic list val CreateDiagnostics: @@ -137,5 +237,6 @@ module internal DiagnosticHelpers = mainInputFileName: string * seq * suggestNames: bool * - flatErrors: bool -> + flatErrors: bool * + symbolEnv: SymbolEnv option -> FSharpDiagnostic[] diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index df678fb3840..52dc4b8f648 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -8292,11 +8292,6 @@ Tato hodnota není funkce a nedá se použít. Nezapomněli jste ukončit deklaraci? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - Názvy argumentů v signatuře {0} a implementaci {1} si neodpovídají. Použije se název argumentu ze souboru signatury. To může způsobit problémy při ladění nebo profilování. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. Při čtení metadat jazyka F# sestavení {0} došlo k chybě. Byl použit rezervovaný konstruktor. Je možné, že budete muset upgradovat kompilátor jazyka F# nebo použít dřívější verzi sestavení, ve které se nevyužívá konkrétní konstruktor. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index ae083bc3434..e03fb2842a3 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -8292,11 +8292,6 @@ Dieser Wert ist keine Funktion und kann nicht angewendet werden. Wurde möglicherweise eine Deklaration nicht abgeschlossen? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - Die Argumentnamen in Signatur "{0}" und Implementierung "{1}" stimmen nicht überein. Der Argumentname aus der Signaturdatei wird verwendet. Dadurch können Probleme beim Debuggen oder bei der Profilerstellung auftreten. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. Fehler beim Lesen der F#-Metadaten der Assembly "{0}". Es wurde ein reserviertes Konstrukt verwendet. Möglicherweise müssen Sie Ihren F#-Compiler aktualisieren oder eine frühere Version der Assembly verwenden, die dieses spezielle Konstrukt nicht verwendet. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 43932120280..827cc7aaff7 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -8292,11 +8292,6 @@ Este valor no es una función y no se puede aplicar. ¿Olvidó terminar una declaración? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - Los nombres de argumento en la firma "{0}" y la implementación "{1}" no coinciden. Se utilizará el nombre del argumento desde el archivo de firma. Esto puede causar problemas durante la depuración o la generación de perfiles. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. Se produjo un error al leer los metadatos de F# del ensamblado "{0}". Se utilizó una construcción reservada. Puede que deba actualizar su compilador de F# o usar una versión anterior del ensamblado que no haga uso de una construcción específica. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index f556dc0e60c..59e745efb6b 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -8292,11 +8292,6 @@ Cette valeur n'est pas une fonction et ne peut pas être appliquée. Avez-vous oublié de terminer une déclaration ? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - Les noms d'arguments dans la signature '{0}' et l'implémentation '{1}' ne correspondent pas. Le nom d'argument du fichier de signature va être utilisé. Cela peut entraîner des problèmes durant le débogage ou le profilage. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. Une erreur s'est produite durant la lecture des métadonnées F# de l'assembly '{0}'. Une construction réservée a été utilisée. Vous devrez peut-être mettre à niveau votre compilateur F# ou utiliser une version antérieure de l'assembly qui ne fait pas appel à une construction spécifique. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 4c119a33d12..3b3bcd658c0 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -8292,11 +8292,6 @@ Questo valore non è una funzione e non può essere applicato. Potrebbe essere presente una dichiarazione non terminata. - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - I nomi degli argomenti nella firma '{0}' e nell'implementazione '{1}' non corrispondono. Verrà usato il nome dell'argomento del file di firma. Questa situazione potrebbe causare problemi durante il debug o la profilatura. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. Si è verificato un errore durante la lettura dei metadati F# dell'assembly '{0}'. È stato utilizzato un costrutto riservato. Potrebbe essere necessario aggiornare il compilatore F# o usare una versione precedente dell'assembly che non usa un costrutto specifico. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 1b8e87aba35..049db2ffa38 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -8292,11 +8292,6 @@ この値は関数ではないため、適用できません。宣言を終結しましたか? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - シグネチャ '{0}' と実装 '{1}' の引数の名前が一致しません。シグネチャ ファイルの引数の名前が使用されます。デバッグまたはプロファイルするときに問題が生じる原因となる可能性があります。 - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. アセンブリ '{0}' の F# メタデータ の読み取り中にエラーが発生しました。予約済みのコンストラクトが使用されました。F# コンパイラをアップグレードするか、特定のコンストラクトを使用しない以前のバージョンのアセンブリを使用しなければならない場合があります。 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 0020567546e..b1598f8fc53 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -8292,11 +8292,6 @@ 이 값은 함수가 아니며 적용할 수 없습니다. 선언을 종료해야 합니다. - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - 시그니처 '{0}'과(와) 구현 '{1}'의 인수 이름이 일치하지 않습니다. 시그니처 파일의 인수 이름이 사용됩니다. 이로 인해 디버깅 또는 프로파일링 시 문제가 발생할 수 있습니다. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. '{0}' 어셈블리의 F# 메타데이터를 읽는 동안 오류가 발생했습니다. 예약 구문이 활용되었습니다. F# 컴파일러를 업그레이드하거나 특정 구문을 사용하지 않는 이전 버전의 어셈블리를 사용해야 할 수 있습니다. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 05281e00c71..c5ba8412724 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -8292,11 +8292,6 @@ Ta wartość nie jest funkcją i nie można jej zastosować. Czy deklaracja została zakończona? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - Nazwy argumentów w podpisie „{0}” i implementacji „{1}” nie są zgodne. Używana będzie nazwa argumentu z pliku podpisu. Może to spowodować problemy podczas debugowania lub profilowania. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. Wystąpił błąd podczas odczytu metadanych języka F# z zestawu „{0}”. Została wykorzystana zarezerwowana konstrukcja. Może być konieczne uaktualnienie kompilatora języka F# lub użycie wcześniejszej wersji zestawu, która nie wykorzystuje określonej konstrukcji. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 0eba2d9314b..8e2cf14f74d 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -8292,11 +8292,6 @@ Este valor não é uma função e não pode ser aplicado. Você esqueceu de finalizar a declaração? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - Os nomes de argumento na assinatura '{0}' e na implementação '{1}' não coincidem. O nome do argumento do arquivo da assinatura será usado. Isso pode causar problemas durante a depuração ou a criação de perfil. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. Ocorreu um erro ao ler os metadados F# do assembly '{0}'. Foi utilizada um constructo reservado. Talvez seja necessário atualizar seu compilador F# ou usar uma versão anterior do assembly que não faça uso de um constructo específico. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index cb097a62717..2cbbdb37444 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -8292,11 +8292,6 @@ Данное значение не является функцией и не может быть применено. Забыли завершить объявление? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - Имена аргументов в сигнатуре "{0}" и реализации "{1}" не совпадают. Будет использоваться имя аргумента из файла сигнатуры. Это может вызвать проблемы при отладке или профилировании. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. Произошла ошибка при чтении метаданных F# сборки "{0}". Использовалась зарезервированная конструкция. Попробуйте обновить компилятор F# или применить более раннюю версию сборки, где конкретная конструкция не используется. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 6f7d4c805e9..146c1fffa58 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -8292,11 +8292,6 @@ Bu değer bir işlev değil ve uygulanamaz. Bir bildirimi sonlandırmayı mı unuttunuz? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - {0}' imzası ve '{1}' uygulaması içindeki bağımsız değişken adları eşleşmiyor. İmza dosyasındaki bağımsız değişken adı kullanılacak. Bu, hata ayıklama veya profil oluşturma sırasında sorunlara neden olabilir. - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. '{0}' bütünleştirilmiş kodunun F# meta verileri okunurken bir hata oluştu. Ayrılmış bir yapı kullanıldı. F# derleyicinizi yükseltmeniz veya bütünleştirilmiş kodun belirli bir yapıyı kullanmayan daha eski bir sürümünü kullanmanız gerekebilir. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 2607c85378a..2414d300d75 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -8292,11 +8292,6 @@ 此值不是一个函数,无法应用。您是否忘记结束某个声明? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - 签名“{0}”和实现“{1}”中的参数名称不匹配。将使用签名文件中的参数名称。在进行调试或分析时这可能会导致问题。 - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. 读取程序集“{0}”的 F# 元数据时出错。使用了保留的构造。可能需要升级 F# 编译器或使用不用特定构造的较早版本的程序集。 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index bfb346cd26f..4ab439ee37d 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -8292,11 +8292,6 @@ 這個值不是函式,無法套用。您是不是忘記終止宣告了? - - The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - 特徵標記 '{0}' 和實作 '{1}' 中的引數名稱不相符。將會使用特徵標記檔案中的引數名稱。這可能會在偵錯或分析時造成問題。 - - An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. 讀取組件 '{0}' 的 F# 中繼資料時發生錯誤。已使用保留的建構。建議您升級 F# 編譯器,或使用不會用特定建構的舊版組件。 diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index 4676ded7083..dfd401a1235 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Neshoda typů Očekává se řazená kolekce členů o délce {0} typu\n {1} \nale odevzdala se řazená kolekce členů o délce {2} typu\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 0b386bdd064..4a475b7d996 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Typenkonflikt. Es wurde ein Tupel der Länge {0} des Typs\n {1} \nerwartet, aber ein Tupel der Länge {2} des Typs\n {3}{4}\n angegeben. diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index a5008e7c476..0cf35d66609 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Error de coincidencia de tipos. Se espera una tupla de longitud {0} de tipo\n {1} \nperero se ha proporcionado una tupla de longitud {2} de tipo\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index a8ffac1edb2..75119276653 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Incompatibilité de type. Tuple de longueur attendu {0} de type\n {1} \nmais tuple de longueur {2} de type\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 9654664e86b..c107a1b23a8 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Tipo non corrispondente. È prevista una tupla di lunghezza {0} di tipo\n {1} \n, ma è stata specificata una tupla di lunghezza {2} di tipo\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index d5ec4d91da6..ab10c6411c9 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n 型が一致しません。型の長さ {0} のタプルが必要です\n {1} \nただし、型の長さ {2} のタプルが指定された場合\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index b4ee40c250c..90fa1ca9978 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n 유형 불일치. 형식이 \n {1}이고 길이가 {0}인 튜플이 필요합니다. \n그러나 형식이 \n {3}이고 길이가 {2}인 튜플이 제공되었습니다.{4}\n diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index b01d8256e3e..ba1c73e3063 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Niezgodność. Oczekiwano krotki o długości {0} typu\n {1} \nale otrzymano krotkę o długości {2} typu\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index 44b24e76174..d4a5fe07d6c 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Tipo incompatível. Esperando uma tupla de comprimento {0} do tipo\n {1} \nmas recebeu uma tupla de comprimento {2} do tipo\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 6d0c1b1d517..5a1bd97a582 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Несоответствие типов. Ожидается кортеж длиной {0} типа\n {1}, \nно предоставлен кортеж длиной {2} типа\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index 8758b001581..d27bebc5904 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n Tür uyuşmazlığı. {0} uzunluğunda türü\n {1} \nolan bir demet bekleniyordu ancak {2} uzunluğunda türü\n {3}{4}\nolan bir demet verildi diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index e21e73e60f7..986736b4010 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n 类型不匹配。应为长度为 {0} 的类型的元组\n {1} \n但提供了长度为 {2} 的类型的元组\n {3}{4}\n diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index 5d294f8b58a..27727b0b037 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -2,6 +2,11 @@ + + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + The argument names in the signature '{0}' and implementation '{1}' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. + + Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n 類型不符。必須是類型為\n {1} \n 的元組長度 {0},但提供的是類型為\n {3}{4}\n 的元組長度 {2} diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ExtendedDiagnosticDataTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ExtendedDiagnosticDataTests.fs new file mode 100644 index 00000000000..fea4dfddbb7 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ExtendedDiagnosticDataTests.fs @@ -0,0 +1,203 @@ +module ErrorMessages.ExtendedDiagnosticData +#nowarn "57" + +open FSharp.Compiler.Diagnostics +open FSharp.Compiler.Diagnostics.ExtendedData +open FSharp.Test +open FSharp.Test.Compiler +open Xunit + +let inline checkDiagnostic + (diagnosticNumber, message) + (check: 'a -> unit) + (checkResults: 'b when 'b: (member Diagnostics: FSharpDiagnostic[])) = + match checkResults.Diagnostics |> Array.tryFind (fun d -> d.ErrorNumber = diagnosticNumber) with + | None -> failwith "Expected diagnostic not found" + | Some diagnostic -> + + Assert.Equal(message, diagnostic.Message) + match diagnostic.ExtendedData with + | Some(:? 'a as data) -> check data + | _ -> failwith "Expected diagnostic extended data not found" + + +[] +let ``TypeMismatchDiagnosticExtendedData 01`` () = + FSharp """ +let x, y, z = 1, 2 +""" + |> typecheckResults + |> checkDiagnostic + (1, "Type mismatch. Expecting a tuple of length 3 of type\n 'a * 'b * 'c \nbut given a tuple of length 2 of type\n int * int \n") + (fun (typeMismatch: TypeMismatchDiagnosticExtendedData) -> + Assert.Equal(DiagnosticContextInfo.NoContext, typeMismatch.ContextInfo) + let displayContext = typeMismatch.DisplayContext + Assert.Equal("obj * obj * obj", typeMismatch.ExpectedType.Format(displayContext)) + Assert.Equal("int * int", typeMismatch.ActualType.Format(displayContext))) + +[] +let ``TypeMismatchDiagnosticExtendedData 02`` () = + FSharp """ +let x, y = 1 +""" + |> typecheckResults + |> checkDiagnostic + (1, "This expression was expected to have type\n ''a * 'b' \nbut here has type\n 'int' ") + (fun (typeMismatch: TypeMismatchDiagnosticExtendedData) -> + let displayContext = typeMismatch.DisplayContext + Assert.Equal(DiagnosticContextInfo.NoContext, typeMismatch.ContextInfo) + Assert.Equal("obj * obj", typeMismatch.ExpectedType.Format(displayContext)) + Assert.Equal("int", typeMismatch.ActualType.Format(displayContext))) + +[] +let ``TypeMismatchDiagnosticExtendedData 03`` () = + FSharp """ +if true then 5 +""" + |> typecheckResults + |> checkDiagnostic + (1, "This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'int'.") + (fun (typeMismatch: TypeMismatchDiagnosticExtendedData) -> + let displayContext = typeMismatch.DisplayContext + Assert.Equal(DiagnosticContextInfo.OmittedElseBranch, typeMismatch.ContextInfo) + Assert.Equal("unit", typeMismatch.ExpectedType.Format(displayContext)) + Assert.Equal("int", typeMismatch.ActualType.Format(displayContext))) + +[] +let ``TypeMismatchDiagnosticExtendedData 04`` () = + FSharp """ +1 :> string +""" + |> typecheckResults + |> checkDiagnostic + (193, "Type constraint mismatch. The type \n 'int' \nis not compatible with type\n 'string' \n") + (fun (typeMismatch: TypeMismatchDiagnosticExtendedData) -> + let displayContext = typeMismatch.DisplayContext + Assert.Equal(DiagnosticContextInfo.NoContext, typeMismatch.ContextInfo) + Assert.Equal("string", typeMismatch.ExpectedType.Format(displayContext)) + Assert.Equal("int", typeMismatch.ActualType.Format(displayContext))) + +[] +let ``TypeMismatchDiagnosticExtendedData 05`` () = + FSharp """ +match 0 with +| 0 -> 1 +| 1 -> "a" +""" + |> typecheckResults + |> checkDiagnostic + (1, "All branches of a pattern match expression must return values implicitly convertible to the type of the first branch, which here is 'int'. This branch returns a value of type 'string'.") + (fun (typeMismatch: TypeMismatchDiagnosticExtendedData) -> + let displayContext = typeMismatch.DisplayContext + Assert.Equal(DiagnosticContextInfo.FollowingPatternMatchClause, typeMismatch.ContextInfo) + Assert.Equal("int", typeMismatch.ExpectedType.Format(displayContext)) + Assert.Equal("string", typeMismatch.ActualType.Format(displayContext))) + +//TODO: FollowingPatternMatchClause should be provided for type equation diagnostics come from a return type only +[] +let ``TypeMismatchDiagnosticExtendedData 05 - TODO: fix wrong context`` () = + FSharp """ +let f (x: int) = () + +match 0 with +| 0 -> 1 +| 1 -> + let _ = f "a" + 1 +""" + |> typecheckResults + |> checkDiagnostic + (1, "This expression was expected to have type\n 'int' \nbut here has type\n 'string' ") + (fun (typeMismatch: TypeMismatchDiagnosticExtendedData) -> + let displayContext = typeMismatch.DisplayContext + Assert.Equal(DiagnosticContextInfo.FollowingPatternMatchClause, typeMismatch.ContextInfo) //Should be NoContext + Assert.Equal("int", typeMismatch.ExpectedType.Format(displayContext)) + Assert.Equal("string", typeMismatch.ActualType.Format(displayContext))) + +[] +let ``TypeMismatchDiagnosticExtendedData 06`` () = + FSharp """ +let _: bool = + if true then "a" else "b" +""" + |> typecheckResults + |> checkDiagnostic + (1, "The 'if' expression needs to have type 'bool' to satisfy context type requirements. It currently has type 'string'.") + (fun (typeMismatch: TypeMismatchDiagnosticExtendedData) -> + let displayContext = typeMismatch.DisplayContext + Assert.Equal(DiagnosticContextInfo.IfExpression, typeMismatch.ContextInfo) + Assert.Equal("bool", typeMismatch.ExpectedType.Format(displayContext)) + Assert.Equal("string", typeMismatch.ActualType.Format(displayContext))) + +[] +let ``TypeMismatchDiagnosticExtendedData 07`` () = + FSharp """ +if true then 1 else "a" +""" + |> typecheckResults + |> checkDiagnostic + (1, "All branches of an 'if' expression must return values implicitly convertible to the type of the first branch, which here is 'int'. This branch returns a value of type 'string'.") + (fun (typeMismatch: TypeMismatchDiagnosticExtendedData) -> + let displayContext = typeMismatch.DisplayContext + Assert.Equal(DiagnosticContextInfo.ElseBranchResult, typeMismatch.ContextInfo) + Assert.Equal("int", typeMismatch.ExpectedType.Format(displayContext)) + Assert.Equal("string", typeMismatch.ActualType.Format(displayContext))) + +[] +let ``ArgumentsInSigAndImplMismatchExtendedData 01`` () = + let encodeFsi = + Fsi """ +module Test +val f: x: int -> unit +""" + let encodeFs = + FsSource """ +module Test +let f (y: int) = () + """ + encodeFsi + |> withAdditionalSourceFile encodeFs + |> typecheckProject true + |> checkDiagnostic + (3218, "The argument names in the signature 'x' and implementation 'y' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling.") + (fun (argsMismatch: ArgumentsInSigAndImplMismatchExtendedData) -> + Assert.Equal("x", argsMismatch.SignatureName) + Assert.Equal("y", argsMismatch.ImplementationName) + Assert.True(argsMismatch.SignatureRange.FileName.EndsWith("fsi")) + Assert.True(argsMismatch.ImplementationRange.FileName.EndsWith("fs"))) + +[] +let ``FieldNotContainedDiagnosticExtendedData 01`` () = + let encodeFsi = + Fsi """ +namespace rec Foo +type A = + val public myStatic: int + """ + let encodeFs = + FsSource """ +namespace rec Foo +type A = + val private myStatic: int + """ + encodeFsi + |> withAdditionalSourceFile encodeFs + |> typecheckProject true + |> checkDiagnostic + (193, "The module contains the field\n myStatic: int \nbut its signature specifies\n myStatic: int \nthe accessibility specified in the signature is more than that specified in the implementation") + (fun (fieldsData: FieldNotContainedDiagnosticExtendedData) -> + Assert.True(fieldsData.SignatureField.Accessibility.IsPublic) + Assert.True(fieldsData.ImplementationField.Accessibility.IsPrivate)) + +[] +let ``ExpressionIsAFunctionExtendedData 01`` () = + FSharp """ +module Test + +id +""" + |> typecheckResults + |> checkDiagnostic + (193, "This expression is a function value, i.e. is missing arguments. Its type is 'a -> 'a.") + (fun (wrongType: ExpressionIsAFunctionExtendedData) -> + Assert.Equal("type 'a -> 'a", wrongType.ActualType.ToString())) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index c44ce76ff6b..a5c8d0ad7a1 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -187,6 +187,7 @@ + diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 9f3b2c381aa..62e28427927 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -2370,6 +2370,121 @@ FSharp.Compiler.Diagnostics.ActivityNames: System.String[] AllRelevantNames FSharp.Compiler.Diagnostics.ActivityNames: System.String[] get_AllRelevantNames() FSharp.Compiler.Diagnostics.CompilerDiagnostics: System.Collections.Generic.IEnumerable`1[System.String] GetSuggestedNames(Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.FSharpFunc`2[System.String,Microsoft.FSharp.Core.Unit],Microsoft.FSharp.Core.Unit], System.String) FSharp.Compiler.Diagnostics.CompilerDiagnostics: System.String GetErrorMessage(FSharp.Compiler.Diagnostics.FSharpDiagnosticKind) +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: FSharp.Compiler.Text.Range ImplementationRange +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: FSharp.Compiler.Text.Range SignatureRange +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: FSharp.Compiler.Text.Range get_ImplementationRange() +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: FSharp.Compiler.Text.Range get_SignatureRange() +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: System.String ImplementationName +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: System.String SignatureName +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: System.String get_ImplementationName() +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: System.String get_SignatureName() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 CollectionElement +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 DowncastUsedInsteadOfUpcast +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 ElseBranchResult +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 FollowingPatternMatchClause +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 IfExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 NoContext +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 OmittedElseBranch +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 PatternMatchGuard +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 RecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 ReturnInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 RuntimeTypeTest +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 SequenceExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 TupleInRecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 YieldInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean Equals(DiagnosticContextInfo) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean Equals(System.Object) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsCollectionElement +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsDowncastUsedInsteadOfUpcast +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsElseBranchResult +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsFollowingPatternMatchClause +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsIfExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsNoContext +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsOmittedElseBranch +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsPatternMatchGuard +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsRecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsReturnInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsRuntimeTypeTest +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsSequenceExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsTupleInRecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsYieldInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsCollectionElement() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsDowncastUsedInsteadOfUpcast() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsElseBranchResult() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsFollowingPatternMatchClause() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsIfExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsNoContext() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsOmittedElseBranch() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsPatternMatchGuard() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsRecordFields() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsReturnInComputationExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsRuntimeTypeTest() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsSequenceExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsTupleInRecordFields() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsYieldInComputationExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo CollectionElement +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo DowncastUsedInsteadOfUpcast +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo ElseBranchResult +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo FollowingPatternMatchClause +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo IfExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo NoContext +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo OmittedElseBranch +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo PatternMatchGuard +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo RecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo ReturnInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo RuntimeTypeTest +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo SequenceExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo TupleInRecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo YieldInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_CollectionElement() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_DowncastUsedInsteadOfUpcast() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_ElseBranchResult() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_FollowingPatternMatchClause() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_IfExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_NoContext() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_OmittedElseBranch() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_PatternMatchGuard() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_RecordFields() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_ReturnInComputationExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_RuntimeTypeTest() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_SequenceExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_TupleInRecordFields() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_YieldInComputationExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 CompareTo(DiagnosticContextInfo) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 CompareTo(System.Object) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 CompareTo(System.Object, System.Collections.IComparer) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 GetHashCode() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 GetHashCode(System.Collections.IEqualityComparer) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 Tag +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 get_Tag() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: System.String ToString() +FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType ActualType +FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType get_ActualType() +FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField ImplementationField +FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField SignatureField +FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_ImplementationField() +FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_SignatureField() +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo ContextInfo +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo get_ContextInfo() +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpDisplayContext DisplayContext +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpDisplayContext get_DisplayContext() +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpType ActualType +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpType ExpectedType +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpType get_ActualType() +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpType get_ExpectedType() +FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue ImplementationValue +FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue SignatureValue +FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue get_ImplementationValue() +FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue get_SignatureValue() +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnostic Create(FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity, System.String, Int32, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity Severity FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity get_Severity() @@ -2389,6 +2504,8 @@ FSharp.Compiler.Diagnostics.FSharpDiagnostic: Int32 get_EndLine() FSharp.Compiler.Diagnostics.FSharpDiagnostic: Int32 get_ErrorNumber() FSharp.Compiler.Diagnostics.FSharpDiagnostic: Int32 get_StartColumn() FSharp.Compiler.Diagnostics.FSharpDiagnostic: Int32 get_StartLine() +FSharp.Compiler.Diagnostics.FSharpDiagnostic: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData] ExtendedData +FSharp.Compiler.Diagnostics.FSharpDiagnostic: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData] get_ExtendedData() FSharp.Compiler.Diagnostics.FSharpDiagnostic: System.String ErrorNumberPrefix FSharp.Compiler.Diagnostics.FSharpDiagnostic: System.String ErrorNumberText FSharp.Compiler.Diagnostics.FSharpDiagnostic: System.String FileName diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 9f3b2c381aa..62e28427927 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -2370,6 +2370,121 @@ FSharp.Compiler.Diagnostics.ActivityNames: System.String[] AllRelevantNames FSharp.Compiler.Diagnostics.ActivityNames: System.String[] get_AllRelevantNames() FSharp.Compiler.Diagnostics.CompilerDiagnostics: System.Collections.Generic.IEnumerable`1[System.String] GetSuggestedNames(Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.FSharpFunc`2[System.String,Microsoft.FSharp.Core.Unit],Microsoft.FSharp.Core.Unit], System.String) FSharp.Compiler.Diagnostics.CompilerDiagnostics: System.String GetErrorMessage(FSharp.Compiler.Diagnostics.FSharpDiagnosticKind) +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: FSharp.Compiler.Text.Range ImplementationRange +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: FSharp.Compiler.Text.Range SignatureRange +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: FSharp.Compiler.Text.Range get_ImplementationRange() +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: FSharp.Compiler.Text.Range get_SignatureRange() +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: System.String ImplementationName +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: System.String SignatureName +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: System.String get_ImplementationName() +FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData: System.String get_SignatureName() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 CollectionElement +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 DowncastUsedInsteadOfUpcast +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 ElseBranchResult +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 FollowingPatternMatchClause +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 IfExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 NoContext +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 OmittedElseBranch +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 PatternMatchGuard +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 RecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 ReturnInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 RuntimeTypeTest +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 SequenceExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 TupleInRecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags: Int32 YieldInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean Equals(DiagnosticContextInfo) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean Equals(System.Object) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsCollectionElement +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsDowncastUsedInsteadOfUpcast +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsElseBranchResult +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsFollowingPatternMatchClause +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsIfExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsNoContext +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsOmittedElseBranch +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsPatternMatchGuard +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsRecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsReturnInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsRuntimeTypeTest +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsSequenceExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsTupleInRecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean IsYieldInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsCollectionElement() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsDowncastUsedInsteadOfUpcast() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsElseBranchResult() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsFollowingPatternMatchClause() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsIfExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsNoContext() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsOmittedElseBranch() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsPatternMatchGuard() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsRecordFields() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsReturnInComputationExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsRuntimeTypeTest() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsSequenceExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsTupleInRecordFields() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Boolean get_IsYieldInComputationExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo CollectionElement +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo DowncastUsedInsteadOfUpcast +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo ElseBranchResult +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo FollowingPatternMatchClause +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo IfExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo NoContext +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo OmittedElseBranch +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo PatternMatchGuard +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo RecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo ReturnInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo RuntimeTypeTest +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo SequenceExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo TupleInRecordFields +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo YieldInComputationExpression +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_CollectionElement() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_DowncastUsedInsteadOfUpcast() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_ElseBranchResult() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_FollowingPatternMatchClause() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_IfExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_NoContext() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_OmittedElseBranch() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_PatternMatchGuard() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_RecordFields() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_ReturnInComputationExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_RuntimeTypeTest() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_SequenceExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_TupleInRecordFields() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: DiagnosticContextInfo get_YieldInComputationExpression() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo+Tags +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 CompareTo(DiagnosticContextInfo) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 CompareTo(System.Object) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 CompareTo(System.Object, System.Collections.IComparer) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 GetHashCode() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 GetHashCode(System.Collections.IEqualityComparer) +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 Tag +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: Int32 get_Tag() +FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo: System.String ToString() +FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType ActualType +FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData: FSharp.Compiler.Symbols.FSharpType get_ActualType() +FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField ImplementationField +FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField SignatureField +FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_ImplementationField() +FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpField get_SignatureField() +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo ContextInfo +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: DiagnosticContextInfo get_ContextInfo() +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpDisplayContext DisplayContext +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpDisplayContext get_DisplayContext() +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpType ActualType +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpType ExpectedType +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpType get_ActualType() +FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpType get_ExpectedType() +FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue ImplementationValue +FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue SignatureValue +FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue get_ImplementationValue() +FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData: FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue get_SignatureValue() +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ArgumentsInSigAndImplMismatchExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+DiagnosticContextInfo +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ExpressionIsAFunctionExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+FieldNotContainedDiagnosticExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+TypeMismatchDiagnosticExtendedData +FSharp.Compiler.Diagnostics.ExtendedData: FSharp.Compiler.Diagnostics.ExtendedData+ValueNotContainedDiagnosticExtendedData FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnostic Create(FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity, System.String, Int32, FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.String]) FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity Severity FSharp.Compiler.Diagnostics.FSharpDiagnostic: FSharp.Compiler.Diagnostics.FSharpDiagnosticSeverity get_Severity() @@ -2389,6 +2504,8 @@ FSharp.Compiler.Diagnostics.FSharpDiagnostic: Int32 get_EndLine() FSharp.Compiler.Diagnostics.FSharpDiagnostic: Int32 get_ErrorNumber() FSharp.Compiler.Diagnostics.FSharpDiagnostic: Int32 get_StartColumn() FSharp.Compiler.Diagnostics.FSharpDiagnostic: Int32 get_StartLine() +FSharp.Compiler.Diagnostics.FSharpDiagnostic: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData] ExtendedData +FSharp.Compiler.Diagnostics.FSharpDiagnostic: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Diagnostics.ExtendedData+IFSharpDiagnosticExtendedData] get_ExtendedData() FSharp.Compiler.Diagnostics.FSharpDiagnostic: System.String ErrorNumberPrefix FSharp.Compiler.Diagnostics.FSharpDiagnostic: System.String ErrorNumberText FSharp.Compiler.Diagnostics.FSharpDiagnostic: System.String FileName From e6a5c75d8355ce29b6c8aa033e809c20dc0ed18e Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Thu, 14 Sep 2023 11:37:52 +0200 Subject: [PATCH 2/2] Use .NET8 rc1 (#15968) --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 4 ++-- eng/SourceBuildPrebuiltBaseline.xml | 6 +++--- global.json | 4 ++-- .../SelfContained_Trimming_Test.fsproj | 2 +- .../StaticLinkedFSharpCore_Trimming_Test.fsproj | 2 +- tests/AheadOfTime/Trimming/check.ps1 | 13 ++++--------- 7 files changed, 14 insertions(+), 19 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9d9c61fd951..8bb334d1e44 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. #------------------------------------------------------------------------------------------------------------- -ARG VARIANT=8.0.100-preview.7-bookworm-slim-amd64 +ARG VARIANT=8.0.100-rc.1-bookworm-slim-amd64 FROM mcr.microsoft.com/dotnet/sdk:${VARIANT} # Avoid warnings by switching to noninteractive diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 267a727690d..5c994fe70c4 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,9 +4,9 @@ "build": { "dockerfile": "Dockerfile", "args": { - // Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0, 7.0 + // Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0, 7.0, 8.0, etc. // Append -bullseye(-slim), -focal, or -jammy to pin to an OS version. - "VARIANT": "8.0.100-preview.7-bookworm-slim-amd64" + "VARIANT": "8.0.100-rc.1-bookworm-slim-amd64" } }, "hostRequirements": { diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 12e7e3149d0..2be856079d4 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -11,9 +11,9 @@ These will go away when repo updates targeting to net8.0 Tracked with https://github.com/dotnet/fsharp/issues/14765 --> - - - + + + diff --git a/global.json b/global.json index e56485d1349..962754dd234 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "8.0.100-preview.7.23376.3", + "version": "8.0.100-rc.1.23455.8", "allowPrerelease": true, "rollForward": "latestMajor" }, "tools": { - "dotnet": "8.0.100-preview.7.23376.3", + "dotnet": "8.0.100-rc.1.23455.8", "vs": { "version": "17.6", "components": [ diff --git a/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj b/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj index 3939fec5527..f3d591548f8 100644 --- a/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj +++ b/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj @@ -2,7 +2,7 @@ Exe - net472;net7.0 + net8.0 preview true true diff --git a/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj b/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj index 615e885dabb..d76d33610d6 100644 --- a/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj +++ b/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj @@ -2,7 +2,7 @@ Exe - net472;net7.0 + net7.0 preview true true diff --git a/tests/AheadOfTime/Trimming/check.ps1 b/tests/AheadOfTime/Trimming/check.ps1 index f7e7da74385..23c3cdfb4b3 100644 --- a/tests/AheadOfTime/Trimming/check.ps1 +++ b/tests/AheadOfTime/Trimming/check.ps1 @@ -35,16 +35,11 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len) { } } +# NOTE: Trimming now errors out on desktop TFMs, as shown below: +# error NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher. # Check net7.0 trimmed assemblies -CheckTrim -root "SelfContained_Trimming_Test" -tfm "net7.0" -outputfile "FSharp.Core.dll" -expected_len 287744 - -# Check net472 trimmed assemblies -- net472 doesn't actually trim, this just checks that everything is usable when published trimmed -CheckTrim -root "SelfContained_Trimming_Test" -tfm "net472" -outputfile "FSharp.Core.dll" -expected_len -1 - -# Disabled due to bug: https://github.com/dotnet/fsharp/issues/15167 -# Check net472 trimmed / static linked assemblies -CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net472" -outputfile "StaticLinkedFSharpCore_Trimming_Test.exe" -expected_len -1 +CheckTrim -root "SelfContained_Trimming_Test" -tfm "net8.0" -outputfile "FSharp.Core.dll" -expected_len 287744 # Check net7.0 trimmed assemblies -CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net7.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 8821248 +CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net8.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 8821760